/* Society Play — Tradeoffs */

.game-shell {
  --game-bg: #0c0f14;
  --game-surface: #151a22;
  --game-elevated: #1e2633;
  --game-border: #2a3444;
  --game-text: #f0f4f8;
  --game-muted: #94a3b8;
  --game-accent: #d4a853;
  --game-warn: #f87171;
  --game-prosperity: #d4a853;
  --game-trust: #2dd4bf;
  --game-fairness: #a78bfa;
  --game-stability: #60a5fa;
  background: var(--game-bg);
  color: var(--game-text);
  font-family: 'Inter', system-ui, sans-serif;
  margin: -1rem 0 0;
  /* iOS Safari: 100vh includes the collapsing URL bar, causing a dark-shell
     gap at the bottom on scroll. Use dynamic viewport units where supported
     and fall back to 100vh for older browsers. */
  min-height: 100vh;
  min-height: 100dvh;
}

body.is-leaving {
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.font-display {
  font-family: 'Fraunces', Georgia, serif;
  letter-spacing: -0.01em;
}

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

/* ---------- Stat bars ---------- */

.game-stat-track {
  height: 6px;
  background: var(--game-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.game-stat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 450ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game-stat-fill.is-pulsing {
  filter: brightness(1.25) saturate(1.15);
  transition: width 450ms cubic-bezier(0.22, 1, 0.36, 1), filter 600ms ease;
}

.game-stat-fill--prosperity { background: var(--game-prosperity); }
.game-stat-fill--trust { background: var(--game-trust); }
.game-stat-fill--fairness { background: var(--game-fairness); }
.game-stat-fill--stability { background: var(--game-stability); }

/* ---------- Choice cards ---------- */

.game-choice {
  display: block;
  width: 100%;
  padding: 1rem 1.125rem;
  background: var(--game-surface);
  border: 1px solid var(--game-border);
  border-left: 3px solid transparent;
  border-radius: 0.875rem;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-align: left;
}

.game-choice:hover:not(:disabled) {
  border-color: var(--game-border);
  border-left-color: var(--game-accent);
  background: var(--game-elevated);
  box-shadow: 0 6px 24px -12px rgba(212, 168, 83, 0.25);
}

.game-choice:focus-visible {
  outline: none;
  border-left-color: var(--game-accent);
  box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.55);
}

.game-choice:active:not(:disabled) {
  transform: scale(0.985);
}

.game-choice:disabled {
  opacity: 0.45;
  cursor: wait;
}

.game-choice-label {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--game-text);
  line-height: 1.4;
}

.game-choice-flavour {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--game-muted);
  font-style: italic;
}

/* ---------- Buttons ---------- */

.game-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  background: var(--game-accent);
  color: #0c0f14;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
  min-height: 44px;
}

.game-btn-primary:hover { filter: brightness(1.05); }
.game-btn-primary:active { transform: scale(0.98); }
.game-btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.45);
}

.game-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  background: transparent;
  color: var(--game-text);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: 0.75rem;
  border: 1px solid var(--game-border);
  text-decoration: none;
  transition: border-color 0.15s ease;
  min-height: 44px;
}

.game-btn-secondary:hover { border-color: var(--game-muted); }
.game-btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.6);
}

/* ---------- Consequence dialog ---------- */

.game-consequence {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 15, 20, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: background 220ms ease;
}

.game-consequence.is-visible {
  background: rgba(12, 15, 20, 0.92);
}

.game-consequence.hidden { display: none; }

.game-consequence-inner {
  max-width: 24rem;
  width: 100%;
  padding: 1.75rem;
  background: var(--game-surface);
  border: 1px solid var(--game-border);
  border-radius: 1rem;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.6);
}

.game-consequence.is-visible .game-consequence-inner {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- Turn swap ---------- */

.game-turn-panel {
  transition: opacity 200ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game-turn-panel.is-swapping {
  opacity: 0;
  transform: translateY(8px);
}

/* ---------- Emblem ---------- */

.game-emblem { flex-shrink: 0; }
.game-emblem--sm { width: 2.5rem; height: 2.5rem; }
.game-emblem--md { width: 3rem; height: 3rem; }
.game-emblem--lg { width: 4rem; height: 4rem; }

/* ---------- Trait chips ---------- */

.game-chip {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--game-elevated);
  border: 1px solid var(--game-border);
  color: var(--game-muted);
}

/* ---------- 2-axis identity plot ---------- */

.game-axis-plot {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 280px;
  margin: 0 auto;
  background: var(--game-surface);
  border: 1px solid var(--game-border);
  border-radius: 1rem;
  overflow: hidden;
}

.game-axis-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 25% 25%;
}

