:root {
  --bg: #070707;
  --card: #d8ff2f;
  --card-soft: #c9ef2a;
  --text: #132b2a;
  --muted: #244342;
  --accent: #ff2aa3;
  --accent-soft: #ea148f;
  --warn: #ff2aa3;
  --border: #0f0f0f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #141414 0%, var(--bg) 65%);
  min-height: 100vh;
  overflow-x: hidden;
  animation: bg-pan 12s ease-in-out infinite alternate;
}

body.chat-open {
  overflow: hidden;
}

body.scanner-open {
  overflow: hidden;
}

body.legal-open {
  overflow: hidden;
}

.container {
  width: min(980px, 92%);
  margin: 2rem auto 3rem;
  padding-bottom: 5.5rem;
  display: grid;
  gap: 1rem;
  overflow-x: clip;
}

.site-footer {
  width: min(980px, 92%);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.7rem;
  color: #d8ff2f;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-weight: 700;
}

.site-footer a {
  color: #ffffff;
  font-weight: 900;
}

#openLegalBtn {
  color: #101010;
  background: #d8ff2f;
  border: 2px solid #101010;
  font-weight: 800;
}

.hero,
.player-card,
.progress-card,
.stages-card,
.reward-card,
.chat-card,
.leaderboard-card,
.fame-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-soft) 100%);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  animation: card-fade 420ms ease both;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero-art {
  position: absolute;
  right: -24px;
  top: -38px;
  width: clamp(140px, 24vw, 240px);
  max-width: 38%;
  opacity: 0.92;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.26));
  animation: hero-art-float 4.8s ease-in-out infinite;
  pointer-events: none;
}

.hero .brand-logos,
.hero h1,
.hero .subtitle {
  position: relative;
  z-index: 1;
}

.hero:hover,
.player-card:hover,
.progress-card:hover,
.stages-card:hover,
.reward-card:hover,
.leaderboard-card:hover,
.fame-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.brand-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1rem;
  margin-bottom: 0.45rem;
}

.brand-logo {
  display: inline-block;
  width: min(210px, 52vw);
  max-width: 100%;
  height: auto;
  filter: brightness(0) saturate(100%);
}

.santoro-logo {
  width: min(185px, 45vw);
  max-width: 100%;
  filter: none;
}

.hero h1 {
  margin: 0.35rem 0 0.3rem;
  font-size: clamp(1.5rem, 2.8vw, 2.4rem);
}

.event-pill {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #f5f5f5;
  background: rgba(8, 8, 8, 0.75);
  border: 1px solid #111111;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

h2 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

input {
  flex: 1 1 240px;
  min-width: 220px;
  border-radius: 10px;
  border: 2px solid #0f0f0f;
  background: #f4ffd7;
  color: #112524;
  padding: 0.65rem 0.75rem;
  font-size: 16px;
}

input:focus {
  outline: 2px solid rgba(255, 42, 163, 0.65);
  outline-offset: 1px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.62rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 160ms ease;
}

.btn.primary {
  background: var(--accent);
  color: #151515;
  border-color: #0f0f0f;
}

.btn.primary:hover {
  background: var(--accent-soft);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
}

.btn:active {
  transform: scale(0.98);
}

.btn.ghost {
  color: var(--text);
  background: rgba(0, 0, 0, 0.08);
  border-color: #161616;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
}

.welcome-banner {
  margin: 0.2rem 0 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 2px solid #111111;
  border-radius: 10px;
  background: #f4ffd7;
  font-weight: 700;
}

.player-restart-btn {
  width: 100%;
  margin-top: 0.55rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-bar {
  margin-top: 0.55rem;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff5abb, var(--accent));
  transition: width 220ms ease;
  background-size: 170% 100%;
  animation: shimmer 2s linear infinite;
}

.stages-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
}

.mission-head {
  margin-bottom: 1rem;
}

.mission-head h2 {
  margin-bottom: 0.45rem;
}

.mission-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.mission-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.mission-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  opacity: 1;
  animation: mission-step-in 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--step-delay, 0ms);
}

.mission-step-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
}

.mission-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 900;
  border: 2px solid #121212;
  background: rgba(255, 255, 255, 0.55);
  color: #121212;
  flex-shrink: 0;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.mission-step-line {
  flex: 1;
  width: 3px;
  min-height: 12px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.18);
}

