:root {
      --paper: #fbf8f1;
      --surface: #fffdfa;
      --surface-2: #f2ede2;
      --ink: #201b16;
      --muted: #6b6257;
      --faint: #9b8f80;
      --line: #ded2c1;
      --amber: #b66f2f;
      --amber-soft: #e4bf8f;
      --teal: #3f766d;
      --teal-soft: #dcebe7;
      --blue: #283f63;
      --shadow: 0 8px 30px rgba(54, 39, 22, 0.12);
      --radius: 8px;
      color-scheme: light;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      min-height: 100%;
    }

    body {
      margin: 0;
      background:
        linear-gradient(180deg, rgba(63, 118, 109, 0.06), transparent 260px),
        var(--paper);
      color: var(--ink);
      font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
      -webkit-font-smoothing: antialiased;
      font-feature-settings: "tnum" 1, "kern" 1;
    }

    button,
    input,
    select {
      font: inherit;
    }

    button {
      cursor: pointer;
    }

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

    .app-shell {
      min-height: 100vh;
    }

    .serif {
      font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", SimSun, STSong, serif;
      font-weight: 500;
    }

    .mono {
      font-family: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
      font-variant-numeric: tabular-nums;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 20;
      border-bottom: 1px solid rgba(222, 210, 193, 0.8);
      background: rgba(251, 248, 241, 0.86);
      backdrop-filter: blur(16px);
    }

    .topbar-main {
      min-height: 66px;
      display: flex;
      align-items: center;
      gap: 22px;
      padding: 10px 28px;
    }

    .brand {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 190px;
    }

    .brand-title {
      font-size: 22px;
      line-height: 1.1;
    }

    .brand-subtitle {
      color: var(--faint);
      font-size: 10px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
    }

    .nav {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .nav button,
    .ghost-button,
    .ink-button,
    .soft-button,
    .danger-button {
      border: 1px solid transparent;
      border-radius: 7px;
      padding: 9px 13px;
      transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
    }

    .nav button,
    .ghost-button {
      color: var(--muted);
      background: transparent;
    }

    .nav button:hover,
    .ghost-button:hover {
      color: var(--ink);
      background: var(--surface-2);
    }

    .nav button.active {
      color: var(--paper);
      background: var(--ink);
    }

    .ink-button {
      color: var(--paper);
      background: var(--ink);
      border-color: var(--ink);
    }

    .ink-button:hover {
      transform: translateY(-1px);
      background: #312820;
    }

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

    .soft-button:hover {
      border-color: var(--amber);
      color: var(--amber);
    }

    .danger-button {
      color: #8b2f26;
      background: transparent;
      border-color: rgba(139, 47, 38, 0.25);
    }

    .danger-button:hover {
      background: rgba(139, 47, 38, 0.08);
    }

    .topbar-actions {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .score-strip {
      display: grid;
      grid-template-columns: minmax(210px, 1fr) minmax(220px, 0.8fr) minmax(210px, 1fr);
      align-items: stretch;
      gap: 1px;
      border-top: 1px solid rgba(222, 210, 193, 0.65);
      background: rgba(222, 210, 193, 0.7);
    }

    .team-score,
    .picker-panel {
      background: rgba(255, 253, 250, 0.82);
      padding: 12px 28px;
      display: flex;
      align-items: center;
      gap: 12px;
      min-height: 64px;
    }

    .team-score:last-child {
      justify-content: flex-end;
      text-align: right;
    }

    .team-name-button {
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--ink);
      text-align: inherit;
    }

    .team-score strong {
      display: block;
      font-size: 19px;
      line-height: 1.1;
    }

    .team-score span,
    .picker-panel span {
      color: var(--faint);
      font-size: 12px;
    }

    .score-number {
      color: var(--amber);
      font-size: 30px;
      min-width: 72px;
    }

    .score-controls {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
    }

    .score-controls button {
      width: 50px;
      padding: 7px 0;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--muted);
    }

    .score-controls button:hover {
      color: var(--amber);
      border-color: var(--amber);
    }

    .picker-panel {
      justify-content: center;
      text-align: center;
      flex-direction: column;
      gap: 5px;
      background:
        linear-gradient(180deg, rgba(182, 111, 47, 0.16), rgba(255, 253, 250, 0.88)),
        rgba(255, 253, 250, 0.88);
    }

    .picker-panel strong {
      color: var(--amber);
      font-size: clamp(30px, 4.2vw, 54px);
      line-height: 1;
      text-shadow: 0 1px 0 rgba(255, 253, 250, 0.8);
    }

    .page {
      width: min(1180px, calc(100vw - 44px));
      margin: 0 auto;
      padding: 46px 0 76px;
    }

    .page.narrow {
      width: min(900px, calc(100vw - 44px));
    }

    .hero {
      min-height: calc(100vh - 146px);
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.8fr);
      gap: 46px;
      align-items: center;
    }

    .eyebrow {
      color: var(--amber);
      font-size: 13px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      margin-bottom: 16px;
    }

    h1,
    h2,
    h3,
    p {
      margin-top: 0;
    }

    .hero h1 {
      font-size: clamp(42px, 7vw, 82px);
      line-height: 1.02;
      letter-spacing: 0;
      margin-bottom: 22px;
    }

    .hero-lede {
      color: var(--muted);
      font-size: clamp(18px, 2vw, 24px);
      line-height: 1.72;
      max-width: 780px;
    }

    .hero-points {
      margin-top: 36px;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px;
    }

    .point {
      border-top: 1px solid var(--line);
      padding-top: 14px;
    }

    .point strong {
      display: block;
      margin-bottom: 6px;
      font-size: 17px;
    }

    .point span {
      color: var(--muted);
      line-height: 1.55;
    }

    .side-panel {
      border-left: 1px solid var(--line);
      padding-left: 30px;
    }

    .section-head {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 22px;
    }

    .section-head h2 {
      font-size: clamp(30px, 4vw, 48px);
      line-height: 1.08;
      margin-bottom: 0;
    }

    .muted {
      color: var(--muted);
    }

    .faint {
      color: var(--faint);
    }

    .participant-list,
    .plain-list {
      display: grid;
      gap: 8px;
      margin: 16px 0 0;
      padding: 0;
      list-style: none;
    }

    .participant-row {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 10px;
      border-top: 1px solid var(--line);
      padding: 12px 0;
    }

    .participant-row:first-child {
      border-top: 0;
    }

    .person-index {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      color: var(--paper);
      background: var(--teal);
      font-size: 12px;
    }

    .row-actions {
      display: flex;
      gap: 6px;
    }

    .row-actions button {
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
    }

    .row-actions button:hover {
      color: var(--amber);
      border-color: var(--amber);
    }

    .rules-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 12px;
      margin: 28px 0 32px;
    }

    .rule-tile {
      background: rgba(255, 253, 250, 0.62);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 16px;
    }

    .rule-tile strong {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
      font-size: 17px;
    }

    .swatch {
      width: 16px;
      height: 16px;
      border-radius: 4px;
      border: 1px solid rgba(0, 0, 0, 0.12);
      flex: 0 0 auto;
    }

    .game-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin: 24px 0 10px;
    }

    .seating-wrap {
      margin-top: 34px;
      border-top: 1px solid var(--line);
      padding-top: 26px;
      overflow-x: auto;
    }

    .seating-diagram {
      position: relative;
      min-width: 1120px;
      height: var(--diagram-height, 460px);
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      padding: 28px 0;
    }

    .u-table {
      position: absolute;
      left: 50%;
      top: var(--table-top, 50%);
      z-index: 0;
      width: min(54%, 560px);
      height: var(--table-height, 150px);
      transform: translate(-50%, -50%);
      border: 1px solid rgba(222, 210, 193, 0.95);
      border-top-color: transparent;
      border-radius: 0 0 90px 90px;
      background:
        linear-gradient(180deg, rgba(255, 253, 250, 0.2), rgba(228, 191, 143, 0.18)),
        rgba(255, 253, 250, 0.55);
      display: grid;
      place-items: center;
      color: var(--faint);
      letter-spacing: 0.18em;
      text-transform: uppercase;
      font-size: 12px;
    }

    .seat-node {
      position: absolute;
      z-index: 1;
      width: var(--seat-size, 112px);
      aspect-ratio: 1;
      border-radius: 50%;
      border: 1px solid var(--line);
      background:
        radial-gradient(circle at 35% 28%, rgba(255, 253, 250, 0.95), rgba(242, 237, 226, 0.96)),
        var(--surface);
      color: var(--ink);
      display: grid;
      place-items: center;
      padding: 12px;
      text-align: center;
      box-shadow: 0 8px 20px rgba(54, 39, 22, 0.08);
      transform: translate(-50%, -50%);
    }

    .seat-name {
      font-size: var(--seat-font, 22px);
      line-height: 1.2;
      overflow-wrap: anywhere;
    }

    .board-scroll {
      overflow-x: auto;
      padding-bottom: 10px;
    }

    .board {
      min-width: 980px;
      display: grid;
      grid-template-columns: repeat(6, minmax(150px, 1fr));
      gap: 9px;
    }

    .board-column {
      display: grid;
      grid-template-rows: 88px repeat(5, 102px);
      gap: 9px;
    }

    .category-button,
    .score-cell {
      border-radius: var(--radius);
      border: 1px solid var(--line);
      color: var(--paper);
      background: linear-gradient(180deg, var(--blue), #1d2d46);
      box-shadow: 0 6px 18px rgba(29, 45, 70, 0.12);
      transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
    }

    .category-button {
      padding: 12px 10px;
      font-size: 17px;
      line-height: 1.25;
    }

    .category-button:hover,
    .score-cell:hover {
      transform: translateY(-2px);
      filter: brightness(1.06);
    }

    .score-cell {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 10px;
    }

    .score-cell strong {
      color: var(--amber-soft);
      font-size: clamp(28px, 3.4vw, 42px);
      line-height: 1;
    }

    .score-cell span {
      font-size: 13px;
      color: rgba(251, 248, 241, 0.72);
    }

    .score-cell.in-progress {
      border-color: var(--amber-soft);
      background: linear-gradient(180deg, #3f4f66, #233349);
    }

    .score-cell.done {
      color: var(--ink);
      background: linear-gradient(180deg, #e9dfcf, #d8c8b4);
      box-shadow: none;
    }

    .score-cell.done strong {
      color: var(--amber);
    }

    .score-cell.done span {
      color: var(--muted);
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      display: grid;
      place-items: center;
      padding: 28px;
      background: rgba(32, 27, 22, 0.32);
      backdrop-filter: blur(6px);
      animation: fadeIn 180ms ease both;
    }

    .modal {
      width: min(1060px, 100%);
      max-height: min(88vh, 860px);
      overflow: auto;
      background: var(--surface);
      border: 1px solid rgba(222, 210, 193, 0.9);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      animation: slideUp 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .modal-refresh-stable .modal-backdrop,
    .modal-refresh-stable .modal {
      animation: none;
    }

    .spotlight {
      position: fixed;
      inset: 0;
      z-index: 90;
      display: grid;
      place-items: center;
      pointer-events: none;
      padding: 24px;
      animation: spotlightFade 2000ms ease both;
    }

    .spotlight-card {
      min-width: min(620px, calc(100vw - 48px));
      border: 1px solid rgba(228, 191, 143, 0.72);
      border-radius: var(--radius);
      background:
        linear-gradient(180deg, rgba(255, 253, 250, 0.96), rgba(242, 237, 226, 0.94)),
        var(--surface);
      box-shadow: 0 18px 60px rgba(32, 27, 22, 0.24);
      padding: 34px 44px;
      text-align: center;
      animation: spotlightCard 2000ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .spotlight-kicker {
      color: var(--amber);
      font-size: 13px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      margin-bottom: 10px;
    }

    .spotlight-title {
      font-size: clamp(34px, 5vw, 64px);
      line-height: 1.08;
      margin: 0;
    }

    .spotlight-lines {
      margin-top: 16px;
      display: grid;
      gap: 8px;
      color: var(--muted);
      font-size: clamp(20px, 2.5vw, 30px);
      line-height: 1.35;
    }

    .modal.narrow-modal {
      width: min(620px, 100%);
    }

    .modal-header,
    .modal-footer {
      position: sticky;
      background: rgba(255, 253, 250, 0.9);
      backdrop-filter: blur(10px);
      z-index: 2;
      padding: 20px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      border-color: var(--line);
    }

    .modal-header {
      top: 0;
      border-bottom: 1px solid var(--line);
    }

    .modal-footer {
      bottom: 0;
      border-top: 1px solid var(--line);
    }

    .modal-title {
      margin: 0;
      font-size: 27px;
      line-height: 1.2;
    }

    .modal-body {
      padding: 24px;
    }

    .close-button {
      border: 1px solid var(--line);
      border-radius: 6px;
      background: transparent;
      color: var(--muted);
      padding: 8px 10px;
    }

    .close-button:hover {
      color: var(--ink);
      border-color: var(--amber);
    }

    .field {
      display: grid;
      gap: 8px;
      margin-bottom: 16px;
    }

    .field label {
      color: var(--muted);
      font-size: 14px;
    }

    .field input,
    .field select {
      width: 100%;
      border: 0;
      border-bottom: 1px solid var(--line);
      background: transparent;
      color: var(--ink);
      padding: 10px 2px;
      outline: none;
      font-size: 18px;
    }

    .field input:focus,
    .field select:focus {
      border-color: var(--amber);
    }

    .team-draft {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 24px;
    }

    .team-block {
      border-top: 1px solid var(--line);
      padding-top: 16px;
    }

    .team-block h3 {
      margin-bottom: 12px;
      font-size: 22px;
    }

    .prompt-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
    }

    .prompt-card {
      min-height: 320px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #f8f2e8;
      perspective: 1200px;
      overflow: hidden;
    }

    .prompt-card.blank {
      display: grid;
      place-items: center;
      background:
        linear-gradient(135deg, rgba(63, 118, 109, 0.08), transparent),
        var(--surface-2);
    }

    .blank-card-button {
      width: 100%;
      height: 100%;
      min-height: 320px;
      border: 0;
      background: transparent;
      color: var(--ink);
      display: grid;
      place-items: center;
      padding: 28px;
    }

    .blank-card-button strong {
      display: block;
      font-size: 34px;
      margin-bottom: 8px;
    }

    .card-face {
      min-height: 320px;
      padding: 22px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      transform-origin: center;
      transform-style: preserve-3d;
    }

    .card-face.reveal-animate {
      animation: flipIn 980ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .card-owner {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      color: var(--amber);
      font-size: 13px;
      letter-spacing: 0.08em;
    }

    .prompt-text {
      font-size: clamp(22px, 2.4vw, 34px);
      line-height: 1.45;
    }

    .card-face.reveal-animate .prompt-text {
      animation: textDevelop 900ms ease 320ms both;
    }

    .forbidden-list {
      margin-top: auto;
      border-top: 1px solid var(--line);
      padding-top: 14px;
      color: var(--muted);
      font-size: 18px;
      line-height: 1.6;
    }

    .helper-panel {
      margin-top: auto;
      border-top: 1px solid var(--line);
      padding-top: 14px;
      display: grid;
      gap: 10px;
    }

    .helper-line {
      color: var(--muted);
      line-height: 1.55;
    }

    .pre-reveal {
      min-height: 320px;
      display: grid;
      place-items: center;
      padding: 24px;
      text-align: center;
      background:
        linear-gradient(135deg, rgba(63, 118, 109, 0.08), transparent),
        var(--surface-2);
    }

    .pre-reveal h3 {
      font-size: 28px;
      margin-bottom: 10px;
    }

    .covered {
      min-height: 320px;
      display: grid;
      place-items: center;
      padding: 26px;
      text-align: center;
      color: var(--muted);
      background:
        repeating-linear-gradient(0deg, rgba(222, 210, 193, 0.22), rgba(222, 210, 193, 0.22) 1px, transparent 1px, transparent 38px),
        var(--surface);
    }

    .timer-box {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 18px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 18px;
    }

    .timer-time {
      font-size: clamp(38px, 6vw, 68px);
      color: var(--teal);
      min-width: 170px;
    }

    .footer-timer {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-right: auto;
    }

    .footer-timer .timer-time {
      font-size: clamp(28px, 3vw, 42px);
      min-width: 112px;
    }

    .popup-score-controls {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 18px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 18px;
    }

    .popup-score-team {
      display: inline-flex;
      align-items: baseline;
      gap: 6px;
      border-radius: 7px;
      padding: 5px 7px;
    }

    .popup-score-team.score-flash {
      animation: scoreFlip 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .status-note {
      color: var(--muted);
      font-size: 14px;
      line-height: 1.6;
    }

    .rule-text {
      font-size: 20px;
      line-height: 1.75;
      color: var(--muted);
    }

    .example-lines {
      margin: 18px 0 0;
      padding: 18px;
      border-radius: var(--radius);
      border: 1px solid var(--line);
      background: var(--paper);
      color: var(--ink);
      white-space: pre-wrap;
      line-height: 1.7;
      font-size: 17px;
    }

    .empty-state {
      color: var(--muted);
      border-top: 1px solid var(--line);
      padding-top: 14px;
      line-height: 1.7;
    }

    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes flipIn {
      from {
        opacity: 0;
        transform: rotateY(-84deg) scale(0.96);
      }
      55% { opacity: 1; }
      to {
        opacity: 1;
        transform: rotateY(0) scale(1);
      }
    }

    @keyframes textDevelop {
      from {
        opacity: 0;
        transform: translateY(8px);
        filter: blur(2px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
      }
    }

    @keyframes scoreFlip {
      from {
        background: rgba(182, 111, 47, 0);
        transform: rotateX(-35deg);
      }
      45% {
        background: rgba(182, 111, 47, 0.22);
        transform: rotateX(0);
      }
      to {
        background: rgba(182, 111, 47, 0);
        transform: rotateX(0);
      }
    }

    @keyframes spotlightFade {
      0% { opacity: 0; }
      12% { opacity: 1; }
      82% { opacity: 1; }
      100% { opacity: 0; }
    }

    @keyframes spotlightCard {
      0% {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
        filter: blur(3px);
      }
      18% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
      }
      78% {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
      100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
      }
    }

    @media (max-width: 900px) {
      .topbar-main {
        align-items: flex-start;
        flex-direction: column;
      }

      .topbar-actions {
        margin-left: 0;
        justify-content: flex-start;
      }

      .score-strip {
        grid-template-columns: 1fr;
      }

      .team-score,
      .team-score:last-child,
      .picker-panel {
        justify-content: flex-start;
        text-align: left;
      }

      .hero {
        min-height: auto;
        grid-template-columns: 1fr;
      }

      .side-panel {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 24px;
      }

      .hero-points,
      .rules-grid,
      .team-draft {
        grid-template-columns: 1fr;
      }

      .page {
        width: min(100% - 28px, 1180px);
        padding-top: 30px;
      }

      .modal-backdrop {
        padding: 12px;
      }
    }

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