.game-axis-cross {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-axis-cross::before,
.game-axis-cross::after {
  content: '';
  position: absolute;
  background: rgba(148, 163, 184, 0.22);
}

.game-axis-cross::before {
  top: 50%; left: 0; right: 0; height: 1px;
}

.game-axis-cross::after {
  left: 50%; top: 0; bottom: 0; width: 1px;
}

.game-axis-label {
  position: absolute;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--game-muted);
}

.game-axis-label--top { top: 8px; left: 50%; transform: translateX(-50%); }
.game-axis-label--bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
.game-axis-label--left { left: 8px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: left center; }
.game-axis-label--right { right: 8px; top: 50%; transform: translateY(-50%) rotate(90deg); transform-origin: right center; }

.game-axis-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  background: var(--emblem-accent, var(--game-accent));
  border: 2px solid var(--game-bg);
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--emblem-soft, rgba(212, 168, 83, 0.3)), 0 0 24px rgba(212, 168, 83, 0.4);
  transition: left 450ms cubic-bezier(0.22, 1, 0.36, 1), top 450ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Share card (rendered + image) ---------- */

.game-share-card {
  background: linear-gradient(135deg, var(--game-surface) 0%, var(--game-elevated) 100%);
  position: relative;
}

.game-share-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 0%, var(--emblem-soft, rgba(212, 168, 83, 0.18)) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

/* ---------- Ticker ---------- */

.game-ticker .ticker-line {
  animation: ticker-fade-in 280ms ease-out both;
}

@keyframes ticker-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.85; transform: translateY(0); }
}

/* ---------- Toast ---------- */

.game-toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(8px);
  padding: 0.75rem 1.125rem;
  background: var(--game-elevated);
  border: 1px solid var(--game-border);
  border-radius: 0.75rem;
  color: var(--game-text);
  font-size: 0.875rem;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 220ms ease, transform 240ms ease;
  z-index: 60;
}

.game-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-toast.hidden { display: none; }

/* ---------- Hub ---------- */

.game-hub-card {
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.55);
}

.game-hub-tomorrow {
  border-style: dashed;
}

/* Streak chip on the hub header */
.game-streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(212, 168, 83, 0.12);
  border: 1px solid rgba(212, 168, 83, 0.35);
  color: var(--game-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Streak banner on outcome screen */
.game-streak-banner {
  box-shadow: 0 0 0 1px rgba(212, 168, 83, 0.15);
}

/* Pasteable share preview (MapTap-style identity card for chat) */
.game-share-preview {
  margin: 0;
  padding: 1rem 1.125rem;
  background: var(--game-elevated);
  border: 1px solid var(--game-border);
  border-radius: 0.875rem;
  color: var(--game-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: all;
  -webkit-user-select: all;
  max-height: 16rem;
  overflow-y: auto;
}

.game-share-status {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--game-accent);
}

.game-share-status:empty {
  display: none;
}

.game-challenge-reveal {
  box-shadow: inset 0 0 0 1px rgba(212, 168, 83, 0.12);
}

/* Society-name input on hub */
.game-input {
  display: block;
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: #1e2633;
  background-color: #1e2633;
  border: 1px solid var(--game-border);
  border-radius: 0.625rem;
  color: #f0f4f8;
  -webkit-text-fill-color: #f0f4f8;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-input::placeholder {
  color: #94a3b8;
  -webkit-text-fill-color: #94a3b8;
  opacity: 1;
}

.game-input:focus {
  outline: none;
  border-color: var(--game-accent);
  box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.25);
}

/* Quick Run cards */
.game-quick-card {
  text-decoration: none;
  color: inherit;
}

.game-quick-card:hover {
  box-shadow: 0 6px 24px -12px rgba(212, 168, 83, 0.2);
  transform: translateY(-1px);
}

.game-quick-card:focus-visible {
  outline: none;
  border-color: var(--game-accent);
  box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.5);
}

/* Outcome sign-in CTA */
.game-outcome-signin {
  box-shadow: 0 4px 16px -8px rgba(0, 0, 0, 0.4);
}

/* ---------- Editorial principles (magazine layout) ---------- */

.game-editorial {
  max-width: 38rem;
  margin: 0 auto;
  padding-bottom: 4rem;
  color: var(--game-text);
  line-height: 1.65;
}

.game-editorial-hero {
  padding: 1.5rem 0 1rem;
}

.game-editorial-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--game-accent);
  margin-bottom: 1rem;
}