.mission-step-body {
  position: relative;
  overflow: hidden;
  border: 2px solid #121212;
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.34);
  transition: transform 280ms ease, box-shadow 280ms ease, border-color 280ms ease, background 280ms ease;
}

.mission-step-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
}

.mission-step-emoji {
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 280ms ease;
}

.mission-step-emoji.is-live {
  animation: mission-emoji-bob 2.4s ease-in-out infinite;
}

.mission-step-line.is-filled {
  background: linear-gradient(180deg, var(--step-accent, #d8ff2f), rgba(18, 18, 18, 0.12));
  animation: mission-line-fill 600ms ease both;
}

.mission-step-action {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px dashed rgba(18, 18, 18, 0.16);
  opacity: 1;
  animation: mission-action-in 420ms ease forwards;
}

.mission-scan-btn {
  position: relative;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0.65rem;
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
  overflow: hidden;
  isolation: isolate;
  animation: mission-scan-pulse 2.2s ease-in-out infinite;
}

.mission-scan-ring {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.55);
  animation: mission-scan-ring 1.8s ease-out infinite;
  pointer-events: none;
}

.mission-scan-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.mission-scan-label {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.mission-scan-feedback {
  min-height: 1.25rem;
  margin: 0.85rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  transition: opacity 220ms ease;
}

.mission-scan-feedback:empty {
  min-height: 0;
  margin-top: 0;
}

.mission-step.is-current .mission-step-body::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--step-accent, var(--accent)) 0%, transparent);
  animation: mission-inner-glow 2.4s ease-in-out infinite;
}

.mission-step.is-done .mission-step-dot {
  animation: mission-dot-pop 520ms ease;
}

.mission-panel-idle {
  animation: mission-panel-in 480ms ease both;
}

.mission-panel-done-animate {
  animation: mission-panel-in 520ms ease both, mission-panel-celebrate 1.2s ease 520ms both;
}

.mission-active {
  margin-top: 0.85rem;
}

.mission-active:empty {
  margin-top: 0;
}

.mission-step-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(18, 18, 18, 0.62);
}

.mission-step-title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  line-height: 1.25;
}

.mission-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 2px solid #121212;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mission-step-clue {
  margin: 0 0 0.15rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #1d1d1d;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px dashed rgba(18, 18, 18, 0.25);
}

.mission-step-hint {
  margin: 0.55rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(18, 18, 18, 0.72);
}

.mission-step.is-locked .mission-step-body {
  opacity: 0.72;
  border-style: dashed;
  background: rgba(0, 0, 0, 0.06);
}

.mission-step.is-locked .mission-step-dot {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(18, 18, 18, 0.45);
}

.mission-step.is-locked .mission-step-badge {
  background: rgba(0, 0, 0, 0.08);
}

.mission-step.is-done .mission-step-line {
  background: linear-gradient(180deg, var(--step-accent, #d8ff2f), rgba(18, 18, 18, 0.18));
}

.mission-step.is-done .mission-step-dot {
  background: radial-gradient(circle at 30% 30%, #fff3a5 0%, #ffc83d 45%, #ff8f00 100%);
  border-color: #6f3a00;
  color: #3b2200;
  box-shadow: 0 0 0 2px rgba(255, 42, 163, 0.22);
}

.mission-step.is-done .mission-step-body {
  background: rgba(255, 255, 255, 0.52);
  border-color: rgba(18, 18, 18, 0.85);
}

.mission-step.is-done .mission-step-badge {
  background: rgba(216, 255, 47, 0.75);
}

.mission-step.is-current .mission-step-body,
.mission-step.is-next .mission-step-body {
  border-color: var(--step-accent, var(--accent));
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--step-accent, var(--accent)) 24%, transparent),
    0 12px 28px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px) scale(1.01);
}

.mission-step.is-current .mission-step-dot,
.mission-step.is-next .mission-step-dot {
  background: var(--step-accent, var(--accent));
  color: #fff;
  border-color: #121212;
  box-shadow: 0 0 16px color-mix(in srgb, var(--step-accent, var(--accent)) 45%, transparent);
  animation: mission-dot-pulse 1.8s ease-in-out infinite;
}

.mission-step.is-current .mission-step-badge,
.mission-step.is-next .mission-step-badge {
  background: color-mix(in srgb, var(--step-accent, var(--accent)) 22%, white);
}

