:root {
  color-scheme: dark;
  --bg: #030604;
  --panel: rgba(7, 16, 11, 0.86);
  --panel-strong: rgba(12, 23, 17, 0.96);
  --line: rgba(124, 255, 46, 0.34);
  --line-strong: rgba(140, 255, 62, 0.86);
  --text: #f4fff1;
  --muted: #a9bfa4;
  --green: #7cff2e;
  --green-soft: #baff76;
  --cyan: #6cf5ff;
  --amber: #ffd15c;
  --red: #ff657a;
  --shadow: 0 0 34px rgba(124, 255, 46, 0.26);
  font-family: Tahoma, Arial, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  text-align: right;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 255, 46, 0.15), transparent 22rem),
    linear-gradient(145deg, #020302, #08100b 54%, #020402);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.game-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(2, 4, 3, 0.28), rgba(2, 4, 3, 0.78)),
    #040705;
}

.screen {
  display: none;
  min-height: 100vh;
  position: relative;
  padding: 18px 14px 86px;
}

.screen.is-active {
  display: block;
}

.hero-bg,
.result-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 5, 3, 0.08), rgba(2, 5, 3, 0.76) 68%, #030604 100%),
    url("./assets/hero-arena.png") center top / cover no-repeat;
  opacity: 0.74;
}

.hero-bg::after,
.result-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(124, 255, 46, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 255, 46, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, transparent, black 12%, black 78%, transparent);
}

.landing-screen > *,
.result-screen > * {
  position: relative;
  z-index: 1;
}

.top-hud,
.mission-hud,
.console-row,
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-hud {
  min-height: 76px;
}

.score-chip,
.player-chip,
.arcade-card,
.mission-console,
.qr-login,
.play-panel,
.gate,
.choice-card,
.bottom-nav,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(25, 34, 28, 0.72), rgba(4, 8, 6, 0.94)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.score-chip {
  min-width: 96px;
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 9px 12px;
}

.score-chip span {
  color: var(--green);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 18px rgba(124, 255, 46, 0.72);
}

.score-chip small,
.player-chip span,
.mission-hud span,
.console-row span,
.console-row small,
.hud-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.score-chip.compact {
  min-width: 72px;
  min-height: 52px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.mini-avatar,
.asset-icon,
.final-badge {
  background-image: url("./assets/arcade-assets-sheet.png");
  background-repeat: no-repeat;
  background-size: 720px auto;
}

.mini-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-image: url("./assets/student-agent-duo.png");
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line-strong);
}

.title-zone {
  padding: 28px 2px 18px;
  text-align: center;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(3.6rem, 17vw, 7rem);
  line-height: 0.96;
  text-shadow:
    0 0 18px rgba(124, 255, 46, 0.72),
    0 3px 0 rgba(0, 0, 0, 0.72);
}

.title-zone p,
.arcade-card p,
.feedback,
.funny-message,
.advice-line,
.share-box p {
  color: #e7f7df;
  line-height: 1.75;
}

.mission-console {
  padding: 12px;
  margin-bottom: 14px;
}

.console-row > div {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: center;
}

.console-row strong {
  color: var(--green);
  font-size: 1.65rem;
  line-height: 1;
}

.meter {
  height: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
}

.meter i,
.progress-track i,
.timer-fill,
.repair-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-soft), var(--cyan));
  box-shadow: 0 0 18px rgba(124, 255, 46, 0.46);
}

.arcade-card {
  padding: 18px 16px;
  overflow: hidden;
}

.intro-card {
  display: grid;
  gap: 12px;
}

.round-label {
  width: max-content;
  margin: 0 auto;
  padding: 7px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--green);
  background: rgba(13, 44, 16, 0.82);
  font-weight: 900;
}

.intro-card h2,
.play-panel h2,
.result-card h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 7.4vw, 3rem);
  line-height: 1.35;
}

