    :root {
      --line: rgba(159, 200, 236, 0.13);
      --text: #eef6ff;
      --muted: #94acc4;
      --accent: #5db9ff;
      --accent-2: #8ce0cf;
      --gold: #f3bf69;
      --danger: #ff8f8b;
      --panel: rgba(8, 19, 31, 0.9);
      --soft: rgba(255, 255, 255, 0.045);
      --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
      --r: 22px;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      color: var(--text);
      font-family: "Segoe UI", system-ui, sans-serif;
      background:
        radial-gradient(circle at top left, rgba(93, 185, 255, 0.18), transparent 18%),
        radial-gradient(circle at top right, rgba(140, 224, 207, 0.08), transparent 22%),
        linear-gradient(180deg, #040b13 0%, #07111a 34%, #09131d 100%);
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      opacity: 0.18;
      background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
      background-size: 32px 32px;
      mask-image: radial-gradient(circle at center, black 45%, transparent 82%);
    }
    button { font: inherit; }
    .page { position: relative; z-index: 1; max-width: 1400px; margin: 0 auto; padding: 24px; }
    .top,.shell,.card,.player,.board-wrap,.actions,.stake {
      border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
    }
    .top {
      display: flex; justify-content: space-between; align-items: center; gap: 12px;
      margin-bottom: 18px; padding: 14px 18px; background: rgba(7, 18, 29, 0.72); backdrop-filter: blur(18px);
    }
    .brand { display: flex; align-items: center; gap: 12px; }
    .mark {
      width: 40px; height: 40px; border-radius: 14px;
      background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.16), transparent 36%), linear-gradient(135deg, #1c5d93, #0f2c48);
    }
    .brand h1,.brand p,.copy p,.small,.chat-meta,.row span { margin: 0; }
    .brand h1 { font-size: 20px; letter-spacing: 0.04em; }
    .brand h1 span { color: var(--accent); }
    .brand p,.copy p,.small,.chat-meta,.row span,.note { color: var(--muted); }
    .right { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .pill,.wallet,.chip,.tag {
      display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
      border-radius: 999px; border: 1px solid rgba(159, 200, 236, 0.12); background: rgba(255, 255, 255, 0.04); font-size: 13px; white-space: nowrap;
    }
    .pill { border-color: rgba(93, 185, 255, 0.24); background: rgba(93, 185, 255, 0.1); color: #dff2ff; font-weight: 700; }
    .wallet { border-color: rgba(243, 191, 105, 0.24); background: rgba(243, 191, 105, 0.1); color: #ffe9bf; font-weight: 700; }
    .shell { padding: 18px; background: linear-gradient(160deg, rgba(9, 24, 38, 0.92), rgba(7, 18, 29, 0.96)); }
    .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
    .eyebrow {
      display: inline-flex; padding: 7px 11px; border-radius: 999px; border: 1px solid rgba(93, 185, 255, 0.18);
      background: rgba(93, 185, 255, 0.1); color: #dff2ff; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
    }
    .copy h2 { margin: 10px 0 8px; font-size: clamp(30px, 4vw, 44px); line-height: 1.02; letter-spacing: -0.03em; }
    .controls { display: grid; gap: 10px; justify-items: end; }
    .control-label { width: 100%; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
    .views,.toggles {
      display: inline-flex; flex-wrap: wrap; gap: 8px; padding: 6px; border-radius: 18px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
    }
    .vbtn,.tbtn { border: 0; padding: 10px 14px; border-radius: 14px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
    .vbtn.active,.tbtn.active { background: #fff; color: #07111a; }
    .config { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
    .cfg {
      display: inline-flex; align-items: center; min-height: 42px; padding: 10px 14px; border-radius: 16px;
      border: 1px solid rgba(159, 200, 236, 0.12); background: rgba(255, 255, 255, 0.05); font-size: 14px; font-weight: 700; color: #dcecff;
    }
    .cfg.time { border-color: rgba(93, 185, 255, 0.34); background: linear-gradient(135deg, rgba(93, 185, 255, 0.2), rgba(140, 224, 207, 0.12)); font-size: 18px; }
    .cfg.econ { border-color: rgba(243, 191, 105, 0.36); background: linear-gradient(135deg, rgba(243, 191, 105, 0.18), rgba(255, 159, 91, 0.08)); color: #ffe9bf; }
    .stake {
      display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 16px;
      background: radial-gradient(circle at left center, rgba(243, 191, 105, 0.16), transparent 28%), rgba(255, 255, 255, 0.045);
    }
    .stake strong { display: block; margin-bottom: 4px; color: #fff0ca; font-size: 18px; }
    .stake p,.stake .note { margin: 0; font-size: 14px; line-height: 1.55; }
    .layout { display: grid; gap: 16px; align-items: start; }
    .layout.player { grid-template-columns: minmax(0, 1fr) 200px; justify-content: center; gap: 16px; }
    .layout.player.focus { grid-template-columns: minmax(0, 1fr) 172px; gap: 14px; }
    .layout.viewer { grid-template-columns: 240px minmax(0, 1fr) 320px; }
    .layout.player > main { display: grid; gap: 14px; justify-items: center; }
    .layout.player > main > .player,
    .layout.player > main > .board-wrap,
    .layout.player > main > .actions { width: 100%; }
    .layout.player > main > .board-wrap { padding: 12px; }
    .layout.player .board { width: 100%; margin: 0 auto; }
    .layout.viewer .board { width: 100%; max-width: 480px; margin: 0 auto; }
    .layout.player .rail.right { gap: 10px; align-content: start; }
    .layout.player.focus .rail.right { gap: 8px; }
    .rail { display: grid; gap: 14px; }
    .card { padding: 16px; background: var(--soft); }
    .card.compact { padding: 12px; }
    .layout.player.focus .card.compact { padding: 10px; box-shadow: none; background: rgba(255, 255, 255, 0.03); }
    .layout.player.focus .card h3 { font-size: 14px; }
    .card h3,.player-main h3 { margin: 0 0 8px; font-size: 18px; }
    .label { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
    .player { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: rgba(255, 255, 255, 0.05); }
    .player.active { border-color: rgba(108, 226, 160, 0.28); }
    .ava {
      width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 18px;
      background: linear-gradient(135deg, rgba(93, 185, 255, 0.28), rgba(140, 224, 207, 0.12)); font-weight: 800; font-size: 18px;
    }
    .ava.alt { background: linear-gradient(135deg, rgba(243, 191, 105, 0.22), rgba(255, 159, 91, 0.12)); color: #fff0ca; }
    .player-main { flex: 1; min-width: 0; }
    .player-main p,.take { margin: 0; color: var(--muted); font-size: 13px; }
    .take { margin-top: 8px; color: #d8ebff; letter-spacing: 0.06em; }
    .clock { min-width: 116px; padding: 10px 14px; border-radius: 16px; text-align: center; font-size: 28px; font-weight: 800; background: rgba(255, 255, 255, 0.04); color: #c9d8e8; }
    .clock.live { background: linear-gradient(135deg, rgba(108, 226, 160, 0.25), rgba(93, 185, 255, 0.1)); color: #ecfff5; }
    .board-wrap { margin: 14px 0; padding: 16px; background: linear-gradient(145deg, rgba(44,61,79,0.3), rgba(26,37,48,0.4)); border: 1px solid rgba(192,168,96,0.08); }
    .board { margin: 0 auto; aspect-ratio: 1 / 1; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 18px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
    .board.xiangqi { grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(10, 1fr); aspect-ratio: 9 / 10; background: url('images/xiangqi-board.svg') center/cover no-repeat; }
    .board.up { grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(10, 1fr); aspect-ratio: 9 / 10; background: url('images/upchess-board.svg') center/cover no-repeat; }
    .board.caro { grid-template-columns: repeat(15, 1fr); grid-template-rows: repeat(15, 1fr); aspect-ratio: 1 / 1; background: #f0f7fc; }
    .sq { position: relative; display: flex; align-items: center; justify-content: center; font-size: clamp(28px, 4vw, 48px); }
    .l { background: #f4ede2; color: #2c3d4f; } .d { background: #4d6072; color: #f4ede2; }
    .xiangqi .sq { background: transparent; border-right: 1px solid rgba(120,60,20,0.15); border-bottom: 1px solid rgba(120,60,20,0.15); font-size: clamp(14px, 2.5vw, 22px); }
    .xiangqi .sq.river { background: transparent; }
    .up .sq { background: transparent; border-right: 1px solid rgba(180,60,20,0.08); border-bottom: 1px solid rgba(180,60,20,0.08); font-size: clamp(14px, 2.5vw, 22px); }
    .up .sq.river { background: transparent; }
    .caro .sq { background: #f0f7fc; border-right: 1px solid #d0e4f0; border-bottom: 1px solid #d0e4f0; font-size: clamp(14px, 2vw, 20px); }
    .caro .sq .x-mark { color: #c0392b; font-weight: 900; }
    .caro .sq .o-mark { color: #2874a6; font-weight: 900; }
    .disc { width: 70%; height: 70%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: clamp(12px, 2vw, 18px); box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
    .disc.red { background: radial-gradient(circle at 40% 35%,#fff8e8,#f5e8c8); color: #cc1a0a; border: 2px solid #8b0000; }
    .disc.black { background: radial-gradient(circle at 40% 35%,#f8f0e0,#e8dcc0); color: #0a0a0a; border: 2px solid #1a1a1a; }
    .disc.hidden { background: radial-gradient(circle at 40% 35%,#3a1c10,#1a0c06); color: #e04a18; border: 2px solid rgba(180,60,20,0.4); box-shadow: 0 0 10px rgba(224,70,24,0.15); }
    .disc.revealed { background: radial-gradient(circle at 40% 35%,#f8e8c0,#e8c880); color: #8c1a0a; border: 2px solid rgba(140,26,10,0.4); box-shadow: 0 0 14px rgba(240,160,48,0.2); }
    .last { box-shadow: inset 0 0 0 999px rgba(201, 168, 76, 0.24); } .sel { box-shadow: inset 0 0 0 999px rgba(138, 155, 171, 0.3); }    .coord { position: absolute; font-size: 10px; font-weight: 800; opacity: 0.7; } .file { right: 4px; bottom: 4px; } .rank { left: 4px; top: 4px; }
    .l .coord { color: #4d6072; } .d .coord { color: #f4ede2; }
    .dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: rgba(201, 168, 76, 0.35); }
    .actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: rgba(255, 255, 255, 0.045); }
    .actions strong { display: block; margin-bottom: 4px; font-size: 16px; }
    .actions p { margin: 0; color: var(--muted); font-size: 13px; }
    .ag { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .abtn { padding: 11px 14px; border: 1px solid rgba(159, 200, 236, 0.12); border-radius: 14px; background: rgba(255, 255, 255, 0.05); color: #dcecff; font-size: 14px; font-weight: 700; }
    .abtn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04111b; border-color: transparent; }
    .abtn.warn { border-color: rgba(255, 143, 139, 0.26); color: #ffd8d7; background: rgba(255, 143, 139, 0.06); }
    .stack { display: grid; gap: 10px; }
    .item,.row { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(159, 200, 236, 0.06); }
    .moves .item { display: grid; grid-template-columns: 32px 1fr 1fr; gap: 8px; font-family: Consolas, "Courier New", monospace; font-size: 13px; }
    .moves .item.current { border-color: rgba(93, 185, 255, 0.24); background: rgba(93, 185, 255, 0.08); }
    .moves.compact .stack { gap: 8px; }
    .moves.compact .item { padding: 10px 12px; }
    .meta-line { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
    .meta-line strong { color: #dcecff; font-size: 12px; }
    .inline-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
    .mini-chip {
      display: inline-flex;
      align-items: center;
      min-height: 30px;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(159, 200, 236, 0.1);
      background: rgba(255, 255, 255, 0.04);
      color: #dcecff;
      font-size: 12px;
      font-weight: 700;
    }
    .mini-chip.active { background: rgba(93, 185, 255, 0.12); border-color: rgba(93, 185, 255, 0.22); }
    .chat-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; }
    .item strong,.row strong { color: #eef6ff; }
    .item p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
    .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
    .chip,.tag { border-color: rgba(243, 191, 105, 0.18); color: #ffe8c2; background: rgba(243, 191, 105, 0.08); font-weight: 700; font-size: 12px; }
    .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .settings { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings .item { display: grid; gap: 6px; }
    .hidden { display: none !important; }
    @media (max-width: 1320px) { .layout.viewer { grid-template-columns: minmax(0, 1fr) 300px; } .layout.viewer .left { display: none; } }
    @media (max-width: 1160px) {
      .layout.player,.layout.viewer { grid-template-columns: 1fr; }
      .top,.head,.actions { flex-direction: column; align-items: flex-start; }
      .ag { justify-content: flex-start; }
      .layout.player .board,.layout.viewer .board { width: min(100%, 760px); }
    }
    @media (max-width: 760px) { .page { padding: 16px; } .shell { padding: 14px; } .copy h2 { font-size: 28px; } .cfg { width: 100%; justify-content: center; } .clock { min-width: 92px; font-size: 22px; } .settings { grid-template-columns: 1fr; } }
