@font-face {
  font-family: "Smiley Sans";
  src: url("../assets/fonts/SmileySans-Display.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-strong: #f1f3f6;
  --ink: #1c2026;
  --muted: #6b7480;
  --line: #e4e8ee;
  --red: #d23c3c;
  --red-dark: #a52e33;
  --teal: #0f766e;
  --gold: #b87905;
  --green: #2f7d4f;
  --bad: #d94363;
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-input: 10px;
  --shadow-sm: 0 1px 2px rgba(28, 36, 48, 0.05), 0 2px 8px rgba(28, 36, 48, 0.05);
  --shadow-md: 0 1px 2px rgba(28, 36, 48, 0.05), 0 10px 28px rgba(28, 36, 48, 0.09);
  --shadow-red: 0 6px 16px rgba(210, 60, 60, 0.28);
  --grad-brand: linear-gradient(135deg, #e05545, #c22f43);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.5, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Smiley Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(210, 60, 60, 0.16);
}

html {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
}

body {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(640px 320px at 85% -5%, rgba(210, 60, 60, 0.05), transparent 70%),
    radial-gradient(560px 300px at -10% 30%, rgba(15, 118, 110, 0.045), transparent 70%),
    var(--bg);
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

#app {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px 14px 6px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(228, 232, 238, 0.82);
  box-shadow: 0 10px 24px rgba(28, 36, 48, 0.04);
  backdrop-filter: blur(8px);
}

.top-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.top-bar h1,
.home-hero h1,
.aggregate-card h1,
.ending-card h2,
.score-grid strong,
.score-grid b,
.delta-grid strong {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
}

.top-bar h1,
.home-hero h1,
.aggregate-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.top-bar h1 {
  flex: 0 0 auto;
  font-size: 16px;
  white-space: nowrap;
}

.top-stage {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.restart-icon-button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  color: var(--red);
  background: #fff7f7;
  border: 1px solid #efc1c1;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  transition:
    transform 150ms var(--ease-out),
    color 150ms var(--ease-out),
    background 150ms var(--ease-out),
    border-color 150ms var(--ease-out);
}

.restart-icon-button:active {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
  transform: scale(0.97);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  margin-top: 5px;
}

.metric-chip {
  position: relative;
  min-height: 24px;
  display: grid;
  grid-template-columns: 13px auto auto min-content;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 3px 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(228, 232, 238, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.metric-chip svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-chip b {
  color: var(--ink);
}

[data-count] {
  display: inline-block;
  text-align: center;
}

.metric-chip small {
  color: var(--muted);
  font-size: 10px;
}

.metric-chip[data-metric="traffic"] svg {
  color: var(--red);
}

.metric-chip[data-metric="revenue"] svg {
  color: var(--gold);
}

.metric-chip[data-metric="credibility"] svg {
  color: var(--teal);
}

.metric-chip[data-metric="mediaLiteracy"] svg {
  color: var(--green);
}

.metric-delta {
  position: absolute;
  top: -10px;
  right: 6px;
  z-index: 2;
  padding: 2px 6px;
  background: #ffffff;
  border: 1px solid currentColor;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  animation: delta-float 900ms var(--ease-out) both;
}

.metric-delta.is-up {
  color: var(--green);
}

.metric-delta.is-down {
  color: var(--bad);
}

.top-progress {
  height: 3px;
  margin: 5px -14px -6px;
  background: rgba(210, 60, 60, 0.09);
  overflow: hidden;
}

.top-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--grad-brand);
  border-radius: 0 999px 999px 0;
  transition: width 500ms var(--ease-out);
}

.home-screen,
.screen {
  display: grid;
  gap: 16px;
  padding: 16px;
  padding-bottom: calc(116px + env(safe-area-inset-bottom));
}

.screen > *,
.home-screen > * {
  animation: card-enter 380ms var(--ease-out) both;
}

.screen > :nth-child(2),
.home-screen > :nth-child(2) {
  animation-delay: 60ms;
}

.screen > :nth-child(3),
.home-screen > :nth-child(3) {
  animation-delay: 120ms;
}

.screen > :nth-child(4),
.home-screen > :nth-child(4) {
  animation-delay: 180ms;
}

.screen > :nth-child(5),
.home-screen > :nth-child(5) {
  animation-delay: 240ms;
}

.screen > .bottom-actions {
  animation-name: action-enter;
}

.screen[data-step="judge"] > .case-card,
.screen[data-step="feedback"] > .compact-summary {
  animation: none;
}

.home-hero,
.flow-card,
.utility-card,
.case-card,
.judgement-panel,
.truth-feedback,
.decision-card,
.decision-options,
.feedback-card,
.result-card,
.aggregate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
}

.home-hero {
  position: relative;
  min-height: 52vh;
  display: grid;
  align-content: end;
  gap: 14px;
  padding: 26px;
  color: #ffffff;
  background:
    radial-gradient(360px 220px at 86% 8%, rgba(224, 85, 69, 0.34), transparent 68%),
    linear-gradient(150deg, #23262d, #3a2226);
  border-color: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.home-hero > * {
  position: relative;
  z-index: 1;
}

.home-hero .eyebrow {
  color: #ffb2a5;
  font-family: var(--font-display);
  font-size: 15px;
}

.home-hero h1 {
  max-width: 9em;
  font-size: 42px;
}

.home-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.7;
}

.hero-badges {
  position: absolute;
  inset: 18px 18px auto auto;
  z-index: 0;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.hero-badges span {
  width: 44px;
  min-height: 28px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  animation: heat-float 4.8s var(--ease-out) infinite alternate;
}

.hero-badges span:nth-child(2) {
  transform: translateX(-22px);
  animation-delay: 800ms;
}

.hero-badges span:nth-child(3) {
  transform: translateX(-8px);
  animation-delay: 1400ms;
}

.home-actions,
.utility-actions {
  display: grid;
  gap: 10px;
}

.flow-card,
.utility-card,
.judgement-panel,
.truth-feedback,
.decision-card,
.decision-options,
.feedback-card,
.result-card,
.aggregate-card {
  padding: 16px;
}

.flow-card h2,
.result-card h3,
.feedback-card h3,
.aggregate-card h1 {
  margin: 0 0 12px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flow-steps span {
  position: relative;
  min-height: 72px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 10px 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-align: center;
}

.flow-steps span:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 22px;
  right: -8px;
  z-index: 1;
  width: 8px;
  height: 2px;
  background: var(--red);
  opacity: 0.36;
}

.flow-steps b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--grad-brand);
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(210, 60, 60, 0.24);
  font-size: 14px;
  line-height: 1;
}

.flow-steps em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.case-card {
  position: relative;
  overflow: hidden;
}

.news-card.is-answered {
  border-color: #cfd8df;
  box-shadow: var(--shadow-sm);
}

.verdict-stamp {
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 3;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: rgba(15, 118, 110, 0.85);
  border: 3px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(15, 118, 110, 0.1);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  pointer-events: none;
  transform: rotate(-12deg);
  animation: stamp-in 560ms var(--ease-spring) 120ms backwards;
}

.verdict-stamp.is-false {
  color: rgba(217, 67, 99, 0.85);
  box-shadow: inset 0 0 0 4px rgba(217, 67, 99, 0.1);
}

.news-card.is-answered .case-meta {
  background: linear-gradient(120deg, #303742, #3c4551);
}

.news-card.is-answered .clue-card {
  background: #f9fcfb;
  border-left-color: #6daaa0;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}

.post-avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--grad-brand);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.48),
    0 8px 16px rgba(210, 60, 60, 0.18);
  font-weight: 900;
}