.hero-characters {
  min-height: 148px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(124, 255, 46, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.hero-characters img {
  width: 100%;
  height: 176px;
  object-fit: cover;
  object-position: center 45%;
  filter: drop-shadow(0 0 18px rgba(124, 255, 46, 0.3));
  animation: hover 3.2s ease-in-out infinite;
}

.primary-button,
.ghost-button,
.nav-item,
.choice-button,
.gate {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.primary-button {
  width: 100%;
  padding: 14px 18px;
  color: #041005;
  background: linear-gradient(90deg, var(--green), var(--green-soft), var(--cyan));
  font-weight: 950;
  box-shadow: 0 0 28px rgba(124, 255, 46, 0.28);
}

.ghost-button,
.nav-item,
.choice-button {
  background: rgba(5, 16, 8, 0.88);
}

.primary-button:hover,
.ghost-button:hover,
.nav-item:hover,
.choice-button:hover,
.gate:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.nav-item:focus-visible,
.choice-button:focus-visible,
.gate:focus-visible {
  outline: 3px solid rgba(124, 255, 46, 0.28);
  outline-offset: 2px;
}

.qr-login {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 12px;
}

.qr-login img {
  width: 92px;
  height: 92px;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
}

.qr-login strong,
.qr-login span,
.qr-login code {
  display: block;
}

.qr-login strong {
  color: var(--green);
  margin-bottom: 4px;
}

.qr-login span {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.qr-login code {
  margin-top: 6px;
  color: var(--cyan);
  direction: ltr;
  text-align: right;
  font: 0.72rem Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.mission-screen {
  background:
    linear-gradient(180deg, rgba(2, 5, 3, 0.36), rgba(2, 5, 3, 0.94)),
    url("./assets/hero-arena.png") center top / cover no-repeat;
}

.mission-hud {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 6px 0 12px;
}

.mission-hud > div:not(.score-chip) {
  display: grid;
  gap: 2px;
  text-align: center;
}

.mission-hud strong {
  color: var(--green);
}

.progress-track {
  position: relative;
  z-index: 2;
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  margin-bottom: 12px;
}

.progress-track i {
  width: 0%;
  transition: width 280ms ease;
}

.playfield {
  min-height: 70vh;
}

.play-panel {
  position: relative;
  overflow: hidden;
  padding: 16px;
  min-height: 67vh;
}

.play-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background: linear-gradient(90deg, transparent, rgba(124, 255, 46, 0.08), transparent);
  transform: translateX(110%);
  animation: scan 4.8s ease-in-out infinite;
}

.play-panel > * {
  position: relative;
  z-index: 1;
}

.sort-stage {
  display: grid;
  gap: 14px;
}

.task-card {
  position: relative;
  min-height: 178px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 10%, rgba(124, 255, 46, 0.36), transparent 42%),
    linear-gradient(180deg, rgba(20, 43, 23, 0.98), rgba(5, 13, 8, 0.98));
  box-shadow: 0 0 34px rgba(124, 255, 46, 0.28);
  touch-action: none;
  cursor: grab;
  animation: card-drop 360ms ease both;
}

.task-card.is-dragging {
  cursor: grabbing;
  z-index: 6;
  box-shadow: 0 0 48px rgba(124, 255, 46, 0.5);
}

.task-card h2 {
  margin: 0;
  font-size: clamp(1.4rem, 7vw, 2.4rem);
  color: #ffffff;
  text-shadow: 0 0 12px rgba(124, 255, 46, 0.42);
}

.task-card p {
  margin: 0;
  color: #dff6d7;
  line-height: 1.7;
}

.gate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gate {
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 12px;
  font-weight: 950;
  background: rgba(4, 12, 7, 0.9);
}

.gate small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}

.gate[data-type="agent"] {
  background: linear-gradient(180deg, rgba(124, 255, 46, 0.2), rgba(4, 12, 7, 0.94));
}

.gate.is-hot {
  border-color: var(--green);
  box-shadow: 0 0 28px rgba(124, 255, 46, 0.4);
}

.feedback {
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.feedback.good {
  border-color: rgba(124, 255, 46, 0.7);
}

.feedback.bad {
  border-color: rgba(255, 101, 122, 0.72);
}

.shake {
  animation: shake 360ms ease;
}

.crisis-panel {
  background:
    linear-gradient(180deg, rgba(3, 6, 4, 0.1), rgba(3, 6, 4, 0.85)),
    url("./assets/project-dashboard.png") center top / cover no-repeat;
}

.timer-bar {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  margin: 10px 0 14px;
}

.timer-fill {
  width: 100%;
  transition: width 180ms linear;
}

.repair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.repair-module {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
}

.repair-module strong {
  display: block;
  color: var(--green);
  margin-bottom: 7px;
}

.repair-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.repair-fill {
  width: 0%;
  transition: width 360ms ease;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice-button {
  width: 100%;
  padding: 12px;
  text-align: right;
}

.choice-button strong,
.choice-button span {
  display: block;
}

.choice-button strong {
  color: var(--text);
  margin-bottom: 4px;
}

.choice-button span {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.path-panel {
  display: grid;
  gap: 14px;
}

.neon-path {
  position: relative;
  height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 13%, rgba(124, 255, 46, 0.18) 13% 15%, transparent 15% 32%, rgba(124, 255, 46, 0.18) 32% 34%, transparent 34% 51%, rgba(124, 255, 46, 0.18) 51% 53%, transparent 53% 70%, rgba(124, 255, 46, 0.18) 70% 72%, transparent 72%),
    rgba(0, 0, 0, 0.38);
}

.path-avatar {
  position: absolute;
  bottom: 22px;
  right: 8%;
  width: 58px;
  height: 58px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background-image: url("./assets/arcade-assets-sheet.png");
  background-position: 4% 7%;
  background-size: 360px auto;
  box-shadow: 0 0 24px rgba(124, 255, 46, 0.44);
  transition: right 380ms ease;
}

.token-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 4px;
}

.future-token {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
  font-size: 0.9rem;
}

.future-token.is-collected {
  color: #031004;
  background: var(--green);
  box-shadow: 0 0 18px rgba(124, 255, 46, 0.44);
}

.bottom-nav {
  position: fixed;
  right: 50%;
  bottom: 10px;
  z-index: 10;
  width: min(calc(100% - 24px), 696px);
  transform: translateX(50%);
  padding: 8px;
}

.nav-item {
  flex: 1;
  min-height: 48px;
  color: var(--muted);
}

.nav-item.is-active {
  color: #031004;
  background: var(--green);
  box-shadow: 0 0 18px rgba(124, 255, 46, 0.36);
}

.result-screen {
  display: none;
  align-content: center;
}

.result-screen.is-active {
  display: grid;
}

.result-card {
  padding: 22px 16px;
  text-align: center;
}

.final-badge {
  width: 148px;
  height: 148px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background-position: 7% 78%;
  filter: drop-shadow(0 0 28px rgba(124, 255, 46, 0.48));
  animation: badge-reveal 700ms cubic-bezier(.2, 1.35, .35, 1) both;
}

.final-badge.maker {
  background-position: 30% 78%;
}

.final-badge.analyst {
  background-position: 52% 78%;
}

.final-badge.creator {
  background-position: 74% 78%;
}

.final-badge.explorer {
  background-position: 95% 78%;
}

.final-score {
  width: 118px;
  min-height: 76px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.46);
}

.final-score span {
  color: var(--green);
  font-size: 2rem;
  font-weight: 950;
}

#profileName {
  color: var(--amber);
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.share-box {
  padding: 12px;
  margin: 14px 0;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(124, 255, 46, 0.08);
}

.share-box strong {
  color: var(--green);
}

.share-box p {
  margin: 8px 0 0;
}

.score-pop {
  animation: score-pop 260ms ease;
}

@keyframes hover {
  50% { transform: translateY(-8px); }
}

@keyframes pulse-agent {
  50% { transform: scale(1.06); filter: drop-shadow(0 0 18px rgba(124, 255, 46, 0.6)); }
}

@keyframes scan {
  45%, 100% { transform: translateX(-110%); }
}

@keyframes card-drop {
  from { transform: translateY(-24px) scale(0.96); }
  to { transform: translateY(0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(8px); }
  50% { transform: translateX(-8px); }
  75% { transform: translateX(5px); }
}

@keyframes score-pop {
  50% { transform: scale(1.08); }
}

@keyframes badge-reveal {
  from { transform: scale(0.25) rotate(-14deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

@media (min-width: 680px) {
  .screen {
    padding-inline: 22px;
  }

  .gate-grid,
  .repair-grid {
    gap: 14px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
