:root {
    --bg: #090b10;
    --panel: #121722;
    --stage-bg: linear-gradient(180deg, #0d1118 0%, #151b27 55%, #10151f 100%);
    --text: #f3f6fb;
    --muted: #8d9bb0;
    --in: #22c55e;
    --in-soft: rgba(34, 197, 94, 0.18);
    --out: #ef4444;
    --out-soft: rgba(239, 68, 68, 0.18);
    --line: rgba(255, 255, 255, 0.08);
    --accent: #3b82f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.control-panel {
    padding: 24px 20px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.panel-head h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.back-link {
    color: #93c5fd;
    text-decoration: none;
    font-size: 14px;
}

.field {
    display: block;
    margin-top: 18px;
}

.field span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.field select,
.btn {
    width: 100%;
    border: 1px solid var(--line);
    background: #0f131b;
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.actions {
    display: grid;
    gap: 10px;
}

.btn {
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-secondary {
    color: #dbeafe;
}

.tips {
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.stage-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.stage {
    width: min(420px, 100%);
    aspect-ratio: 9 / 16;
    background: var(--stage-bg);
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.stage-header {
    padding: 28px 22px 16px;
    text-align: center;
}

.stage-date {
    font-size: 15px;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.stage-title {
    margin-top: 8px;
    font-size: 24px;
    font-weight: 700;
}

.stage-clock {
    margin-top: 10px;
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.board {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    padding: 0 18px 12px;
    min-height: 0;
}

.board-col {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.board-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.in {
    background: var(--in);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.dot.out {
    background: var(--out);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.rank-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.rank-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.rank-index {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.rank-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-bar-wrap {
    grid-column: 2 / 4;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.rank-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 80ms linear;
}

.rank-bar.in {
    background: linear-gradient(90deg, #15803d, #4ade80);
}

.rank-bar.out {
    background: linear-gradient(90deg, #b91c1c, #f87171);
}

.rank-value {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rank-value.in {
    color: #86efac;
}

.rank-value.out {
    color: #fca5a5;
}

.rank-empty {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 18px 0;
}

.stage-footer {
    padding: 12px 18px 20px;
}

.progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 999px;
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
}

body.record-mode .control-panel {
    display: none;
}

body.record-mode .workspace {
    grid-template-columns: 1fr;
}

body.record-mode .stage-wrap {
    padding: 0;
    min-height: 100vh;
}

body.record-mode .stage {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}

@media (max-width: 960px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .control-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}