.mission-step.is-pulsing .mission-step-body {
  animation: mission-step-unlock 720ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mission-step.is-pulsing .mission-step-dot {
  animation: mission-dot-pop 720ms ease;
}

.mission-panel {
  border: 2px solid #121212;
  border-radius: 16px;
  padding: 1rem 1.05rem;
  margin-bottom: 0.95rem;
  background: rgba(255, 255, 255, 0.42);
}

.mission-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
}

.mission-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mission-panel-idle {
  text-align: center;
  border-style: dashed;
}

.mission-panel-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.35rem;
}

.mission-panel-active {
  border-color: var(--step-accent, var(--accent));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--step-accent, var(--accent)) 12%, white) 0%,
    rgba(255, 255, 255, 0.52) 100%
  );
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.mission-panel-kicker {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 2px solid #121212;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mission-panel-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mission-panel-emoji {
  font-size: 2rem;
  line-height: 1;
}

.mission-panel-sub {
  font-size: 0.84rem;
  color: rgba(18, 18, 18, 0.72);
}

.mission-panel-clue {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: #151515;
  line-height: 1.45;
}

.mission-panel-rules {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: rgba(18, 18, 18, 0.78);
  font-size: 0.86rem;
}

.mission-panel-done {
  text-align: center;
  background: rgba(216, 255, 47, 0.28);
}

.scanner-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.75rem;
  border: 2px dashed #121212;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.06);
}

.scanner-callout-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.scanner-callout p {
  margin: 0;
  line-height: 1.45;
  color: #1d1d1d;
}

.scanner-row {
  margin-bottom: 0.35rem;
}

.scanner-btn {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 0.8rem 1rem;
}

#scanMessage.ok,
.scan-feedback.ok {
  color: #0f5132;
  font-weight: 700;
}

#scanMessage.error,
.scan-feedback.error {
  color: #842029;
  font-weight: 700;
}

.unlock-next {
  margin: 0.55rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
}

@keyframes mission-step-in {
  0% {
    transform: translateY(14px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes mission-action-in {
  0% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes mission-emoji-bob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-4px) rotate(-6deg);
  }
}

@keyframes mission-line-fill {
  0% {
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0.4;
  }
  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes mission-scan-pulse {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  }
  50% {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), 0 0 0 4px rgba(255, 255, 255, 0.22);
  }
}

@keyframes mission-scan-ring {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  100% {
    transform: scale(1.12);
    opacity: 0;
  }
}

@keyframes mission-inner-glow {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--step-accent, var(--accent)) 0%, transparent);
  }
  50% {
    box-shadow: inset 0 0 24px 0 color-mix(in srgb, var(--step-accent, var(--accent)) 18%, transparent);
  }
}

@keyframes mission-dot-pop {
  0% {
    transform: scale(0.82);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes mission-panel-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mission-panel-celebrate {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.01);
  }
}

@keyframes mission-dot-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes mission-step-unlock {
  0% {
    transform: scale(0.98);
    opacity: 0.65;
  }
  55% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.checkpoint-view {
  display: grid;
  gap: 0.8rem;
}

.medals-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.medal-item {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  border: 2px solid #121212;
  border-radius: 12px;
  padding: 0.55rem 0.4rem 0.65rem;
  background: rgba(0, 0, 0, 0.1);
  min-height: 92px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.medal-step {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(18, 18, 18, 0.55);
}

.medal-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  background: #1e1e1e;
  border: 2px solid #080808;
  color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.medal-status {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(18, 18, 18, 0.65);
}

.medal-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  color: #1d1d1d;
  line-height: 1.2;
  min-height: 2.2em;
}

.medal-item.locked {
  background: rgba(0, 0, 0, 0.18);
  border-style: dashed;
  opacity: 0.72;
}

.medal-item.locked .medal-label {
  color: rgba(18, 18, 18, 0.55);
  font-style: italic;
}

.medal-item.current {
  background: rgba(255, 255, 255, 0.5);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 42, 163, 0.18);
  transform: translateY(-2px);
}

.medal-item.current .medal-dot {
  background: #ff2aa3;
  border-color: #7a003f;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 42, 163, 0.35);
}

.medal-item.current .medal-status {
  color: #7a003f;
}

.medal-item.unlocked {
  background: rgba(255, 255, 255, 0.42);
}