.post-header div:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.post-header strong {
  font-size: 15px;
}

.post-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(120deg, #262b33, #343b46);
}

.case-meta span {
  padding: 4px 8px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.case-meta .meta-hot {
  color: #ffffff;
  background: var(--grad-brand);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(210, 60, 60, 0.24);
}

.case-card h2 {
  margin: 0;
  padding: 18px 16px 8px;
  font-size: 24px;
  line-height: 1.25;
}

.case-body,
.analysis-text {
  padding: 0 16px;
}

.case-body p,
.analysis-text p,
.result-card p,
.feedback-card p,
.decision-card p {
  margin: 10px 0;
  line-height: 1.72;
}

.image-grid {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: #11161d;
  overflow: hidden;
}

.image-button img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 68vh;
  object-fit: contain;
  background: #11161d;
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
}

.image-button img.is-loaded {
  opacity: 1;
}

.source-card,
.analysis-card {
  margin: 12px 16px 16px;
  padding: 12px 0 0 12px;
  border-top: 1px solid var(--line);
  border-left: 4px solid var(--teal);
}

.clue-card {
  background: #f7fbfa;
  border-top-color: #c9e4df;
}

.analysis-card {
  border-left-color: var(--gold);
}

.source-card h3,
.analysis-card h3,
.analysis-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.info-list,
.tip-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-list li,
.tip-list li {
  position: relative;
  padding-left: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.info-list li::before,
.tip-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.tip-list li::before {
  background: var(--gold);
}

.judgement-panel {
  display: grid;
  gap: 12px;
}

.judgement-panel h3,
.truth-feedback h3,
.decision-options h3,
.game-metrics-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.judgement-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.judgement-button,
.decision-button {
  width: 100%;
  min-height: 76px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfd;
  border: 2px solid var(--line);
  border-radius: var(--radius-btn);
  text-align: center;
  transition:
    transform 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    background 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.judgement-button strong,
.decision-button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  line-height: 1.2;
}

.judgement-button .mark {
  display: inline-grid;
  place-items: center;
  min-width: 1.1em;
}

.judgement-button span,
.decision-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.judgement-button:active,
.decision-button:active {
  transform: scale(0.98);
}

.judgement-button.is-correct {
  color: #ffffff;
  background: #0f9b8e;
  border-color: #0b7f75;
}

.judgement-button.is-wrong {
  color: #ffffff;
  background: var(--bad);
  border-color: #bd2f4f;
}

.judgement-button.is-selected.is-correct {
  animation: pop 360ms var(--ease-spring);
}

.judgement-button.is-selected.is-wrong {
  animation: shake 420ms ease;
}

.judgement-button.is-correct span,
.judgement-button.is-wrong span {
  color: rgba(255, 255, 255, 0.86);
}

.judgement-panel.is-answered .judgement-button:not(.is-selected):not(.is-correct) {
  opacity: 0.58;
}

.judgement-button:disabled {
  opacity: 1;
}

.truth-feedback {
  display: grid;
  gap: 14px;
  border-top: 5px solid var(--teal);
  scroll-margin-top: 96px;
}

.truth-feedback.is-wrong {
  border-top-color: var(--bad);
}

.feedback-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.feedback-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-badge {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  padding: 6px 10px;
  color: #ffffff;
  background: var(--teal);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  animation: badge-pop 320ms var(--ease-spring) 120ms backwards;
}

.truth-feedback.is-wrong .result-badge {
  background: var(--bad);
}

.truth-feedback .analysis-text {
  padding: 0;
}

.key-clues,
.literacy-card {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.key-clues h4,
.literacy-card h4 {
  margin: 0;
  font-size: 15px;
}

.decision-options {
  display: grid;
  gap: 12px;
}

.decision-grid {
  display: grid;
  gap: 10px;
}

.decision-button {
  min-height: 68px;
  align-content: start;
  text-align: left;
}

.decision-button strong {
  justify-content: flex-start;
}

.compact-summary {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.summary-row span {
  color: var(--muted);
}

.summary-row strong {
  text-align: right;
}

.bottom-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: grid;
  gap: 8px;
  margin: 0 -16px calc(-104px - env(safe-area-inset-bottom));
  padding:
    8px
    calc(16px + env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  background: rgba(246, 246, 243, 0.98);
  box-shadow: 0 -10px 24px rgba(28, 36, 48, 0.07);
}

.bottom-actions.stacked {
  position: static;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  width: 100%;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-weight: 900;
  transition:
    transform 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out),
    background 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    color 150ms var(--ease-out);
}

.primary-button {
  color: #ffffff;
  background: var(--grad-brand);
  box-shadow: var(--shadow-red);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: scale(0.97);
}

.secondary-button {
  color: var(--teal);
  background: #edf8f6;
  border-color: #b7d9d4;
  box-shadow: var(--shadow-sm);
}

.ghost-button {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--line);
}

.delta-grid,
.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.delta-item,
.score-grid div {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  background: #f3f6f4;
  border: 1px solid #d8e4dc;
  border-radius: var(--radius-btn);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.delta-item strong {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.delta-item small {
  color: var(--muted);
  font-size: 12px;
}

.delta-item.is-up {
  color: var(--green);
  background: #f0f8f2;
  border-color: #cde3d1;
}

.delta-item.is-down {
  color: var(--bad);
  background: #fff2f5;
  border-color: #f2c8d2;
}

.delta-item.is-flat {
  color: var(--muted);
  background: var(--surface-strong);
  border-color: var(--line);
}

.score-grid strong {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  color: inherit;
  font-size: 32px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-grid b {
  font-size: inherit;
}

.score-grid small {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 900;
}

.score-grid span {
  color: var(--muted);
  font-size: 12px;
}

.aggregate-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.result-screen {
  padding-bottom: 28px;
}

.result-card {
  border-top: 5px solid var(--teal);
}

.ending-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 22px;
  color: #ffffff;
  background: linear-gradient(150deg, #0b4f4a, #15847a);
  border: 0;
  overflow: hidden;
}

.ending-card::before,
.ending-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ending-card::before {
  background:
    radial-gradient(320px 220px at 88% 4%, rgba(255, 255, 255, 0.2), transparent 72%),
    radial-gradient(300px 260px at 0% 100%, rgba(255, 255, 255, 0.12), transparent 70%);
}

.ending-card::after {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.045) 0,
    rgba(255, 255, 255, 0.045) 1px,
    transparent 1px,
    transparent 11px
  );
  mix-blend-mode: screen;
}

.ending-card > * {
  position: relative;
  z-index: 1;
}

.confetti {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.confetti span {
  position: absolute;
  top: -16px;
  width: 6px;
  height: 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  opacity: 0.92;
  animation: confetti-fall 3.2s linear 1 forwards;
}

.confetti span:nth-child(1) {
  left: 7%;
  background: rgba(255, 255, 255, 0.86);
  animation-delay: 0ms;
}

.confetti span:nth-child(2) {
  left: 14%;
  background: rgba(255, 226, 142, 0.86);
  animation-delay: 80ms;
}

.confetti span:nth-child(3) {
  left: 21%;
  background: rgba(19, 173, 158, 0.82);
  animation-delay: 160ms;
}

.confetti span:nth-child(4) {
  left: 28%;
  background: rgba(255, 116, 132, 0.8);
  animation-delay: 260ms;
}

.confetti span:nth-child(5) {
  left: 35%;
  background: rgba(255, 255, 255, 0.86);
  animation-delay: 340ms;
}

.confetti span:nth-child(6) {
  left: 42%;
  background: rgba(255, 226, 142, 0.86);
  animation-delay: 430ms;
}

.confetti span:nth-child(7) {
  left: 49%;
  background: rgba(19, 173, 158, 0.82);
  animation-delay: 520ms;
}

.confetti span:nth-child(8) {
  left: 56%;
  background: rgba(255, 116, 132, 0.8);
  animation-delay: 610ms;
}

.confetti span:nth-child(9) {
  left: 63%;
  background: rgba(255, 255, 255, 0.86);
  animation-delay: 690ms;
}

.confetti span:nth-child(10) {
  left: 70%;
  background: rgba(255, 226, 142, 0.86);
  animation-delay: 760ms;
}

.confetti span:nth-child(11) {
  left: 77%;
  background: rgba(19, 173, 158, 0.82);
  animation-delay: 820ms;
}

.confetti span:nth-child(12) {
  left: 84%;
  background: rgba(255, 116, 132, 0.8);
  animation-delay: 880ms;
}

.confetti span:nth-child(13) {
  left: 90%;
  background: rgba(255, 255, 255, 0.86);
  animation-delay: 940ms;
}

.confetti span:nth-child(14) {
  left: 93%;
  background: rgba(255, 226, 142, 0.86);
  animation-delay: 980ms;
}

.ending-card .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.ending-card h2 {
  margin: 0;
  max-width: 10em;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1.08;
  text-wrap: balance;
}

.ending-card p {
  color: rgba(255, 255, 255, 0.84);
}

.ending-theme-responsible_media {
  background: linear-gradient(150deg, #8a6210, #c9952c);
}

.ending-theme-fact_guardian {
  background: linear-gradient(150deg, #0b4f4a, #15847a);
}

.ending-theme-traffic_king {
  background: linear-gradient(150deg, #a8262f, #d4622e);
}

.ending-theme-banned {
  background: linear-gradient(150deg, #1d2025, #3a3f47);
}

.ending-stamp {
  position: absolute;
  top: 22px;
  right: 20px;
  z-index: 2;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  border: 3px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.18);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 900;
  transform: rotate(-12deg);
  animation: stamp-in 560ms var(--ease-spring) 400ms backwards;
}

.ending-theme-banned .ending-stamp {
  color: #ff647d;
  mix-blend-mode: screen;
}

.ending-badge {
  position: relative;
  justify-self: start;
  padding: 7px 12px;
  color: #563605;
  background: linear-gradient(135deg, #ffe49a, #d89d27);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(63, 41, 8, 0.18);
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
}

.ending-badge::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -70%;
  width: 48%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.76), transparent);
  transform: skewX(-20deg);
  animation: badge-shine 2.4s ease-in-out infinite;
}

.ending-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ending-traits span {
  padding: 7px 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 800;
}

.ending-card .score-grid div {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
}

.ending-card .score-grid span {
  color: rgba(255, 255, 255, 0.72);
}

.result-card.compact {
  border-top-width: 1px;
  box-shadow: var(--shadow-sm);
}

.result-code-details {
  display: grid;
  gap: 12px;
}

.result-code-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.result-code-details summary::-webkit-details-marker {
  display: none;
}

.result-code-details summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--muted);
  transition: transform 160ms var(--ease-out);
}

.result-code-details[open] summary::before {
  transform: rotate(90deg);
}

.result-code-details h3 {
  flex: 1 1 auto;
  margin: 0;
}

.result-code-details summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-bars {
  display: grid;
  gap: 14px;
}

.metric-bar {
  display: grid;
  gap: 7px;
}

.metric-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.metric-bar-head strong {
  font-variant-numeric: tabular-nums;
}

.metric-bar .track {
  height: 10px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.metric-bar .track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width 760ms var(--ease-out);
}

.metric-bar[data-metric="traffic"] .track i {
  background: linear-gradient(90deg, #e05545, #d4622e);
}

.metric-bar[data-metric="revenue"] .track i {
  background: linear-gradient(90deg, #d79a1d, #b87905);
}

.metric-bar[data-metric="credibility"] .track i {
  background: linear-gradient(90deg, #16a394, #0f766e);
}

.metric-bar:nth-child(2) .track i {
  transition-delay: 120ms;
}

.metric-bar:nth-child(3) .track i {
  transition-delay: 240ms;
}

.result-code,
.aggregate-input {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 10px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.aggregate-input {
  min-height: 240px;
}

.error-text {
  color: var(--red);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 40;
  width: min(92vw, 420px);
  padding: 12px 14px;
  color: #ffffff;
  background: #20242a;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-md);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 120px) scale(0.96);
  transition:
    opacity 220ms var(--ease-spring),
    transform 220ms var(--ease-spring);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(12, 16, 20, 0.92);
}

.lightbox.is-open {
  display: grid;
  animation: lightbox-fade 180ms var(--ease-out) both;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  background: #11161d;
}

.lightbox.is-open img {
  animation: lightbox-zoom 220ms var(--ease-out) both;
}

.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 250ms;
  animation-timing-function: var(--ease-out);
}

@media (hover: hover) {
  .primary-button:hover {
    box-shadow: 0 8px 22px rgba(210, 60, 60, 0.34);
    transform: translateY(-1px);
  }

  .secondary-button:hover,
  .ghost-button:hover,
  .judgement-button:hover,
  .decision-button:hover {
    border-color: var(--teal);
    background: #f6fbfa;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
  }

  .restart-icon-button:hover {
    transform: translateY(-1px);
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes action-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes heat-float {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 10px;
  }
}

@keyframes delta-float {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }

  18% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(-18px) scale(1);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.96);
  }

  55% {
    transform: scale(1.05);
  }

  100% {
    transform: none;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: none;
  }

  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

@keyframes badge-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }

  70% {
    transform: scale(1.08);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: rotate(-18deg) scale(1.6);
  }

  70% {
    opacity: 1;
    transform: rotate(-12deg) scale(0.94);
  }

  to {
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }
}

@keyframes badge-shine {
  0% {
    left: -70%;
  }

  46%,
  100% {
    left: 126%;
  }
}

@keyframes confetti-fall {
  from {
    opacity: 0;
    transform: translateY(-24px) rotate(0deg);
  }

  12% {
    opacity: 0.92;
  }

  to {
    opacity: 0;
    transform: translateY(640px) rotate(540deg);
  }
}

@keyframes lightbox-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes lightbox-zoom {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti {
    display: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 360px) {
  .top-main {
    gap: 6px;
  }

  .top-bar h1 {
    font-size: 15px;
  }

  .restart-icon-button {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .top-stage {
    font-size: 11px;
  }

  .metric-chip {
    grid-template-columns: 12px auto min-content;
    min-height: 24px;
    padding: 3px 4px;
    font-size: 10px;
  }

  .metric-chip svg {
    width: 12px;
    height: 12px;
  }

  .metric-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .home-hero {
    padding: 22px;
  }

  .home-hero h1 {
    font-size: 38px;
  }

  .ending-stamp {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }
}

@media (min-width: 680px) {
  .metric-chip {
    min-height: 30px;
    padding: 6px 7px;
    font-size: 12px;
  }

  .home-screen,
  .screen {
    padding: 24px;
    padding-bottom: calc(124px + env(safe-area-inset-bottom));
  }

  .home-hero {
    padding: 32px;
  }

  .home-hero h1 {
    font-size: 48px;
  }

  .flow-card,
  .utility-card,
  .judgement-panel,
  .truth-feedback,
  .decision-card,
  .decision-options,
  .feedback-card,
  .result-card,
  .aggregate-card {
    padding: 18px;
  }

  .bottom-actions {
    margin-left: -24px;
    margin-right: -24px;
    margin-bottom: calc(-112px - env(safe-area-inset-bottom));
    padding:
      8px
      calc(24px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(24px + env(safe-area-inset-left));
  }

  .home-actions,
  .utility-actions,
  .bottom-actions.stacked {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decision-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