.game-editorial-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--game-text);
  margin-bottom: 1.25rem;
}

.game-editorial-deck {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--game-muted);
}

.game-editorial-rule {
  border: 0;
  border-top: 1px solid var(--game-border);
  margin: 2.5rem 0;
}

.game-editorial-section {
  margin-bottom: 2.5rem;
}

.game-editorial-h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--game-text);
  margin-bottom: 1rem;
  scroll-margin-top: 2rem;
}

.game-editorial-section p {
  font-size: 1rem;
  color: var(--game-text);
  margin-bottom: 1rem;
}

.game-editorial-section p + p {
  margin-top: 0;
}

.game-editorial-anti-list,
.game-editorial-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-editorial-anti-list li,
.game-editorial-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--game-text);
}

.game-editorial-anti-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--game-warn);
  font-weight: 600;
}

.game-editorial-list li::before {
  content: '·';
  position: absolute;
  left: 0.4rem;
  color: var(--game-accent);
  font-size: 1.5rem;
  line-height: 1;
}

.game-editorial-principles {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: principle;
}

.game-editorial-principles > li {
  counter-increment: principle;
  position: relative;
  padding: 1.5rem 0 1.25rem 3.5rem;
  border-bottom: 1px solid rgba(42, 52, 68, 0.6);
}

.game-editorial-principles > li:last-child {
  border-bottom: 0;
}

.game-editorial-principles > li::before {
  content: counter(principle, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.5rem;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--game-accent);
  letter-spacing: -0.02em;
}

.game-editorial-principles h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.35;
  color: var(--game-text);
  margin-bottom: 0.5rem;
}

.game-editorial-principles p {
  font-size: 0.9375rem;
  color: var(--game-muted);
  line-height: 1.6;
  margin: 0;
}

.game-editorial-aside {
  margin-top: 1.5rem;
  padding: 1rem 1.125rem;
  background: rgba(212, 168, 83, 0.06);
  border-left: 2px solid var(--game-accent);
  border-radius: 0 0.375rem 0.375rem 0;
  font-size: 0.9375rem;
  color: var(--game-text);
  font-style: italic;
}

.game-editorial-link {
  color: var(--game-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.game-editorial-link:hover {
  filter: brightness(1.15);
}

.game-editorial-footer {
  text-align: center;
  padding: 2rem 0 1rem;
}

.game-editorial-tagline {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.125rem;
  color: var(--game-muted);
  margin-bottom: 1.5rem;
}

.game-editorial-cta .game-btn-primary {
  display: inline-flex;
  padding: 0.875rem 2rem;
}

@media (max-width: 480px) {
  .game-editorial-principles > li {
    padding-left: 2.75rem;
  }
  .game-editorial-principles > li::before {
    font-size: 1.25rem;
  }
}

/* First-time-visitor explainer on hub */
.game-hub-explainer {
  box-shadow: 0 8px 32px -16px rgba(212, 168, 83, 0.25);
}

.game-explainer-step {
  padding: 0.875rem 0.5rem;
  background: rgba(21, 26, 34, 0.5);
  border: 1px solid var(--game-border);
  border-radius: 0.625rem;
}

.game-explainer-step .font-display {
  line-height: 1;
  margin-bottom: 0.25rem;
}

.game-chip--muted {
  color: var(--game-muted);
  border-color: var(--game-border);
  background: transparent;
}

.bg-game-surface\/80 { background: rgba(21, 26, 34, 0.8); }
.bg-game-elevated\/40 { background: rgba(30, 38, 51, 0.4); }
.border-game-border\/60 { border-color: rgba(42, 52, 68, 0.6); }

/* ---------- Tailwind-utility shims (used in templates) ---------- */

.text-game-text { color: var(--game-text); }
.text-game-muted { color: var(--game-muted); }
.text-game-accent { color: var(--game-accent); }
.text-game-trust { color: var(--game-trust); }
.text-game-warn { color: var(--game-warn); }
.border-game-border { border-color: var(--game-border); }
.border-game-accent\/30 { border-color: rgba(212, 168, 83, 0.3); }
.bg-game-surface\/50 { background: rgba(21, 26, 34, 0.5); }
.bg-game-accent\/5 { background: rgba(212, 168, 83, 0.06); }

/* ---------- Motion reduction ---------- */

@media (prefers-reduced-motion: reduce) {
  .game-stat-fill,
  .game-axis-dot,
  .game-choice,
  .game-turn-panel,
  .game-consequence,
  .game-consequence-inner,
  .game-toast,
  body.is-leaving {
    transition: none;
    animation: none;
  }
}