.medal-item.unlocked .medal-dot {
  background: radial-gradient(circle at 30% 30%, #fff3a5 0%, #ffc83d 45%, #ff8f00 100%);
  border-color: #6f3a00;
  color: #3b2200;
  box-shadow: 0 0 0 2px rgba(255, 42, 163, 0.3), 0 0 12px rgba(255, 42, 163, 0.25);
  animation: medal-pop 450ms ease, medal-glow 2.4s ease-in-out infinite;
}

.stages-intro {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.92rem;
}

.mission-progress {
  display: grid;
  gap: 0.45rem;
  justify-items: start;
  margin-bottom: 0.9rem;
  padding: 0.85rem 1rem;
  border: 2px dashed #121212;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.08);
}

.mission-progress p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.mission-pill {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 2px solid #121212;
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.medals-row:not(.hidden) {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.stage-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7a003f;
}

.stage-clue {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.stage-hint {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(36, 67, 66, 0.85);
  font-style: italic;
}

.stage-item {
  border: 2px solid #121212;
  background: #e6ff70;
  border-radius: 12px;
  padding: 0.8rem;
}

.stage-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.stage-item p {
  margin: 0 0 0.7rem;
  color: var(--muted);
  min-height: 2.1rem;
  overflow-wrap: anywhere;
}

.chip {
  display: inline-block;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.55rem;
  border: 1px solid #121212;
  color: #121212;
  background: rgba(255, 255, 255, 0.35);
}

.stage-item.done {
  border-color: #121212;
}

.stage-item.done .chip {
  background: rgba(20, 20, 20, 0.16);
  color: #121212;
  border-color: #121212;
}

.stage-item.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 42, 163, 0.26) inset;
}

.scanner-tools {
  margin-top: 1rem;
  border-top: 2px solid #121212;
  padding-top: 0.9rem;
}

.qr-reader {
  margin-top: 0.75rem;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #121212;
  background: #eeff9f;
  width: 100%;
  max-width: 100%;
}

#qrReader video,
#qrReader canvas,
#qrReader img {
  max-width: 100%;
  height: auto;
}

#qrReader__scan_region {
  border-radius: 12px;
  overflow: hidden;
}

#scanMessage.ok {
  color: #122412;
}

#scanMessage.error {
  color: #7a003f;
}

.reward-card {
  border-color: #111111;
  background: linear-gradient(180deg, #ff69c0 0%, #ff2aa3 100%);
  color: #141414;
}

.reward-note {
  color: #1d1d1d;
}

.reward-benefits {
  margin: 0.65rem 0 0.85rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.55rem;
}

.reward-benefits li {
  line-height: 1.45;
}

.reward-stand {
  margin: 0;
  font-size: 0.92rem;
  color: #2a2a2a;
}

.token {
  background: rgba(216, 255, 47, 0.75);
  display: inline-block;
  border: 2px dashed #131313;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
}

.leaderboard-list,
.fame-list {
  display: grid;
  gap: 0.55rem;
  max-width: 100%;
  min-width: 0;
}

.leaderboard-card,
.fame-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.collapsible-card {
  padding: 0;
}

.collapsible {
  width: 100%;
}

.collapsible-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-size: 1.1rem;
  font-weight: 700;
  user-select: none;
}

.collapsible-head::-webkit-details-marker {
  display: none;
}

.collapsible-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 2px solid #111;
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 220ms ease, background 180ms ease;
}

.collapsible[open] .collapsible-chevron {
  transform: rotate(180deg);
  background: rgba(216, 255, 47, 0.75);
}

.collapsible-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 260ms ease;
}

.collapsible[open] .collapsible-body {
  grid-template-rows: 1fr;
}

.collapsible-body > .leaderboard-list {
  overflow: hidden;
  min-height: 0;
  padding: 0 1.1rem 1rem;
}

.fame-carousel {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scroll-snap-type: x mandatory;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.fame-carousel .fame-card-item {
  min-width: min(260px, 74vw);
  max-width: min(300px, 80vw);
  flex: 0 0 auto;
  scroll-snap-align: start;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.fame-carousel .fame-card-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  border: 2px solid #111111;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.42);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  min-width: 0;
}

.leaderboard-item .pos {
  font-weight: 900;
}

.leaderboard-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-item .time {
  font-weight: 700;
  white-space: nowrap;
}

.fame-form {
  margin-bottom: 0.8rem;
}

.fame-card-item {
  border: 2px solid #111111;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
  min-width: 0;
}

.fame-card-item img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.fame-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.6rem 0.15rem;
  font-size: 0.83rem;
}

