/* ============================================================
   你推来了 · 櫻坂46 Penlight Reaction — visual system v6
   夜场 Live House：深黑场馆 + 樱粉/白双色灯海 + 玻璃面板
   ============================================================ */
:root {
  color-scheme: dark;
  --page: #07060b;
  --surface: rgba(20, 17, 28, 0.72);
  --surface-solid: #14111c;
  --surface-raised: rgba(32, 27, 44, 0.78);
  --surface-hover: rgba(44, 37, 60, 0.85);
  --ink: #f6f2f8;
  --ink-soft: #a79fb8;
  --ink-faint: #6f6684;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #f19ec2;
  --accent-strong: #ffb7d6;
  --accent-dark: #e078a8;
  --accent-soft: rgba(241, 158, 194, 0.14);
  --accent-glow: rgba(241, 158, 194, 0.45);
  --violet: #9d8cff;
  --violet-soft: rgba(157, 140, 255, 0.14);
  --success: #7fe0b0;
  --success-soft: rgba(127, 224, 176, 0.14);
  --warning: #ffd48a;
  --warning-soft: rgba(255, 212, 138, 0.12);
  --danger: #ff9d9d;
  --stage: #080710;
  --stage-elevated: rgba(24, 20, 34, 0.72);
  --stage-line: rgba(255, 255, 255, 0.1);
  --stage-text: #f8f5fb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-panel: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(241, 158, 194, 0.35);
  font-family:
    "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", "Microsoft YaHei",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(157, 140, 255, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 70% 45% at 50% 112%, rgba(241, 158, 194, 0.12) 0%, transparent 65%),
    var(--page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  background: transparent;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}

::selection {
  color: #1a0f18;
  background: var(--accent);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  color: #1a0f18;
  background: var(--accent);
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Shell & header ---------- */
.app-shell {
  width: min(1400px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 32px;
}

.site-header {
  min-height: 108px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow) 30%, rgba(157, 140, 255, 0.45) 70%, transparent);
  opacity: 0.7;
}

.site-header h1 {
  margin: 6px 0 0;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.05;
  background: linear-gradient(100deg, #ffffff 15%, var(--accent-strong) 55%, var(--violet) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 34px rgba(241, 158, 194, 0.25);
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.header-note {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.screen {
  padding: 34px 0 48px;
  animation: screen-in 0.45s cubic-bezier(0.22, 0.9, 0.32, 1) both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.notice {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-raised);
  backdrop-filter: blur(10px);
  font-size: 14px;
}

.notice[data-kind="warning"] {
  border-color: rgba(255, 212, 138, 0.45);
  background: var(--warning-soft);
  color: var(--warning);
}

.notice[data-kind="success"] {
  border-color: rgba(127, 224, 176, 0.45);
  background: var(--success-soft);
  color: var(--success);
}

.notice[data-kind="error"] {
  border-color: rgba(255, 157, 157, 0.45);
  background: rgba(255, 157, 157, 0.1);
  color: var(--danger);
}

/* ---------- Setup ---------- */
.setup-layout,
.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 30px;
  align-items: start;
}

.setup-main,
.result-main {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.section-heading h2,
.result-main > h2 {
  margin: 8px 0 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.section-heading > p {
  max-width: 440px;
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-option {
  min-width: 0;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mode-option:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.mode-option.is-active {
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent-soft), rgba(157, 140, 255, 0.08));
  box-shadow: var(--shadow-glow), inset 0 0 0 1px rgba(241, 158, 194, 0.35);
}

.mode-option__level {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mode-option strong {
  font-size: 19px;
  letter-spacing: 0.02em;
}

.mode-option small {
  color: var(--ink-soft);
  font-size: 12px;
}

.favorite-panel {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-panel);
}

.favorite-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.favorite-toolbar h3 {
  margin: 0 0 3px;
  font-size: 16px;
  letter-spacing: 0.03em;
}

.favorite-toolbar p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.favorite-toolbar p strong {
  color: var(--accent-strong);
  font-size: 15px;
}

.text-button {
  min-height: 36px;
  padding: 4px 2px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.text-button:hover {
  color: var(--accent-strong);
}

.member-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.member-generation-group {
  min-width: 0;
}

.member-generation__title {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.member-generation__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.member-generation__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.member-choice {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.member-choice:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}

.member-choice:active {
  transform: translateY(0);
}

.member-choice.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 0 22px rgba(241, 158, 194, 0.4);
}

.member-choice.is-selected::after {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #1a0f18;
  background: linear-gradient(140deg, var(--accent-strong), var(--accent-dark));
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(241, 158, 194, 0.55);
}

.member-choice img {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  object-position: center top;
  background: var(--surface-raised);
  transition: transform 0.3s ease;
}

.member-choice:hover img {
  transform: scale(1.04);
}

.member-choice span {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 7px 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
}

.start-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 24px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.start-bar > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.start-bar strong {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.start-bar span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Buttons ---------- */
.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.button--primary {
  color: #241019;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent) 45%, var(--accent-dark) 100%);
  box-shadow: 0 6px 22px rgba(241, 158, 194, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.button--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 30px rgba(241, 158, 194, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.button--primary:active:not(:disabled) {
  transform: translateY(0);
}

.button--quiet {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.button--quiet:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ---------- Leaderboard ---------- */
.leaderboard-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-panel);
}

.leaderboard-heading {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.leaderboard-heading h2 {
  margin: 5px 0 0;
  font-size: 18px;
  letter-spacing: 0.03em;
}

.leaderboard-heading > span {
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.board-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.board-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.board-tabs button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.board-tabs button[aria-selected="true"] {
  color: var(--accent-strong);
  border-color: rgba(241, 158, 194, 0.4);
  background: var(--accent-soft);
  font-weight: 800;
}

.leaderboard-list {
  margin: 0;
  padding: 8px 14px 4px;
  list-style: none;
  counter-reset: rank;
}

.leaderboard-list li {
  min-height: 46px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  counter-increment: rank;
}

.leaderboard-list li:last-child {
  border-bottom: 0;
}

.leaderboard-list li::before {
  content: counter(rank, decimal-leading-zero);
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.leaderboard-list li:nth-child(-n + 3)::before {
  color: var(--accent-strong);
  font-weight: 900;
  text-shadow: 0 0 10px var(--accent-glow);
}

.board-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.board-score small {
  display: block;
  margin-top: 1px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 500;
  text-align: right;
}

.board-state {
  margin: 0;
  padding: 20px 16px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.03em;
}

.site-footer p {
  margin: 0;
}

.orientation-advice {
  display: none;
}

/* ---------- Game screen ---------- */
.game-screen {
  padding-top: 18px;
}

.game-statusbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
}

.game-statusbar .text-button {
  color: var(--ink-soft);
  font-size: 13px;
}

.game-statusbar .text-button:hover {
  color: var(--accent-strong);
}

.game-stats {
  display: flex;
  gap: 8px;
  margin: 0;
}

.game-stats > div {
  min-width: 84px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.game-stats dt {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.game-stats dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.game-stats dd#score-stat {
  color: var(--accent-strong);
  text-shadow: 0 0 14px var(--accent-glow);
}

.game-arena {
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(360px, 1fr) minmax(180px, 240px);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--stage-line);
  border-radius: 20px;
  color: var(--stage-text);
  background:
    radial-gradient(ellipse 65% 50% at 50% -6%, rgba(157, 140, 255, 0.18) 0%, transparent 65%),
    radial-gradient(ellipse 80% 34% at 50% 108%, rgba(241, 158, 194, 0.13) 0%, transparent 70%),
    var(--stage);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 70px rgba(0, 0, 0, 0.6);
}

.game-arena::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    conic-gradient(from 200deg at 22% -10%, transparent 0deg, rgba(255, 255, 255, 0.045) 12deg, transparent 26deg),
    conic-gradient(from 130deg at 78% -10%, transparent 0deg, rgba(241, 158, 194, 0.05) 14deg, transparent 30deg),
    repeating-linear-gradient(90deg, transparent 0 118px, rgba(255, 255, 255, 0.022) 118px 119px);
}

.game-arena::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(241, 158, 194, 0.3),
    rgba(241, 158, 194, 0.05) 55%,
    transparent
  );
}

.control-bank {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: var(--stage-elevated);
  backdrop-filter: blur(8px);
}

.control-bank--left {
  border-right: 1px solid var(--stage-line);
}

.control-bank--right {
  border-left: 1px solid var(--stage-line);
}

.control-bank__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-inline: 4px;
}

.control-bank__title span {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.control-bank__title strong {
  font-size: 13px;
  letter-spacing: 0.06em;
}

.choice-stack {
  flex: 1;
  display: grid;
  grid-template-rows: repeat(3, minmax(48px, 1fr));
  gap: 10px;
}

.penlight-control {
  position: relative;
  min-height: 48px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--stage-text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  touch-action: manipulation;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.penlight-control:hover:not(:disabled) {
  border-color: rgba(241, 158, 194, 0.6);
  background: rgba(241, 158, 194, 0.08);
  box-shadow: 0 0 18px rgba(241, 158, 194, 0.18);
}

.penlight-control:active:not(:disabled) {
  transform: scale(0.97);
  background: rgba(241, 158, 194, 0.14);
}

.penlight-control:disabled {
  cursor: default;
  opacity: 0.4;
}

.choice-key {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 10px;
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.penlight-control:active:not(:disabled) .choice-key {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

.choice-copy {
  min-width: 0;
}

.choice-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-copy small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.stage {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px 22px;
  overflow: hidden;
}

.stage-progress {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.07);
}

.stage-progress span {
  width: 0;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--violet), var(--accent));
  box-shadow: 0 0 14px var(--accent-glow);
  transform-origin: left center;
}

.round-message {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.05em;
}

.round-message.is-success {
  color: var(--success);
  text-shadow: 0 0 14px rgba(127, 224, 176, 0.5);
  animation: pop-in 0.25s ease both;
}

.round-message.is-warning {
  color: var(--warning);
  text-shadow: 0 0 12px rgba(255, 212, 138, 0.35);
  animation: pop-in 0.25s ease both;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.member-stage {
  width: min(100%, 380px);
  text-align: center;
}

.member-photo-frame {
  position: relative;
  width: min(272px, 78%);
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--stage-elevated);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(157, 140, 255, 0.12);
}

.member-photo-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 18%,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 55%
  );
  opacity: 0.65;
}

.member-photo-frame img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.member-curtain {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0 10px, transparent 10px 20px),
    var(--surface-solid);
  transition: opacity 180ms ease, transform 180ms ease;
}

.member-curtain span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
}

.member-stage.is-revealed .member-curtain {
  pointer-events: none;
  opacity: 0;
  transform: scale(1.04);
}

.member-stage.is-revealed .member-photo-frame {
  animation: frame-glow 0.5s ease both;
}

@keyframes frame-glow {
  0% {
    box-shadow: 0 0 0 rgba(241, 158, 194, 0);
  }
  40% {
    box-shadow: 0 0 46px rgba(241, 158, 194, 0.4);
  }
  100% {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 40px rgba(157, 140, 255, 0.12);
  }
}

.member-generation {
  min-height: 18px;
  margin: 12px 0 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.member-stage h2 {
  min-height: 34px;
  margin: 0;
  padding: 0 8px;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.target-answer {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--stage-text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: pop-in 0.25s ease both;
}

.answer-chip i {
  width: 11px;
  height: 11px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: var(--answer-color);
  box-shadow: 0 0 9px var(--answer-color);
}

.penlight-pair {
  width: min(100%, 440px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.penlight {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s ease;
}

.penlight__lamp {
  width: 11px;
  height: 34px;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px 6px 3px 3px;
  background: var(--penlight-color, #3f3b39);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--penlight-color, #3f3b39) 75%, transparent),
    0 0 40px color-mix(in srgb, var(--penlight-color, #3f3b39) 40%, transparent);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.penlight__label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyboard-hint {
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

/* ---------- Result ---------- */
.result-main > h2 {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.result-message {
  min-height: 24px;
  margin: 12px 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.result-stats {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 12px;
  margin: 0;
}

.result-stats > div {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
}

.result-stats dt {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.result-stats dd {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 23px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.result-stats__primary {
  background: linear-gradient(150deg, var(--accent-soft), rgba(157, 140, 255, 0.08)) !important;
  border-color: rgba(241, 158, 194, 0.4) !important;
}

.result-stats__primary dd {
  color: var(--accent-strong);
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 0 24px var(--accent-glow);
}

.claim-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 28px;
  margin-top: 22px;
  padding: 24px;
  border: 1px solid rgba(241, 158, 194, 0.4);
  border-radius: var(--radius);
  background: linear-gradient(150deg, var(--accent-soft), rgba(157, 140, 255, 0.06));
  box-shadow: var(--shadow-glow);
}

.claim-panel h3 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: 19px;
  letter-spacing: 0.03em;
}

.claim-panel p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.claim-panel form {
  min-width: 0;
}

.claim-panel label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.nickname-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.nickname-row input {
  min-width: 0;
  height: 46px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nickname-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(241, 158, 194, 0.2);
}

.nickname-row input::placeholder {
  color: var(--ink-faint);
}

.turnstile-slot {
  min-height: 0;
  margin-top: 10px;
}

.form-state {
  min-height: 19px;
  margin-top: 8px !important;
  color: var(--danger) !important;
}

.form-state.is-success {
  color: var(--success) !important;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.leaderboard-panel--result {
  margin-top: 0;
}

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1080px) {
  .member-generation__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .game-arena {
    grid-template-columns: minmax(150px, 190px) minmax(300px, 1fr) minmax(150px, 190px);
  }

  .stage {
    padding-inline: 16px;
  }

  .penlight-control {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 8px;
  }

  .choice-key {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 900px) {
  .setup-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .leaderboard-panel {
    width: 100%;
  }

  .member-generation__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .claim-panel {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

/* ---------- Responsive: phone ---------- */
@media (max-width: 620px) {
  .app-shell {
    padding-inline: 16px;
  }

  .site-header {
    min-height: 88px;
    align-items: center;
    padding-block: 18px;
  }

  .site-header h1 {
    font-size: 28px;
  }

  .header-note {
    display: none;
  }

  .screen {
    padding-top: 24px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .section-heading h2 {
    font-size: 22px;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .mode-option {
    min-height: 84px;
  }

  .member-generation__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .favorite-panel {
    padding: 16px;
  }

  .start-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
  }

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

/* ---------- Portrait phone: rotate advice ---------- */
@media (orientation: portrait) and (max-width: 900px) {
  .orientation-advice:not(.is-dismissed) {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--ink);
    background: rgba(7, 6, 11, 0.96);
    backdrop-filter: blur(8px);
  }

  .orientation-advice__inner {
    width: min(360px, 100%);
    padding: 30px 26px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-panel);
    text-align: center;
  }

  .orientation-advice__inner h2 {
    margin: 14px 0 8px;
    font-size: 22px;
    letter-spacing: 0.03em;
  }

  .orientation-advice__inner p {
    margin: 0 0 22px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.8;
  }

  .orientation-icon {
    display: block;
    color: var(--accent);
    font-size: 40px;
    animation: sway 2.4s ease-in-out infinite;
  }

  @keyframes sway {
    0%, 100% {
      transform: rotate(0deg);
    }
    50% {
      transform: rotate(80deg);
    }
  }

  .orientation-advice .button--quiet {
    color: var(--ink);
  }
}

/* ---------- Landscape phone: in-game compact ---------- */
@media (orientation: landscape) and (max-height: 620px) {
  .app-shell {
    width: 100%;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .site-header,
  .site-footer {
    display: none;
  }

  .game-screen {
    padding: 0;
  }

  .game-statusbar {
    min-height: 42px;
    padding-bottom: 4px;
  }

  .game-statusbar .text-button {
    min-height: 30px;
    font-size: 11px;
  }

  .game-stats > div {
    min-width: 60px;
    padding: 4px 9px;
  }

  .game-stats dt {
    font-size: 9px;
  }

  .game-stats dd {
    font-size: 13px;
  }

  .game-arena {
    min-height: calc(100dvh - 49px);
    border-radius: 12px;
    grid-template-columns: minmax(124px, 20vw) minmax(260px, 1fr) minmax(124px, 20vw);
  }

  .control-bank {
    padding: 8px;
  }

  .control-bank__title {
    margin-bottom: 6px;
  }

  .control-bank__title strong {
    font-size: 12px;
  }

  .choice-stack {
    gap: 7px;
  }

  .penlight-control {
    min-height: 46px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 6px;
    border-radius: 10px;
  }

  .choice-key {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 11px;
  }

  .choice-copy strong {
    font-size: 16px;
  }

  .choice-copy small {
    display: none;
  }

  .stage {
    padding: 12px 10px 8px;
  }

  .round-message {
    min-height: 16px;
    margin-bottom: 4px;
    font-size: 10px;
  }

  .member-photo-frame {
    width: min(152px, 36vh);
    border-radius: 12px;
  }

  .member-generation {
    min-height: 14px;
    margin-top: 4px;
    font-size: 9px;
  }

  .member-stage h2 {
    min-height: 22px;
    font-size: 17px;
  }

  .target-answer {
    min-height: 24px;
    margin-top: 2px;
  }

  .penlight-pair {
    max-width: 320px;
    margin-top: 5px;
  }

  .penlight {
    padding-block: 3px;
  }

  .penlight__lamp {
    height: 20px;
  }

  .keyboard-hint {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .member-curtain {
    transition: none;
  }
}
