/* Created: 2026-10-20 (AUD-2293)
   Purpose: styles for survey.intrect.io (quiz, method and privacy pages).
   Dark theme carried over from the old ai-music-survey game. System font stack only, no web fonts.
   CSP style-src 'self': nothing here relies on inline styles. */

:root {
  --bg-1: #1a1a2e;
  --bg-2: #16213e;
  --bg-3: #0f3460;
  --text: #f4f5fa;
  --muted: #b4bacd;
  --faint: #8d94ab;
  --card: rgba(255, 255, 255, 0.06);
  --card-line: rgba(255, 255, 255, 0.14);
  --accent: #e94560;
  --gold: #f9d423;
  --good: #4ade80;
  --bad: #f87171;
  --ink: #14142b;
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans KR', 'Apple SD Gothic Neo',
    'Malgun Gothic', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  background-color: var(--bg-2);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--gold);
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 50;
}

.skip-link:focus {
  top: 12px;
}

/* ---------------------------------------------------------------- layout */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 16px 0;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  color: var(--accent);
}

.brand-suffix {
  color: var(--muted);
  font-weight: 400;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.chip {
  min-height: 36px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.14);
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

.container:focus {
  outline: none;
}

.screen {
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status {
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #ffd2d2;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.eyebrow {
  text-align: center;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.screen-title,
.result-title,
.stage-name {
  text-align: center;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.screen-title {
  font-size: 2.3rem;
  margin: 8px 0 10px;
}

.screen-title:focus,
.result-title:focus,
.stage-name:focus,
.reveal:focus {
  outline: none;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 18px 0 6px;
}

.caption {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 4px 0 10px;
}

.fineprint {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 10px 0 22px;
}

.tip {
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}

.rules {
  list-style: none;
}

.rules li {
  padding: 6px 0 6px 22px;
  position: relative;
}

.rules li::before {
  content: '\266A';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.footnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 24px;
  font-size: 0.9rem;
}

.empty {
  text-align: center;
  color: var(--text);
  padding: 12px 0 4px;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--card-line);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.btn-small {
  min-height: 40px;
  padding: 6px 16px;
  font-size: 0.95rem;
}

/* ------------------------------------------------------------ leaderboard */

.table-wrap {
  overflow-x: auto;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.lb-table th,
.lb-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--card-line);
}

.lb-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.lb-table .lb-nick {
  text-align: left;
  overflow-wrap: anywhere;
}

.lb-table .lb-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.lb-table tr.is-mine td {
  color: var(--gold);
  background: rgba(233, 69, 96, 0.14);
}

.lb-you {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ stage intro */

.intro {
  text-align: center;
  padding: 28px 0 8px;
}

.stage-number {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.3em;
}

.stage-name {
  font-size: 2.4rem;
  margin: 10px 0 12px;
}

.stage-description {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 auto 20px;
  max-width: 34em;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin-bottom: 20px;
}

.chip-row li {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.92rem;
}

.lives {
  display: inline-flex;
  gap: 4px;
  font-size: 1.4rem;
  line-height: 1;
}

.intro .lives {
  font-size: 2rem;
  margin-bottom: 26px;
}

.heart {
  color: var(--accent);
  transition: color 0.3s ease, opacity 0.3s ease;
}

.heart.lost {
  color: var(--faint);
  opacity: 0.45;
}

/* --------------------------------------------------------------- question */

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.hud-left {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-badge {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--ink);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 3px 12px;
  border-radius: 12px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 4px;
  transition: width 0.25s ease;
}

.count {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 36px;
  text-align: right;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
  background: var(--card);
  border-radius: 10px;
  padding: 4px 10px;
}

.score-label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.note-warmup {
  text-align: center;
  background: rgba(74, 222, 128, 0.12);
  color: var(--good);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.player {
  text-align: center;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.btn-play {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.btn-play:hover {
  transform: scale(1.06);
}

.btn-play #play-icon {
  display: block;
  line-height: 1;
}

.player[data-state='idle'] .btn-play {
  animation: nudge 1.8s ease-in-out infinite;
}

@keyframes nudge {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(249, 212, 35, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(249, 212, 35, 0);
  }
}

.btn-replay {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--card-line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.btn-replay:hover {
  background: rgba(255, 255, 255, 0.18);
}

.play-hint {
  margin: 12px 0 10px;
  color: var(--muted);
  min-height: 1.6em;
}

.play-hint.is-error {
  color: var(--bad);
}

.clip-bar {
  margin: 0 auto;
  max-width: 420px;
}

.time {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.prompt {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
}

.btn-choice {
  min-height: 84px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid var(--card-line);
  color: var(--text);
  gap: 2px;
}

.btn-choice strong {
  font-size: 1.5rem;
}

.btn-choice span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.btn-choice:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn-choice.is-picked {
  border-color: var(--gold);
}

.btn-choice.is-truth {
  border-color: var(--good);
  background: rgba(74, 222, 128, 0.16);
  opacity: 1;
}

.btn-choice.is-wrong {
  border-color: var(--bad);
  background: rgba(248, 113, 113, 0.16);
  opacity: 1;
}

.reveal {
  border-width: 2px;
}

.reveal-verdict {
  font-size: 1.3rem;
  font-weight: 700;
}

.reveal-verdict.is-correct {
  color: var(--good);
}

.reveal-verdict.is-wrong {
  color: var(--bad);
}

.reveal-truth {
  font-weight: 600;
  margin: 4px 0 8px;
}

.reveal-detail {
  margin-bottom: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.reveal-detail strong {
  color: var(--text);
}

.reveal-lines {
  margin-bottom: 14px;
}

.reveal-points {
  color: var(--gold);
  font-weight: 700;
}

.reveal-bonus {
  color: var(--good);
  font-weight: 600;
}

.score-popup {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--good);
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.score-popup.pop {
  animation: pop-up 0.8s ease forwards;
}

@keyframes pop-up {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.6);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -110%) scale(1);
  }
}

/* ----------------------------------------------------------------- result */

.result-head {
  text-align: center;
  margin-bottom: 16px;
}

.result-title {
  font-size: 2.6rem;
  margin: 6px 0 6px;
}

.big-score {
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stats-grid .stat {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.stats-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-grid dd {
  font-size: 1.2rem;
  font-weight: 700;
}

.stage-list {
  list-style: none;
}

.stage-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.stage-row.is-cleared,
.stage-row.is-done {
  background: rgba(74, 222, 128, 0.1);
}

.stage-row.is-failed {
  background: rgba(248, 113, 113, 0.1);
}

.stage-row.is-locked {
  background: rgba(255, 255, 255, 0.03);
  color: var(--faint);
}

.stage-row-name {
  font-weight: 600;
}

.stage-row-detail,
.stage-row-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.form .btn {
  align-self: flex-start;
}

label {
  font-size: 0.92rem;
  color: var(--muted);
}

input[type='text'],
input[type='email'],
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-line);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font: inherit;
}

select option {
  background: var(--bg-1);
  color: var(--text);
}

.checks {
  border: 1px solid var(--card-line);
  border-radius: 10px;
  padding: 10px 12px;
}

.checks legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 12px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  line-height: 1.45;
  padding: 4px 0;
}

.check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.msg {
  min-height: 1.4em;
  font-size: 0.92rem;
  color: var(--muted);
}

.msg.is-error {
  color: var(--bad);
}

.msg.is-ok {
  color: var(--good);
}

.share-image {
  margin-top: 12px;
  text-align: center;
}

.share-image img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--card-line);
  margin-bottom: 10px;
}

.link-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
}

.link-card:hover {
  background: rgba(255, 255, 255, 0.12);
}

.link-card strong {
  color: var(--gold);
}

.link-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ------------------------------------------------- method / privacy pages */

.doc h1 {
  text-align: left;
  font-size: 2rem;
  margin: 8px 0 6px;
  background: none;
  -webkit-text-fill-color: var(--text);
  color: var(--text);
}

.doc h2 {
  font-size: 1.25rem;
  margin: 26px 0 8px;
  color: var(--gold);
}

.doc p,
.doc li {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.doc ul {
  padding-left: 22px;
}

.doc .lede {
  color: var(--muted);
  font-size: 1.05rem;
}

.doc .updated {
  color: var(--faint);
  font-size: 0.88rem;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  font-size: 0.92rem;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-line);
}

.doc th {
  color: var(--muted);
  font-weight: 600;
}

html[lang='ko'] body {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.doc .table-wrap table {
  min-width: 520px;
}

html[lang='ko'] .doc-en,
html:not([lang='ko']) .doc-ko {
  display: none;
}

.doc code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
}

/* ----------------------------------------------------------------- narrow */

@media (max-width: 560px) {
  .doc .table-stack,
  .doc .table-stack tbody,
  .doc .table-stack tr,
  .doc .table-stack td {
    display: block;
    width: 100%;
  }

  .doc .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .doc .table-stack tr {
    border-bottom: 1px solid var(--card-line);
    padding: 6px 0;
  }

  .doc .table-stack td {
    border: none;
    padding: 2px 0;
  }
}

@media (max-width: 480px) {
  .screen-title {
    font-size: 1.9rem;
  }

  .stage-name,
  .result-title {
    font-size: 2rem;
  }

  .big-score {
    font-size: 3.4rem;
  }

  .hud-right {
    width: 100%;
    justify-content: space-between;
  }

  .stage-row {
    grid-template-columns: 1fr auto;
  }

  .stage-row-status {
    grid-column: 1 / -1;
  }

  .form .btn {
    align-self: stretch;
  }

  .row .btn {
    flex: 1 1 100%;
  }

  .brand-suffix {
    display: none;
  }
}

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

@media (forced-colors: active) {
  .screen-title,
  .result-title,
  .stage-name {
    -webkit-text-fill-color: currentColor;
    color: CanvasText;
    background: none;
  }
}