.fame-meta strong,
.fame-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fame-caption {
  margin: 0;
  padding: 0 0.6rem 0.6rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.chat-messages {
  border: 2px solid #121212;
  border-radius: 12px;
  background: #eeff9f;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.chat-message {
  border: 1px solid #121212;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.45);
  animation: message-in 220ms ease both;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
  color: #1d3231;
}

.chat-text {
  margin: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-row {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-compose {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.35rem;
}

.chat-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  pointer-events: auto;
  touch-action: manipulation;
}

.chat-row .btn {
  width: auto;
  flex: 0 0 auto;
  min-width: 88px;
}

.chat-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  min-width: 72px;
  min-height: 52px;
  padding: 0.6rem 0.95rem;
  border-radius: 999px;
  border: 2px solid #111111;
  background: var(--accent);
  color: #101010;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  animation: fab-float 2.6s ease-in-out infinite;
}

.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  margin-left: 0.45rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #111111;
  color: #d8ff2f;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.8rem;
  z-index: 60;
  width: min(390px, calc(100vw - 2rem));
  height: min(66vh, 560px);
  max-height: min(66vh, 560px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.chat-open .chat-panel {
  z-index: 130;
}

body.chat-open .legal-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#chatHint {
  flex-shrink: 0;
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.chat-panel .chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
}

.chat-fab.is-open {
  display: none;
}

.chat-fab.shake-once {
  animation: chat-shake 560ms ease;
}

.chat-panel.shake-once {
  animation: chat-shake-panel 560ms ease;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.chat-head h2 {
  margin: 0;
}

.close-chat-btn {
  min-height: 42px;
  padding: 0.5rem 0.8rem;
  font-weight: 700;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #070707;
  color: #d8ff2f;
  padding: calc(0.8rem + env(safe-area-inset-top)) 0.8rem
    calc(0.8rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.scanner-header h2 {
  margin: 0;
}

.close-scanner-btn {
  color: #101010;
  background: #d8ff2f;
  border: 2px solid #d8ff2f;
  font-weight: 800;
}

.fullscreen-reader {
  flex: 1 1 auto;
  min-height: 0;
  width: min(92vw, 78vh);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-color: #d8ff2f;
  background: #101010;
}

.scanner-help {
  margin: 0;
  color: #d8ff2f;
  font-size: 0.95rem;
}

.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
}

.fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.unlock-card {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #d8ff2f 0%, #c9ef2a 100%);
  color: #101010;
  border: 2px solid #101010;
  border-radius: 16px;
  padding: 1rem 1.2rem;
  text-align: center;
  animation: pop-celebrate 520ms ease, pulse-strong 1s ease-in-out infinite;
}

.unlock-title {
  margin: 0;
  font-size: clamp(1.35rem, 5.8vw, 2rem);
  font-weight: 900;
}

.unlock-subtitle {
  margin: 0.45rem 0 0;
  font-weight: 600;
}

.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}

.legal-card {
  width: min(760px, 100%);
  max-height: min(85vh, 780px);
  overflow: auto;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-soft) 100%);
  border: 2px solid #111111;
  border-radius: 14px;
  padding: 1rem;
}

.legal-card h2 {
  margin-top: 0;
}

.legal-card ul {
  margin-top: 0.35rem;
  margin-bottom: 0.6rem;
}

.legal-actions {
  margin-top: 0.4rem;
}

@keyframes pop-celebrate {
  0% {
    transform: scale(0.78);
    opacity: 0;
  }
  70% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes card-fade {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes medal-pop {
  0% {
    transform: scale(0.65);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes medal-glow {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.25);
  }
}

@keyframes fab-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes pulse-strong {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 42, 163, 0.32);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(255, 42, 163, 0);
  }
}

