﻿        :root {
            /* Skyjo-Palette (Kartenrücken-Farben) */
            --skyjo-purple: #7c3aed;
            --skyjo-purple-dark: #5b21b6;
            --skyjo-cyan: #06b6d4;
            --skyjo-cyan-dark: #0e7490;
            --skyjo-green: #84cc16;
            --skyjo-pink: #ec4899;
            --skyjo-pink-dark: #be185d;
            --skyjo-yellow: #facc15;
            --skyjo-red: #ef4444;

            --bg: #2e1065;
            --panel: rgba(255,255,255,.94);
            --text: #1f1235;
            --ink: #1f1235;
            --muted: #6b6480;
            --card-back: #b794f4;
            --card-face: #fff9ee;
            --accent: var(--skyjo-purple);
            --danger: #b91c1c;
            --shadow: 0 12px 30px rgba(0,0,0,.28);
        }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            min-height: 100vh;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            color: var(--text);
            background:
                radial-gradient(circle at 12% 8%, rgba(236,72,153,.32) 0, transparent 42%),
                radial-gradient(circle at 88% 12%, rgba(6,182,212,.32) 0, transparent 42%),
                radial-gradient(circle at 50% 100%, rgba(132,204,22,.22) 0, transparent 52%),
                radial-gradient(circle at top, #6d28d9 0, var(--bg) 58%, #1a0a3a 100%);
            background-attachment: fixed;
        }
        button, input { font: inherit; }
        .wrap {
            width: min(1220px, calc(100vw - 28px));
            margin: 0 auto;
            padding: 22px 0 32px;
        }
        .top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 18px;
        }
        h1 {
            margin: 0;
            color: white;
            letter-spacing: .04em;
            text-shadow: 0 2px 8px rgba(0,0,0,.25);
        }
        .panel {
            background: var(--panel);
            border: 1px solid rgba(255,255,255,.5);
            border-radius: 22px;
            box-shadow: var(--shadow);
            padding: 18px;
        }
        .menu { max-width: 1040px; margin: 36px auto; }
        .menu h2 { margin: 0; }
        .menu-head {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 18px;
            margin-bottom: 18px;
        }
        .menu-head .hint { margin: 6px 0 0; max-width: 700px; }
        .menu-shell {
            display: grid;
            grid-template-columns: 280px minmax(0, 1fr);
            gap: 16px;
            align-items: stretch;
        }
        .mode-list {
            display: grid;
            gap: 10px;
            align-content: start;
        }
        .mode-choice {
            width: 100%;
            border: 1px solid rgba(124,58,237,.16);
            border-radius: 18px;
            padding: 14px;
            background: rgba(255,255,255,.76);
            color: var(--text);
            text-align: left;
            cursor: pointer;
            transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
        }
        .mode-choice:hover { transform: translateY(-1px); border-color: rgba(124,58,237,.34); }
        .mode-choice.active {
            background: #7c3aed;
            color: white;
            border-color: #7c3aed;
            box-shadow: 0 10px 24px rgba(124,58,237,.24);
        }
        .mode-choice strong { display: block; font-size: 1.06rem; }
        .mode-choice small { display: block; margin-top: 3px; color: inherit; opacity: .78; }
        .config-panel {
            min-height: 325px;
            padding: 18px;
            border-radius: 20px;
            border: 1px solid rgba(124,58,237,.14);
            background: rgba(255,255,255,.82);
        }
        .mode-config { display: none; }
        .mode-config.active { display: block; }
        .mode-config h3 { margin: 0 0 4px; color: #5b21b6; font-size: 1.32rem; }
        .mode-config > .hint { margin: 0 0 16px; }
        .name-grid { display: grid; gap: 10px; margin: 10px 0 16px; }
        .field-row { display: grid; gap: 6px; }
        .field-help { color: var(--muted); font-size: .88rem; font-weight: 600; }
        .menu-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
        .remote-switch {
            display: inline-flex;
            gap: 4px;
            padding: 4px;
            border-radius: 14px;
            background: rgba(124,58,237,.08);
            margin: 4px 0 14px;
        }
        .remote-switch button {
            border: 0;
            border-radius: 10px;
            padding: 9px 12px;
            background: transparent;
            color: #5b21b6;
            font-weight: 800;
            cursor: pointer;
        }
        .remote-switch button.active {
            background: white;
            box-shadow: 0 4px 12px rgba(124,58,237,.16);
        }
        .remote-pane { display: none; }
        .remote-pane.active { display: block; }
        .compact-note {
            margin-top: 16px;
            padding: 12px 14px;
            border-radius: 16px;
            background: rgba(124,58,237,.06);
            color: var(--muted);
            line-height: 1.4;
        }
        label { font-weight: 700; color: #1d2a23; }
        label input { margin-top: 4px; }
        input, select {
            width: 100%;
            border: 1px solid #cbd5df;
            border-radius: 12px;
            padding: 11px 12px;
            background: #fff;
        }
        .name-grid.dynamic { margin-top: 12px; }
        .setup-tabs {
            display: flex;
            gap: 8px;
            margin-top: 14px;
            flex-wrap: wrap;
        }
        .setup-tab {
            border: 1px solid rgba(124,58,237,.16);
            background: rgba(255,255,255,.64);
            color: var(--ink);
            border-radius: 999px;
            padding: 10px 15px;
            font-weight: 900;
            cursor: pointer;
        }
        .setup-tab.active {
            background: #7c3aed;
            color: white;
            border-color: #7c3aed;
        }
        .setup-pane { display: none; }
        .setup-pane.active { display: block; }
        .setup-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
            gap: 22px;
            align-items: start;
        }
        .lobby-head {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            gap: 14px;
            flex-wrap: wrap;
            margin-top: 6px;
        }
        .lobby-head h3 { margin: 0 0 4px; }
        .lobby-head .hint { margin: 0; max-width: 540px; }
        .lobby-summary {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 12px;
        }
        .lobby-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 11px;
            border-radius: 999px;
            font-weight: 800;
            font-size: .8rem;
            background: rgba(124,58,237,.08);
            color: #5b21b6;
            line-height: 1.1;
        }
        .lobby-chip .chip-dot {
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: currentColor;
            opacity: .55;
        }
        .lobby-chip[data-type="local"]  { background: rgba(6,182,212,.16);  color: var(--skyjo-cyan-dark); }
        .lobby-chip[data-type="remote"] { background: rgba(124,58,237,.16); color: var(--skyjo-purple-dark); }
        .lobby-chip[data-type="ai"]     { background: rgba(236,72,153,.16); color: var(--skyjo-pink-dark); }
        .lobby-chip.is-warning { background: #fff1d2; color: #8a5500; }
        .lobby {
            display: grid;
            gap: 10px;
            margin-top: 14px;
        }
        .lobby-player {
            --slot-tint: var(--skyjo-cyan);
            --slot-bg: rgba(6,182,212,.14);
            display: grid;
            grid-template-columns: 56px 1fr auto;
            gap: 14px;
            align-items: center;
            padding: 12px 14px;
            border-radius: 18px;
            background: #fff;
            border: 1px solid rgba(124,58,237,.14);
            box-shadow: 0 1px 0 rgba(0,0,0,.04);
            position: relative;
            transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
        }
        .lobby-player:hover {
            border-color: var(--slot-tint);
            box-shadow: 0 6px 18px rgba(0,0,0,.08);
        }
        .lobby-player[data-type="local"]  { --slot-tint: var(--skyjo-cyan);   --slot-bg: rgba(6,182,212,.14); }
        .lobby-player[data-type="remote"] { --slot-tint: var(--skyjo-purple); --slot-bg: rgba(124,58,237,.14); }
        .lobby-player[data-type="ai"]     { --slot-tint: var(--skyjo-pink);   --slot-bg: rgba(236,72,153,.14); }
        .player-avatar {
            width: 52px;
            height: 52px;
            border-radius: 16px;
            display: grid;
            place-items: center;
            background: var(--slot-bg);
            color: var(--slot-tint);
            position: relative;
            font-weight: 900;
        }
        .player-avatar svg { width: 26px; height: 26px; }
        .player-slot {
            position: absolute;
            top: -7px;
            left: -7px;
            background: var(--slot-tint);
            color: #fff;
            border-radius: 999px;
            min-width: 22px;
            height: 22px;
            padding: 0 6px;
            display: grid;
            place-items: center;
            font-size: .72rem;
            font-weight: 900;
            box-shadow: 0 2px 8px rgba(0,0,0,.18);
        }
        .player-main {
            display: grid;
            gap: 8px;
            min-width: 0;
        }
        .player-type-toggle {
            display: inline-flex;
            gap: 0;
            padding: 3px;
            border-radius: 999px;
            background: rgba(124,58,237,.07);
            align-self: start;
            max-width: 100%;
            flex-wrap: nowrap;
        }
        .player-type-toggle button {
            border: 0;
            background: transparent;
            color: #4a5a6e;
            font-weight: 800;
            font-size: .78rem;
            padding: 6px 12px;
            border-radius: 999px;
            cursor: pointer;
            white-space: nowrap;
            transition: background .12s ease, color .12s ease, box-shadow .12s ease;
        }
        .player-type-toggle button:hover:not([aria-pressed="true"]) { color: #7c3aed; }
        .player-type-toggle button[aria-pressed="true"] {
            background: #fff;
            color: var(--slot-tint);
            box-shadow: 0 2px 8px rgba(0,0,0,.1);
        }
        .player-name-input {
            border: 1px solid transparent;
            background: rgba(124,58,237,.05);
            border-radius: 12px;
            padding: 10px 12px;
            font-weight: 800;
            color: var(--ink);
            width: 100%;
            transition: background .12s ease, border-color .12s ease;
        }
        .player-name-input:focus {
            background: #fff;
            border-color: var(--slot-tint);
            outline: none;
        }
        .player-actions {
            display: inline-flex;
            gap: 4px;
            align-items: center;
        }
        .icon-button {
            border: 1px solid rgba(124,58,237,.16);
            background: #fff;
            color: #4a5a6e;
            width: 32px;
            height: 32px;
            border-radius: 10px;
            padding: 0;
            display: grid;
            place-items: center;
            cursor: pointer;
            transition: color .12s ease, border-color .12s ease, background .12s ease, transform .12s ease;
        }
        .icon-button:hover:not(:disabled) {
            color: #7c3aed;
            border-color: #7c3aed;
            transform: translateY(-1px);
        }
        .icon-button:disabled { opacity: .35; cursor: not-allowed; }
        .icon-button.is-danger:hover:not(:disabled) {
            color: #8c1b1b;
            border-color: #8c1b1b;
        }
        .icon-button svg { width: 14px; height: 14px; }
        .lobby-add {
            display: grid;
            gap: 10px;
            padding: 14px 14px 16px;
            border-radius: 18px;
            border: 2px dashed rgba(124,58,237,.2);
            background: rgba(124,58,237,.025);
            margin-top: 8px;
        }
        .lobby-add-title {
            font-size: .82rem;
            font-weight: 900;
            letter-spacing: .5px;
            text-transform: uppercase;
            color: #4a5a6e;
        }
        .lobby-add-row {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }
        .lobby-add-row button {
            --btn-color: #7c3aed;
            --btn-bg: rgba(124,58,237,.04);
            border: 1px solid rgba(124,58,237,.16);
            background: #fff;
            border-radius: 14px;
            padding: 12px 8px;
            cursor: pointer;
            display: grid;
            gap: 4px;
            place-items: center;
            color: var(--ink);
            font-weight: 800;
            font-size: .9rem;
            transition: transform .12s ease, border-color .12s ease, color .12s ease, background .12s ease;
        }
        .lobby-add-row button:hover:not(:disabled) {
            transform: translateY(-1px);
            border-color: var(--btn-color);
            color: var(--btn-color);
            background: var(--btn-bg);
        }
        .lobby-add-row button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
        .lobby-add-row button[data-type="local"]  { --btn-color: var(--skyjo-cyan-dark);   --btn-bg: rgba(6,182,212,.10); }
        .lobby-add-row button[data-type="remote"] { --btn-color: var(--skyjo-purple-dark); --btn-bg: rgba(124,58,237,.10); }
        .lobby-add-row button[data-type="ai"]     { --btn-color: var(--skyjo-pink-dark);   --btn-bg: rgba(236,72,153,.10); }
        .lobby-add-row svg { width: 20px; height: 20px; }
        .start-strip {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 12px;
            align-items: center;
            margin-top: 16px;
            padding: 14px 16px;
            border-radius: 18px;
            background: #7c3aed;
            color: #fff;
        }
        .start-strip-info {
            display: grid;
            gap: 2px;
            min-width: 0;
        }
        .start-strip-info strong { font-size: 1.02rem; font-weight: 900; }
        .start-strip-info small { opacity: .85; font-size: .82rem; line-height: 1.25; }
        .start-strip .primary {
            background: #fff;
            color: #7c3aed;
            box-shadow: 0 4px 14px rgba(0,0,0,.15);
        }
        .start-strip .primary:hover { background: #f5f0ff; color: #4c1d95; }
        .join-card {
            display: grid;
            gap: 12px;
            padding: 18px;
            border-radius: 20px;
            background: rgba(124,58,237,.05);
            border: 1px solid rgba(124,58,237,.12);
            position: sticky;
            top: 18px;
            transition: box-shadow .4s ease, background .4s ease, border-color .4s ease;
        }
        .join-card.highlighted {
            background: rgba(124,58,237,.12);
            border-color: rgba(124,58,237,.45);
            box-shadow: 0 0 0 4px rgba(124,58,237,.18);
        }
        .join-card h3 { margin: 0; }
        .code-input {
            font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
            letter-spacing: .25em;
            text-transform: uppercase;
            text-align: center;
            font-size: 1.18rem;
            font-weight: 900;
            padding: 14px 12px;
            background: #fff;
        }
        .code-input::placeholder { letter-spacing: .15em; opacity: .45; }
        .slot-tag {
            justify-self: start;
            font-size: .72rem;
            font-weight: 900;
            letter-spacing: .6px;
            text-transform: uppercase;
            padding: 4px 10px;
            border-radius: 999px;
            background: rgba(124,58,237,.16);
            color: var(--skyjo-purple-dark);
        }
        .primary, .secondary, .danger-btn {
            border: 0;
            border-radius: 14px;
            padding: 12px 14px;
            cursor: pointer;
            font-weight: 800;
            transition: transform .12s ease, filter .12s ease, opacity .12s ease;
        }
        .primary:hover, .secondary:hover, .danger-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
        button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; filter: none !important; }
        .primary { background: #7c3aed; color: white; }
        .secondary { background: #ede5fa; color: #1f1235; }
        .danger-btn { background: #8c1b1b; color: white; }
        .status {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 14px;
            height: 280px;
            min-height: 280px;
            overflow: hidden;
        }
        .status-copy {
            flex: 1 1 560px;
            min-width: 0;
            display: grid;
            grid-template-rows: 2.7em 42px 42px 42px auto;
            align-content: start;
        }
        .message-slot {
            min-height: 2.7em;
            display: flex;
            align-items: flex-start;
        }
        .message {
            font-weight: 900;
            color: #5b21b6;
            line-height: 1.35;
        }
        .status-line-slot {
            min-height: 42px;
            display: flex;
            align-items: flex-start;
        }
        .status-line-slot.is-empty { visibility: hidden; }
        .thinking {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
            padding: 7px 10px;
            border-radius: 999px;
            background: rgba(124,58,237,.09);
            color: #5b21b6;
            font-weight: 800;
        }
        .thinking::before {
            content: '';
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #5b21b6;
            animation: pulse 1s infinite ease-in-out;
        }
        @keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
        .meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .95rem; }

        .table-shell {
            position: relative;
            min-height: 860px;
            overflow: hidden;
            padding: 18px;
        }
        .table-surface {
            position: relative;
            width: min(1184px, 100%);
            height: 820px;
            margin: 0 auto;
            border-radius: 48% / 42%;
            background:
                radial-gradient(circle at 22% 18%, rgba(236,72,153,.22), transparent 38%),
                radial-gradient(circle at 80% 78%, rgba(6,182,212,.22), transparent 40%),
                radial-gradient(circle at 50% 50%, rgba(255,255,255,.10), transparent 52%),
                linear-gradient(145deg, #5b21b6, #2e1065 70%, #1a0a3a);
            box-shadow:
                inset 0 0 0 14px rgba(28,8,68,.7),
                inset 0 0 0 18px rgba(255,255,255,.08),
                0 24px 48px rgba(0,0,0,.32);
        }
        .table-surface::before {
            content: '';
            position: absolute;
            inset: 38px;
            border-radius: inherit;
            border: 2px solid rgba(255,255,255,.12);
            pointer-events: none;
        }
        .seat-slot {
            position: absolute;
            left: var(--seat-x);
            top: var(--seat-y);
            transform: translate(-50%, -50%) rotate(var(--seat-rot));
            transform-origin: center;
            z-index: 2;
        }
        .seat-slot.anchor-seat { z-index: 3; }
        .table-center {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            z-index: 4;
        }
        .count-many .player {
            width: 272px;
            min-width: 272px;
            max-width: 272px;
        }
        .count-many .grid { grid-template-columns: repeat(4, 52px); gap: 7px; }
        .count-many .card, .count-many .small-card { width: 52px; height: 76px; font-size: 1.4rem; }
        .count-many .player h2 { font-size: 1rem; }
        .count-many .ai-info, .count-many .player-subline { font-size: .74rem; }
        .count-crowded .player {
            width: 208px;
            min-width: 208px;
            max-width: 208px;
            padding: 10px;
        }
        .count-crowded .grid { grid-template-columns: repeat(4, 40px); gap: 5px; }
        .count-crowded .card, .count-crowded .small-card { width: 40px; height: 58px; border-width: 2px; font-size: 1.08rem; border-radius: 9px; }
        .count-crowded .player h2 { font-size: .82rem; margin-bottom: 7px; }
        .count-crowded .ai-info, .count-crowded .player-subline { font-size: .62rem; margin: -3px 0 6px; }
        .count-crowded .score { white-space: nowrap; }
        .player {
            width: 360px;
            min-width: 360px;
            max-width: 360px;
            box-sizing: border-box;
            transition: outline .18s ease, transform .18s ease;
        }
        .player.active { outline: 4px solid rgba(124,58,237,.22); }
        .player.opponent { opacity: .95; }
        .player h2 { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 12px; font-size: 1.25rem; }
        .score { color: #5b21b6; }
        .ai-info {
            min-height: 1.25em;
            margin: -6px 0 10px;
            color: var(--muted);
            font-size: .88rem;
            font-weight: 700;
            white-space: nowrap;
        }
        .player-subline {
            min-height: 1.25em;
            margin: -6px 0 10px;
            color: var(--muted);
            font-size: .88rem;
            font-weight: 700;
            white-space: nowrap;
        }
        .player h2 span:first-child,
        .ai-info,
        .player-subline {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .grid { display: grid; grid-template-columns: repeat(4, 72px); gap: 10px; justify-content: center; }
        .card {
            width: 72px;
            height: 104px;
            border-radius: 12px;
            border: 3px solid #111;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 900;
            cursor: default;
            user-select: none;
            box-shadow: 0 7px 15px rgba(0,0,0,.18);
            transition: transform .15s ease, filter .15s ease;
        }
        .card.clickable { cursor: pointer; }
        .card.clickable:hover { transform: translateY(-2px); filter: brightness(1.04); }
        .card.removed {
            visibility: hidden;
            border: 0;
            box-shadow: none;
            pointer-events: none;
        }
        .hidden {
            background:
                radial-gradient(circle at 50% 50%, rgba(255,255,255,.18), transparent 65%),
                conic-gradient(from -45deg at 50% 50%,
                    #a855f7 0deg,
                    #06b6d4 90deg,
                    #facc15 180deg,
                    #ef4444 270deg,
                    #a855f7 360deg);
            color: #fff;
            text-shadow: 0 1px 3px rgba(0,0,0,.55), 0 0 6px rgba(0,0,0,.35);
        }
        .face { background: var(--card-face); }
        .val-neg { color: #005cff; }
        .val-mid { color: #d48300; }
        .val-high { color: #c41313; }
        .center-zone {
            grid-column: 2;
            grid-row: 1 / 4;
            justify-self: center;
            align-self: center;
            display: grid;
            gap: 12px;
            justify-items: center;
            min-width: 220px;
        }
        .center-zone.training-center {
            min-width: 0;
            padding: 16px;
        }
        .training-controls-panel {
            margin-bottom: 18px;
            display: grid;
            gap: 12px;
        }
        .training-controls-panel .cvc-controls {
            width: 100%;
            grid-template-columns: minmax(280px, 1.35fr) minmax(330px, 1.25fr) minmax(220px, .8fr);
            align-items: center;
            column-gap: 14px;
        }
        .training-controls-panel .timeline-state {
            text-align: left;
        }
        .training-controls-panel .timeline-controls {
            grid-column: 2;
        }
        .training-controls-panel .archive-training-note {
            grid-column: 1 / -1;
        }
        .training-controls-panel .step-speed,
        .training-controls-panel .training-toggle {
            align-self: stretch;
        }
        .training-controls-panel .training-secondary-row {
            display: grid;
            grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
            gap: 12px;
        }
        .training-controls-panel .round-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            align-items: center;
            min-height: 0;
            margin: 0;
        }
        .pile-board {
            display: grid;
            gap: 10px;
            justify-items: center;
            transition: transform .25s ease;
            transform-origin: center;
        }
        .center-zone .pile-board { transform: rotate(var(--pile-rotation, 0deg)); }
        .pile-row { display: flex; gap: 12px; align-items: center; justify-content: center; }
        .pile-label { text-align: center; font-size: .9rem; color: var(--muted); margin-top: 6px; }
        .small-card { width: 72px; height: 104px; }
        .taken {
            text-align: center;
            padding: 12px;
            border-radius: 16px;
            background: #f6f9fc;
            border: 1px dashed #aab7c5;
        }
                .taken-slot {
            min-height: 152px;
            display: grid;
            place-items: center;
            width: 100%;
        }
        .taken-slot.is-empty {
            visibility: hidden;
        }
        .actions {
            min-height: 46px;
            display: flex;
            align-items: center;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
            margin-top: 14px;
        }
        .cvc-controls {
            width: min(320px, 100%);
            display: grid;
            gap: 9px;
            justify-items: stretch;
        }
        .timeline-state {
            padding: 9px 11px;
            border-radius: 14px;
            background: rgba(124,58,237,.06);
            border: 1px solid rgba(124,58,237,.12);
            color: #5b21b6;
            font-size: .92rem;
            font-weight: 900;
            text-align: center;
            font-variant-numeric: tabular-nums;
        }
        .timeline-controls {
            display: grid;
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 6px;
        }
        .timeline-controls button {
            min-height: 43px;
            padding-inline: 8px;
            font-size: .88rem;
        }
        .step-speed {
            display: grid;
            gap: 5px;
            padding: 10px 11px;
            border-radius: 14px;
            background: rgba(124,58,237,.06);
            border: 1px solid rgba(124,58,237,.12);
        }
        .training-toggle {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 11px;
            border-radius: 14px;
            background: rgba(124,58,237,.06);
            border: 1px solid rgba(124,58,237,.12);
            color: #5b21b6;
            font-size: .92rem;
            font-weight: 800;
            cursor: pointer;
            user-select: none;
        }
        .training-toggle input {
            width: 18px;
            height: 18px;
            margin: 0;
            accent-color: var(--blue);
        }
        .training-toggle small {
            margin-left: auto;
            color: var(--muted);
            font-weight: 700;
        }
        .archive-training-note {
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(43, 108, 176, .08);
            color: var(--ink);
            font-size: .92rem;
        }

        .step-speed-head {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: 10px;
            color: #5b21b6;
            font-size: .92rem;
            font-weight: 800;
        }
        .step-speed-value { font-variant-numeric: tabular-nums; }
        .step-speed input[type="range"] {
            width: 100%;
            padding: 0;
            accent-color: #7c3aed;
        }
        .hint { color: var(--muted); line-height: 1.45; }
        .error { color: #8c1b1b; font-weight: 800; min-height: 1.4em; margin-top: 10px; }
        .shuffle-notice, .column-notice {
            margin-top: 8px;
            padding: 8px 10px;
            border-radius: 12px;
            background: rgba(255,255,255,.72);
            color: #5b21b6;
            font-weight: 800;
            border: 1px solid rgba(124,58,237,.18);
        }
        .modal-overlay {
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,.26);
            opacity: 0;
            pointer-events: none;
            transition: opacity .18s ease;
            z-index: 50;
        }
        .modal-overlay.visible { opacity: 1; pointer-events: auto; }
        .modal-box {
            min-width: min(360px, calc(100vw - 40px));
            max-width: min(520px, calc(100vw - 40px));
            padding: 24px;
            border-radius: 24px;
            background: rgba(255,255,255,.96);
            color: #5b21b6;
            box-shadow: 0 22px 60px rgba(0,0,0,.28);
            border: 1px solid rgba(255,255,255,.74);
            text-align: center;
            font-size: 1.35rem;
            font-weight: 900;
            transform: translateY(6px) scale(.98);
            transition: transform .18s ease;
        }
        .modal-overlay.visible .modal-box { transform: translateY(0) scale(1); }

        .wave-dots {
            display: inline-flex;
            gap: 1px;
            margin-left: .16em;
            vertical-align: baseline;
        }
        .wave-dots span {
            display: inline-block;
            animation: dotWave .9s infinite ease-in-out;
            will-change: transform, opacity;
        }
        .wave-dots span:nth-child(2) { animation-delay: .12s; }
        .wave-dots span:nth-child(3) { animation-delay: .24s; }
        @keyframes dotWave {
            0%, 65%, 100% { transform: translateY(0); opacity: .62; }
            32% { transform: translateY(-.32em); opacity: 1; }
        }
        .modal-sub {
            margin-top: 8px;
            color: var(--muted);
            font-size: .95rem;
            font-weight: 700;
        }
        .room-code { font-weight: 900; letter-spacing: .18em; color: #5b21b6; }
        code { background: rgba(124,58,237,.08); padding: 2px 5px; border-radius: 6px; }

        @media (max-width: 980px) {
            .status {
                height: auto;
                min-height: 208px;
                overflow: visible;
            }
            .menu-shell { grid-template-columns: 1fr; }
            .mode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .table-shell { min-height: 760px; overflow: auto; }
            .table-surface { width: 980px; height: 720px; }
            .training-controls-panel .cvc-controls { grid-template-columns: 1fr; }
            .training-controls-panel .timeline-controls { grid-column: auto; }
            .training-controls-panel .training-secondary-row { grid-template-columns: 1fr; }
        }
        @media (max-width: 760px) {
            .join-card { position: static; }
        }
        @media (max-width: 600px) {
            .lobby-player {
                grid-template-columns: 48px 1fr;
                grid-template-areas:
                    "avatar main"
                    "actions actions";
                row-gap: 10px;
            }
            .player-avatar { grid-area: avatar; width: 46px; height: 46px; border-radius: 14px; }
            .player-avatar svg { width: 22px; height: 22px; }
            .player-main { grid-area: main; }
            .player-actions { grid-area: actions; justify-self: end; }
            .lobby-add-row { grid-template-columns: 1fr; }
            .start-strip { grid-template-columns: 1fr; }
            .start-strip .primary { justify-self: stretch; }
        }
        @media (max-width: 520px) {
            .menu-head { flex-direction: column; }
            .timeline-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .mode-list { grid-template-columns: 1fr; }
            .player { min-width: 0; width: 100%; max-width: 100%; }
            .grid { grid-template-columns: repeat(4, 58px); gap: 7px; }
            .card, .small-card { width: 58px; height: 84px; font-size: 1.55rem; }
            .panel { padding: 12px; }
        }
