.games-shell {
  min-height: 100vh;
}

.games-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(13, 13, 26, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.games-topbar-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.games-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.back-link {
  color: var(--text);
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(123, 47, 190, 0.22);
}

.games-page {
  display: grid;
  gap: 2rem;
  padding: 3rem 0 5rem;
}

.games-hero,
.arcade-card,
.game-modal-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(123, 47, 190, 0.18), rgba(88, 101, 242, 0.1)),
    rgba(20, 20, 40, 0.82);
  box-shadow: var(--shadow);
}

.games-hero {
  padding: 2rem;
}

.games-hero h1 {
  font-size: clamp(3rem, 7vw, 5.6rem);
}

.games-hero p:last-child {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.arcade-card {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.arcade-card:hover {
  transform: translateY(-4px);
  border-color: rgba(168, 85, 247, 0.32);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.42);
}

.arcade-card h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.arcade-card p {
  color: var(--muted);
  line-height: 1.65;
}

.controls-line {
  margin: 0;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.controls-line strong {
  color: var(--text);
}

.save-line {
  margin: -0.3rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.save-line.active {
  color: var(--highlight);
}

.admin-panel {
  margin-top: 0.2rem;
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: 16px;
  background: rgba(61, 220, 151, 0.07);
  overflow: hidden;
}

.admin-toggle {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  border: 0;
  background: rgba(61, 220, 151, 0.08);
  font-family: "Orbitron", sans-serif;
  font-size: 0.78rem;
}

.admin-lock {
  color: var(--success);
}

.admin-panel-body {
  display: none;
  gap: 0.75rem;
  padding: 0.9rem;
}

.admin-panel.open .admin-panel-body {
  display: grid;
}

.admin-panel label {
  display: grid;
  gap: 0.4rem;
}

.admin-panel label span {
  color: var(--muted);
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
}

.admin-panel input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.admin-panel input:focus {
  outline: none;
  border-color: rgba(61, 220, 151, 0.45);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.1);
}

.admin-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-code-list code {
  padding: 0.42rem 0.55rem;
  color: var(--text);
  border: 1px solid rgba(61, 220, 151, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.admin-status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--success);
  font-size: 0.92rem;
}

.candy-cheat-panel {
  position: fixed;
  left: 1rem;
  top: 112px;
  z-index: 240;
  width: min(260px, calc(100vw - 2rem));
  display: none;
  overflow: hidden;
  border: 1px solid rgba(168, 85, 247, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(123, 47, 190, 0.28), rgba(88, 101, 242, 0.16)),
    rgba(13, 13, 26, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.candy-cheat-panel.visible {
  display: block;
}

.candy-cheat-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  border: 0;
  background: rgba(168, 85, 247, 0.14);
  font-family: "Orbitron", sans-serif;
  font-size: 0.78rem;
}

.candy-cheat-body {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem;
}

.candy-cheat-panel.minimized .candy-cheat-body {
  display: none;
}

.candy-cheat-body button {
  width: 100%;
  min-height: 38px;
  padding: 0.6rem 0.7rem;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.candy-cheat-body button:hover {
  transform: translateX(2px);
  border-color: rgba(168, 85, 247, 0.34);
  background: rgba(168, 85, 247, 0.16);
}

.candy-cheat-status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--success);
  font-size: 0.86rem;
  line-height: 1.45;
}

.game-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  padding: 1rem;
}

.game-modal.open {
  display: grid;
  place-items: center;
}

.game-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 12, 0.82);
  backdrop-filter: blur(14px);
}

.game-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1200px, 100%);
  max-height: calc(100vh - 2rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.game-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.game-modal-header p:last-child {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.modal-close {
  color: var(--text);
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, background 0.2s ease;
}

.modal-close:hover {
  transform: translateY(-2px);
  background: rgba(168, 85, 247, 0.16);
}

.game-frame {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #090914;
  box-shadow: inset 0 0 40px rgba(168, 85, 247, 0.08);
}

.game-frame iframe {
  display: block;
  width: 100%;
  height: min(76vh, 720px);
  min-height: 420px;
  border: none;
}

@media (max-width: 640px) {
  .games-topbar-inner {
    min-height: 76px;
  }

  .brand-copy {
    display: none;
  }

  .games-topbar-actions {
    gap: 0.5rem;
  }

  .games-page {
    padding-top: 1.5rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .games-hero,
  .arcade-card,
  .game-modal-panel {
    padding: 1rem;
    border-radius: 18px;
  }

  .game-modal {
    padding: 0.55rem;
  }

  .game-modal-header {
    flex-direction: column;
  }

  .modal-close {
    width: 100%;
  }

  .game-frame {
    border-radius: 14px;
  }

  .game-frame iframe {
    height: 72vh;
    min-height: 460px;
  }

  .candy-cheat-panel {
    top: auto;
    left: 0.55rem;
    bottom: 0.55rem;
    width: min(280px, calc(100vw - 1.1rem));
  }
}
