:root {
  color-scheme: dark;
  --canvas: #111321;
  --card: #1c2033;
  --text: #f8f6f2;
  --muted: #c3c4d3;
  --edge: #50556e;
  --gold: #ffda82;
  --ink: #251d12;
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 14% 0%, #38304a 0, transparent 52%),
    radial-gradient(ellipse at 100% 70%, #222840 0, transparent 54%),
    var(--canvas);
}

.game-shell {
  width: min(100%, 36rem);
  margin: 0 auto;
  padding: clamp(1rem, 4vh, 3rem) clamp(.875rem, 4vw, 1.5rem) max(2rem, env(safe-area-inset-bottom));
}

.brand {
  display: inline-block;
  padding: .6rem 0;
  margin-bottom: clamp(.55rem, 2vh, 1.2rem);
  color: var(--text);
  font-size: .94rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-decoration: none;
}

.game-card {
  overflow-wrap: anywhere;
  padding: clamp(1.05rem, 4vw, 2rem);
  border: 1px solid #4d4960;
  border-radius: 1.3rem;
  background: linear-gradient(154deg, #302c40 0%, var(--card) 47%, #1a1e30 100%);
  box-shadow: 0 1.1rem 3.3rem #0708133d;
}

.game-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(3.4rem, 15vw, 5.4rem);
  align-items: start;
  column-gap: .75rem;
}

.miru-avatar {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 32%;
  border: 1px solid #a38b6e;
  border-radius: 50%;
  background: #40394a;
}

.eyebrow {
  grid-column: 1;
  grid-row: 1;
  margin: .15rem 0 .4rem;
  color: var(--gold);
  font-size: .79rem;
  font-weight: 700;
  letter-spacing: .045em;
}

.game-card h1 {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  font-size: clamp(1.52rem, 5.8vw, 2.25rem);
  font-weight: 760;
  line-height: 1.28;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.lead {
  grid-column: 1 / -1;
  margin: .9rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.lead:empty, .status:empty { display: none; }

#stage {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.choices, .actions { display: grid; gap: .65rem; }
button, input, textarea { font: inherit; }
.btn, .choice { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.choice, .btn {
  width: 100%;
  min-height: 3.1rem;
  border: 1px solid var(--edge);
  border-radius: .8rem;
  color: var(--text);
  background: #282c40;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}

.choice {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .72rem .9rem;
  text-align: start;
}

.choice-number {
  display: inline-grid;
  flex: 0 0 1.85rem;
  place-items: center;
  min-height: 1.85rem;
  border: 1px solid #746b6c;
  border-radius: 50%;
  color: var(--gold);
  font-size: .84rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: grid;
  place-items: center;
  text-align: center;
  padding: .74rem .95rem;
}

.btn.primary { border-color: var(--gold); color: var(--ink); background: var(--gold); }
.btn.line { border-color: #06c755; color: #042e16; background: #06c755; }
.btn.secondary { border-color: var(--edge); color: var(--text); background: #25293b; }
.btn:disabled, .choice:disabled { opacity: .65; cursor: default; }

:where(a, button, input, textarea):focus-visible {
  outline: 3px solid #a7ddff;
  outline-offset: 3px;
}

@media (hover: hover) {
  .choice:hover:enabled, .btn.secondary:hover { border-color: #9b9cb2; background: #31364d; }
  .btn.primary:hover { background: #ffe4a5; }
  .btn.line:hover { background: #23d26b; }
  .brand:hover { color: var(--gold); }
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}

.result-grid > div, .share-preview {
  margin: 0;
  padding: .85rem;
  border: 1px solid var(--edge);
  border-radius: .75rem;
  background: #191d2e;
}

.result-grid strong, .result-label { display: block; }
.result-label { margin-bottom: .35rem; color: var(--muted); font-size: .79rem; }
.quip {
  margin: 0;
  padding: .2rem 0 .2rem .8rem;
  border-inline-start: 3px solid var(--gold);
  color: #ffe6ae;
  font-weight: 650;
  line-height: 1.6;
}

.share-preview, .copy-field { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.copy-field {
  width: 100%;
  padding: .7rem;
  border: 1px solid var(--edge);
  border-radius: .55rem;
  background: #101422;
  color: var(--text);
}

.poster {
  display: grid;
  justify-items: center;
  margin: 0;
}

.poster img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  width: auto;
  height: auto;
  border-radius: .35rem;
  box-shadow: 0 .5rem 1.3rem #06091266;
}

.status {
  margin: .9rem 0 0;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 22rem) {
  .game-card header { column-gap: .55rem; }
  .result-grid { grid-template-columns: 1fr; }
}

.game-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
#friendLanguage { min-height: 44px; max-width: 100%; margin-bottom: .5rem; padding: .4rem .65rem; color: var(--text); background: var(--card); border: 1px solid var(--edge); border-radius: .6rem; font: inherit; }
