  /* Layout: 大きなホイール(左) + 設定パネル(右)。狭い画面では縦積み。単一のダークテーマ(ゲームセンター卓の雰囲気)を意図的に採用 */
  :root {
    --bg: #131a2c;
    --surface: #1c2541;
    --surface-2: #243052;
    --line: #34416a;
    --fg: #eef1fa;
    --muted: #9aa5c8;
    --accent: #ffb547;
    --accent-ink: #2a1a00;
    --hot: #ff5d73;
    --font-display: "Dela Gothic One", "Zen Kaku Gothic New", system-ui, sans-serif;
    --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    color-scheme: dark;
  }
  html, body { background: var(--bg); color: var(--fg); }
  body { font-family: var(--font-body); font-size: 15px; line-height: 1.6; padding-inline: 16px; padding-block: 20px 40px; }
  * { box-sizing: border-box; }
  button, input, textarea { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .app { max-width: 1180px; margin: 0 auto; display: grid; gap: 20px; }
  header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 4vw, 36px); margin: 0; letter-spacing: .02em; text-wrap: balance; }
  h1 em { font-style: normal; color: var(--accent); }
  header p { margin: 0; color: var(--muted); font-size: 13px; }

  main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
  @media (max-width: 880px) { main { grid-template-columns: minmax(0, 1fr); } }

  /* ステージ */
  .stage { display: grid; gap: 16px; justify-items: center; min-width: 0; }
  .wheel-wrap { position: relative; width: min(100%, 600px); aspect-ratio: 1; max-width: 100%; }
  .wheel-wrap canvas { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 0 0 6px var(--surface-2), 0 0 0 8px var(--line), 0 18px 50px rgba(0,0,0,.45); }
  .pointer { position: absolute; left: 50%; top: -14px; width: 44px; height: 54px; transform: translateX(-50%); filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); z-index: 2; }
  .hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--bg); border: 4px solid var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); display: grid; place-content: center; text-align: center; padding: 10px; overflow: hidden; }
  .hub-label { font-family: var(--font-display); font-size: clamp(16px, 4.2vw, 34px); line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hub-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; font-variant-numeric: tabular-nums; }

  .spin-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; width: 100%; }
  .spin { font-family: var(--font-display); font-size: 22px; padding: 12px 44px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: 0 4px 0 #b9761a; transition: transform .08s, box-shadow .08s; }
  .spin:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b9761a; }
  .spin:disabled { opacity: .45; cursor: not-allowed; }

  .speed { display: grid; gap: 6px; justify-items: center; }
  .speed-label { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
  .seg { display: flex; flex-wrap: wrap; justify-content: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; }
  .seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--muted); }
  .seg button:hover { color: var(--fg); }
  .seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

  .result { min-height: 64px; width: min(100%, 600px); display: grid; place-items: center; text-align: center; }
  .result-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 22px; display: grid; gap: 2px; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); max-width: 100%; }
  .result-card small { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
  .result-card strong { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 5vw, 40px); color: var(--accent); overflow-wrap: anywhere; line-height: 1.2; }
  .result .hint { color: var(--muted); font-size: 13px; }
  @keyframes pop { from { transform: scale(.85); opacity: .3; } to { transform: scale(1); opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .result-card { animation: none; } }

  /* パネル */
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 18px; min-width: 0; }
  fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 18px; min-width: 0; }
  fieldset:disabled { opacity: .55; }
  .group { display: grid; gap: 8px; min-width: 0; }
  .group-title { font-size: 12px; color: var(--muted); letter-spacing: .1em; font-weight: 700; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 4px; gap: 4px; }
  .tabs button { border: 0; background: transparent; padding: 8px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 700; }
  .tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--fg); }

  .count-row { display: flex; gap: 6px; align-items: stretch; }
  .count-row button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 0 10px; cursor: pointer; font-family: var(--font-mono); font-size: 13px; }
  .count-row button:hover { border-color: var(--muted); }
  .num { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--font-mono); font-weight: 700; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
  input[type="range"] { width: 100%; accent-color: var(--accent); }
  .presets { display: flex; flex-wrap: wrap; gap: 6px; }
  .presets button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 11px; cursor: pointer; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
  .presets button:hover { color: var(--fg); border-color: var(--muted); }
  .inline { display: flex; align-items: center; gap: 10px; }
  .inline label { font-size: 13px; color: var(--muted); white-space: nowrap; }
  .inline .num { font-size: 15px; padding: 6px 8px; text-align: left; }
  textarea { width: 100%; min-height: 180px; resize: vertical; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; line-height: 1.5; }
  .note { font-size: 12px; color: var(--muted); }
  .note b { color: var(--fg); font-family: var(--font-mono); }
  .note.warn b, .note.warn { color: var(--hot); }

  .check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
  .check input { width: 18px; height: 18px; accent-color: var(--accent); }
  .row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
  .ghost { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
  .ghost:hover { border-color: var(--muted); }
  .stat { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
  .stat b { font-size: 18px; color: var(--accent); }

  .add-row { display: flex; gap: 6px; align-items: stretch; }
  .add-row textarea { min-height: 42px; height: 42px; flex: 1; min-width: 0; }
  .add-row .spin-mini { border: 0; border-radius: 8px; padding: 0 16px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; white-space: nowrap; }
  .people { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); }
  .people li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
  /* 見えていない行のレイアウト・描画を省く(2000人でも追加・スクロールが軽い)。行の高さの目安は 45px */
  .people li { content-visibility: auto; contain-intrinsic-size: auto 45px; }
  .people .dot { width: 10px; height: 10px; border-radius: 50%; }
  .people .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .people .ctrl { display: flex; align-items: center; gap: 2px; }
  .people .ctrl button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; cursor: pointer; font-family: var(--font-mono); font-weight: 700; font-size: 16px; line-height: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
  .people .ctrl button:hover:not(:disabled) { border-color: var(--muted); }
  .people .ctrl button:disabled { opacity: .35; cursor: not-allowed; }
  .people .ctrl input { width: 52px; height: 32px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; text-align: center; font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
  .people .ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; }
  .people .x { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; font-size: 16px; }
  .people .x:hover { color: var(--hot); background: var(--surface-2); }
  .people li.out .name { color: var(--muted); text-decoration: line-through; }
  .people .back { border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
  .people .empty { display: block; color: var(--muted); font-size: 13px; padding: 10px 2px; }

  .history { list-style: none; margin: 0; padding: 0; display: grid; max-height: 240px; overflow-y: auto; border-top: 1px solid var(--line); }
  .history li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); align-items: baseline; }
  .history .n { font-family: var(--font-mono); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
  .history .who { font-weight: 700; overflow-wrap: anywhere; }
  .history .of { font-family: var(--font-mono); color: var(--muted); font-size: 11px; white-space: nowrap; }
  .history .empty { display: block; color: var(--muted); font-size: 13px; padding: 10px 2px; border: 0; }