@keyframes chat-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes chat-shake-panel {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes bg-pan {
  0% {
    background-position: 50% 0%;
  }
  100% {
    background-position: 50% 20%;
  }
}

@keyframes hero-art-float {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(8px) rotate(-1deg);
  }
}

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

  .mission-step,
  .mission-step-action,
  .mission-step-body,
  .mission-scan-btn,
  .card-fade,
  .chat-message {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 900px) {
  .container {
    width: min(100%, 94%);
    margin: 1rem auto 2rem;
  }

  .site-footer {
    width: calc(100% - 1rem);
    margin-bottom: calc(1rem + env(safe-area-inset-bottom));
    align-items: center;
  }

  .hero,
  .player-card,
  .progress-card,
  .stages-card,
  .reward-card,
  .chat-card,
  .leaderboard-card,
  .fame-card {
    padding: 0.9rem;
  }

  .brand-logo {
    width: min(180px, 42vw);
  }

  .santoro-logo {
    width: min(160px, 38vw);
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 1rem);
    margin: 0.5rem auto 1rem;
    gap: 0.75rem;
  }

  .hero,
  .player-card,
  .progress-card,
  .stages-card,
  .reward-card,
  .chat-card,
  .leaderboard-card,
  .fame-card {
    border-radius: 12px;
    padding: 0.8rem;
  }

  .brand-logos {
    gap: 0.55rem 0.7rem;
    justify-content: center;
  }

  .brand-logo {
    width: min(150px, 42vw);
  }

  .santoro-logo {
    width: min(130px, 36vw);
  }

  .hero h1 {
    font-size: clamp(1.2rem, 7vw, 1.7rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .hero-art {
    right: -18px;
    top: -22px;
    width: min(34vw, 150px);
    opacity: 0.8;
  }

  .subtitle,
  .muted,
  .progress-info {
    font-size: 0.9rem;
  }

  .row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .chat-row {
    flex-direction: row;
    align-items: stretch;
  }

  .chat-row input,
  .chat-row .btn {
    width: auto;
    min-width: 0;
  }

  .chat-row .btn {
    min-width: 84px;
  }

  input,
  .btn {
    width: 100%;
    min-width: 0;
  }

  .row input {
    flex: 0 0 auto;
    min-height: 46px;
  }

  input {
    padding: 0.8rem 0.85rem;
  }

  .btn {
    min-height: 44px;
    padding: 0.75rem 0.85rem;
  }

  .progress-info {
    align-items: center;
  }

  .stage-item {
    padding: 0.7rem;
  }

  .mission-step-top {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mission-step-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .mission-step {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0.55rem;
  }

  .mission-step-dot {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }

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

  .medal-item {
    min-height: 84px;
  }

  .medal-dot {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  .medal-label {
    font-size: 0.66rem;
  }

  .leaderboard-item {
    grid-template-columns: 32px minmax(0, 1fr) 62px;
    gap: 0.4rem;
    padding: 0.45rem 0.5rem;
  }

  .leaderboard-item strong {
    font-size: 0.92rem;
  }

  .leaderboard-item .time {
    font-size: 0.84rem;
    text-align: right;
  }

  .fame-carousel .fame-card-item {
    min-width: min(220px, 74vw);
    max-width: min(250px, 78vw);
  }

  .stage-item p {
    min-height: 0;
  }

  .qr-reader {
    margin-top: 0.6rem;
    min-height: 220px;
  }

  .chat-messages {
    min-height: 160px;
    max-height: 220px;
  }

  .chat-fab {
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  .chat-panel {
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: calc(0.75rem + env(safe-area-inset-top)) 0.75rem
      calc(0.75rem + env(safe-area-inset-bottom));
  }

  .chat-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, var(--card) 0%, var(--card-soft) 100%);
    padding-bottom: 0.35rem;
  }

  .chat-head h2 {
    font-size: 1.05rem;
  }

  .chat-messages {
    min-height: 0;
    max-height: none;
  }

  .chat-compose {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 430px) {
  .leaderboard-item {
    grid-template-columns: 28px minmax(0, 1fr) 58px;
    gap: 0.35rem;
    padding: 0.4rem 0.45rem;
  }

  .leaderboard-item .pos {
    font-size: 0.84rem;
  }

  .leaderboard-item strong {
    font-size: 0.86rem;
  }

  .leaderboard-item .time {
    font-size: 0.8rem;
  }

  .fame-carousel {
    gap: 0.55rem;
  }

  .fame-carousel .fame-card-item {
    min-width: calc(100vw - 2.1rem);
    max-width: calc(100vw - 2.1rem);
  }

  .fame-card-item img {
    max-height: 180px;
  }
}

@media (max-width: 390px) {
  .container {
    width: calc(100% - 0.75rem);
    padding-bottom: 5rem;
  }

  .hero,
  .player-card,
  .progress-card,
  .stages-card,
  .reward-card,
  .chat-card,
  .leaderboard-card,
  .fame-card {
    padding: 0.7rem;
  }

  .brand-logos {
    justify-content: flex-start;
  }

  .brand-logo {
    width: min(138px, 41vw);
  }

  .santoro-logo {
    width: min(118px, 34vw);
  }
}
