﻿:root {
    --chess-bg:
        radial-gradient(circle at top, rgba(245, 158, 11, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.14), transparent 24%),
        linear-gradient(180deg, #07101e 0%, #0a1526 42%, #08111d 100%);
    --chess-card: rgba(9, 18, 31, 0.9);
    --chess-card-soft: rgba(15, 28, 46, 0.88);
    --chess-line: rgba(255, 219, 164, 0.18);
    --chess-accent: #f6c46c;
    --chess-accent-strong: #ff9d2f;
    --chess-mint: #7be5c0;
    --chess-danger: #ff7e70;
    --chess-text: #f5f7fb;
    --chess-sub: #9fb0c4;
    --chess-board-light: linear-gradient(180deg, #f5ecd6 0%, #e7d6b6 100%);
    --chess-board-dark: linear-gradient(180deg, #ac7a4f 0%, #8a5d39 100%);
    --chess-board-line: rgba(15, 23, 42, 0.18);
    --chess-frame: linear-gradient(180deg, #182230 0%, #0f1826 100%);
    --chess-frame-glow: rgba(246, 196, 108, 0.2);
    --chess-turn-bg: linear-gradient(135deg, rgba(246, 196, 108, 0.22), rgba(255, 157, 47, 0.18));
    --chess-turn-line: rgba(246, 196, 108, 0.36);
    --chess-turn-text: #fff2cf;
    --chess-shadow: 0 24px 60px rgba(2, 6, 23, 0.36);
    --chess-radius-lg: 28px;
    --chess-radius-md: 22px;
}

body.chess-page[data-board-theme="midnight"] {
    --chess-board-light: linear-gradient(180deg, #dfe7f6 0%, #bcc8e0 100%);
    --chess-board-dark: linear-gradient(180deg, #5b6e92 0%, #344764 100%);
    --chess-board-line: rgba(241, 245, 249, 0.14);
    --chess-frame: linear-gradient(180deg, #0d1625 0%, #09111f 100%);
    --chess-frame-glow: rgba(96, 165, 250, 0.26);
    --chess-turn-bg: linear-gradient(135deg, rgba(96, 165, 250, 0.24), rgba(45, 212, 191, 0.18));
    --chess-turn-line: rgba(96, 165, 250, 0.36);
    --chess-turn-text: #ddf4ff;
}

body.chess-page[data-board-theme="ivory"] {
    --chess-board-light: linear-gradient(180deg, #fff9ec 0%, #f2e7cd 100%);
    --chess-board-dark: linear-gradient(180deg, #ca9d68 0%, #a97749 100%);
    --chess-board-line: rgba(120, 76, 36, 0.12);
    --chess-frame: linear-gradient(180deg, #26212f 0%, #151725 100%);
    --chess-frame-glow: rgba(244, 114, 182, 0.18);
    --chess-turn-bg: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(244, 114, 182, 0.16));
    --chess-turn-line: rgba(244, 114, 182, 0.28);
    --chess-turn-text: #fff4f6;
}

body.chess-page {
    min-height: 100vh;
    margin: 0;
    color: var(--chess-text);
    background: var(--chess-bg);
    font-family: var(--font-body, "Noto Sans KR", sans-serif);
}

.chess-shell {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px 18px 48px;
}

.chess-card {
    border-radius: var(--chess-radius-lg);
    border: 1px solid var(--chess-line);
    background: var(--chess-card);
    box-shadow: var(--chess-shadow);
    overflow: hidden;
}

.chess-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(8, 16, 30, 0.92), rgba(16, 28, 46, 0.96));
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1.44rem;
    letter-spacing: -0.03em;
}

.topbar-title p {
    margin: 4px 0 0;
    color: var(--chess-sub);
    font-size: 0.92rem;
}

.chess-chip-row,
.chip-stack,
.board-head-actions,
.room-code-actions,
.invite-actions,
.action-row,
.emoji-row,
.segmented-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chess-chip,
.mini-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 219, 164, 0.16);
    background: rgba(255, 255, 255, 0.05);
    color: var(--chess-sub);
    font-size: 0.84rem;
}

.chess-chip strong,
.mini-badge strong {
    color: var(--chess-text);
}

.mini-badge {
    padding: 7px 12px;
    letter-spacing: 0.01em;
}

.chess-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.48fr) minmax(320px, 0.82fr);
    gap: 20px;
    margin-top: 20px;
}

.chess-main,
.chess-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.72fr);
    gap: 18px;
    padding: 24px;
}

.hero-copy h2 {
    margin: 0;
    font-size: clamp(1.5rem, 2.2vw, 1.95rem);
    line-height: 1.14;
    letter-spacing: -0.04em;
}

.hero-copy p,
.status-note,
.mode-block p,
.entry-main span,
.guide-panel,
.inline-status,
.invite-hint,
.player-main span {
    color: var(--chess-sub);
    line-height: 1.58;
}

.hero-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.kpi-box {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.kpi-box .label {
    color: var(--chess-sub);
    font-size: 0.82rem;
}

.kpi-box .value {
    margin-top: 8px;
    font-size: 1.5rem;
    font-weight: 800;
}

.hero-side {
    padding: 20px;
    border-radius: 22px;
    border: 1px solid rgba(246, 196, 108, 0.2);
    background: linear-gradient(180deg, rgba(246, 196, 108, 0.12), rgba(123, 229, 192, 0.08));
}

.hero-side h3,
.mode-block h3,
.mode-block h4,
.sidebar-card h3,
.board-head h2,
.room-stage-head h2,
.invite-surface h3,
.admin-overview h2 {
    margin: 0;
}

.mode-tabs {
    display: flex;
    gap: 10px;
    padding: 0 2px;
}

.mode-tab,
.btn-chess,
.segmented-row button,
.emoji-row button,
.room-code-input,
.field-box select {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--chess-text);
    border-radius: 16px;
    transition: 0.18s ease;
}

.mode-tab {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-weight: 700;
    cursor: pointer;
}

.mode-tab.active {
    color: #08101f;
    background: linear-gradient(135deg, var(--chess-accent), #ffe1a5);
    border-color: transparent;
}

.mode-panel {
    padding: 22px;
}

.mode-panel.hidden,
.hidden {
    display: none !important;
}

.online-lobby-grid,
.mode-panel-grid,
.quickstart-grid,
.field-grid,
.admin-kpis {
    display: grid;
    gap: 16px;
}

.online-lobby-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-panel-grid,
.field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quickstart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mode-block,
.sidebar-card,
.admin-block {
    padding: 20px;
    border-radius: var(--chess-radius-md);
    background: var(--chess-card-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.block-head p {
    margin: 6px 0 0;
}

.field-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--chess-sub);
    font-size: 0.84rem;
}

.field-box select,
.room-code-input {
    width: 100%;
    padding: 12px 14px;
    box-sizing: border-box;
}

.segmented-row button,
.btn-chess,
.emoji-row button {
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

.segmented-row button.active,
.btn-chess.primary,
.emoji-row button:hover,
.btn-chess:hover,
.segmented-row button:hover {
    border-color: rgba(246, 196, 108, 0.42);
    background: rgba(246, 196, 108, 0.14);
}

.btn-chess.primary {
    color: #08101f;
    background: linear-gradient(135deg, var(--chess-accent), #ffe1a5);
    border-color: transparent;
}

.btn-chess.danger:hover {
    background: rgba(255, 126, 112, 0.18);
    border-color: rgba(255, 126, 112, 0.38);
}

.segmented-row button:disabled,
.btn-chess:disabled,
.emoji-row button:disabled,
.room-code-input:disabled,
.field-box select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.join-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.inline-status {
    min-height: 1.4em;
    font-size: 0.9rem;
}

.inline-status.is-error {
    color: #fca5a5;
}

.inline-status.is-success {
    color: var(--chess-mint);
}

.public-room-block {
    margin-top: 18px;
}

.room-list {
    display: grid;
    gap: 12px;
}

.room-list .empty-state,
.move-list .empty-state,
.admin-table .empty-state {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--chess-sub);
    text-align: center;
}

.room-card,
.record-item,
.result-item,
.leader-item,
.admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
}

button.record-item,
button.result-item,
.replay-link {
    appearance: none;
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.replay-link:hover {
    border-color: rgba(246, 196, 108, 0.26);
    background: rgba(246, 196, 108, 0.08);
}

.room-card-meta,
.entry-main,
.player-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.room-card-meta strong,
.entry-main strong,
.player-main strong {
    font-size: 1rem;
}

.room-card-side,
.entry-side {
    justify-self: end;
    color: var(--chess-text);
    font-weight: 700;
    text-align: right;
}

.entry-sub {
    display: block;
    margin-top: 4px;
    color: var(--chess-sub);
    font-size: 0.82rem;
    font-weight: 600;
}

.room-stage {
    padding: 24px;
}

.room-stage-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 18px;
}

.room-stage-head h2 {
    margin-top: 10px;
    font-size: clamp(1.28rem, 2vw, 1.72rem);
}

.room-code-box {
    min-width: 260px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(246, 196, 108, 0.16);
    background: linear-gradient(180deg, rgba(246, 196, 108, 0.1), rgba(255, 255, 255, 0.03));
}

.room-code-box span,
.room-code-box strong {
    display: block;
}

.room-code-box strong,
.invite-code {
    margin-top: 8px;
    font-size: clamp(1.42rem, 2.8vw, 2rem);
    letter-spacing: 0.24em;
    text-indent: 0.24em;
}

.invite-pane {
    display: grid;
    min-height: 0;
}

.invite-surface {
    width: min(760px, 100%);
    justify-self: center;
    padding: clamp(24px, 4vw, 36px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.76), rgba(10, 18, 31, 0.9));
    text-align: center;
    box-shadow: 0 34px 70px rgba(2, 6, 23, 0.34);
}

.invite-top {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.board-card {
    padding: 22px;
}

.board-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.board-head h2 {
    margin-top: 10px;
    font-size: 1.34rem;
}

.battle-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at top right, rgba(246, 196, 108, 0.14), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
}

.battle-state,
.battle-tools {
    display: flex;
    align-items: center;
    gap: 14px;
}

.battle-state {
    min-width: 0;
    flex: 1;
}

.battle-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.battle-copy strong {
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.battle-copy span {
    color: var(--chess-sub);
    font-size: 0.9rem;
    line-height: 1.45;
}

.turn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--chess-turn-line);
    background: var(--chess-turn-bg);
    color: var(--chess-turn-text);
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.turn-pill.tone-idle {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: var(--chess-text);
}

.turn-pill.tone-my-turn {
    border-color: rgba(123, 229, 192, 0.44);
    background: linear-gradient(135deg, rgba(123, 229, 192, 0.22), rgba(18, 184, 134, 0.16));
    color: #dffef2;
}

.turn-pill.tone-enemy-turn {
    border-color: rgba(96, 165, 250, 0.4);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(59, 130, 246, 0.14));
    color: #dbeafe;
}

.turn-pill.tone-check {
    border-color: rgba(255, 126, 112, 0.5);
    background: linear-gradient(135deg, rgba(255, 126, 112, 0.24), rgba(244, 63, 94, 0.16));
    color: #ffe8e4;
}

.turn-pill.tone-ended {
    border-color: rgba(244, 114, 182, 0.38);
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.18), rgba(168, 85, 247, 0.16));
    color: #fdf2ff;
}

.theme-label {
    color: var(--chess-sub);
    font-size: 0.82rem;
    font-weight: 700;
}

.board-theme-group button {
    min-width: 72px;
    padding-inline: 12px;
}

.board-shell {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.board-frame {
    position: relative;
    width: min(100%, 760px);
    padding: 16px;
    border-radius: 30px;
    background: var(--chess-frame);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 28px 54px rgba(2, 6, 23, 0.38);
}

.board-frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 0 48px var(--chess-frame-glow);
    pointer-events: none;
}

.board-stage {
    position: relative;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.4);
}

.board-animation-layer {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    overflow: hidden;
    pointer-events: none;
}

.board-flying-piece {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 16px 18px rgba(3, 7, 18, 0.42));
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.board-square {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: transparent;
}

.board-square.light {
    background: var(--chess-board-light);
}

.board-square.dark {
    background: var(--chess-board-dark);
}

.board-square::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1px var(--chess-board-line);
    pointer-events: none;
}

.board-square.selected::before,
.board-square.last-move::before,
.board-square.in-check::before,
.board-square.legal::before {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    pointer-events: none;
}

.board-square.selected::before {
    border: 2px solid rgba(123, 229, 192, 0.95);
    box-shadow: 0 0 0 1px rgba(123, 229, 192, 0.22), inset 0 0 28px rgba(123, 229, 192, 0.1);
}

.board-square.last-move::before {
    background: rgba(246, 196, 108, 0.22);
}

.board-square.in-check::before {
    background: rgba(255, 126, 112, 0.24);
}

.board-square.legal::before {
    inset: 32%;
    border-radius: 999px;
    background: rgba(21, 32, 49, 0.32);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.06);
}

.board-square.capture-target::before {
    inset: 12%;
    border-radius: 18px;
    background: none;
    box-shadow: inset 0 0 0 3px rgba(255, 126, 112, 0.62);
}

.board-square.selected.legal::before {
    inset: 8px;
    border-radius: 16px;
    background: none;
}

.coord {
    position: absolute;
    font-size: 0.74rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0.85;
    font-family: Georgia, serif;
}

.coord.rank {
    top: 7px;
    left: 8px;
}

.coord.file {
    right: 8px;
    bottom: 6px;
}

.board-square.light .coord {
    color: rgba(92, 61, 36, 0.82);
}

.board-square.dark .coord {
    color: rgba(245, 236, 214, 0.9);
}

.piece-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 120ms ease;
}

.piece-shell.is-hidden {
    opacity: 0;
}

.piece-image,
.promotion-piece {
    width: min(78%, 68px);
    height: min(78%, 68px);
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 10px 14px rgba(8, 15, 24, 0.35));
    transition: transform 140ms ease, filter 140ms ease;
}

.board-square.has-piece:hover .piece-image {
    transform: translateY(-2px) scale(1.03);
    filter: drop-shadow(0 12px 18px rgba(8, 15, 24, 0.42));
}

.board-square.selected .piece-image {
    filter: drop-shadow(0 0 14px rgba(123, 229, 192, 0.52)) drop-shadow(0 10px 14px rgba(8, 15, 24, 0.35));
    transform: translateY(-2px) scale(1.05);
}

body.chess-page[data-board-theme="midnight"] .piece-image,
body.chess-page[data-board-theme="midnight"] .promotion-piece {
    filter: drop-shadow(0 12px 16px rgba(15, 23, 42, 0.42)) saturate(1.06);
}

body.chess-page[data-board-theme="ivory"] .piece-image,
body.chess-page[data-board-theme="ivory"] .promotion-piece {
    filter: drop-shadow(0 10px 14px rgba(60, 32, 18, 0.32)) brightness(1.04);
}

.player-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
}

.player-strip.active {
    border-color: rgba(123, 229, 192, 0.35);
    background: linear-gradient(180deg, rgba(123, 229, 192, 0.1), rgba(255, 255, 255, 0.04));
}

.player-strip.pressure {
    border-color: rgba(246, 196, 108, 0.34);
    background: linear-gradient(180deg, rgba(246, 196, 108, 0.1), rgba(255, 255, 255, 0.04));
}

.player-strip.critical {
    border-color: rgba(255, 126, 112, 0.4);
    background: linear-gradient(180deg, rgba(255, 126, 112, 0.14), rgba(255, 255, 255, 0.04));
}

.clock-box {
    min-width: 84px;
    padding: 10px 14px;
    text-align: center;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(7, 16, 30, 0.68);
    font-weight: 800;
    letter-spacing: 0.04em;
}

.clock-box.warning {
    color: #ffe4a8;
    border-color: rgba(246, 196, 108, 0.34);
    box-shadow: 0 0 18px rgba(246, 196, 108, 0.14);
}

.clock-box.critical {
    color: #ffe5e1;
    border-color: rgba(255, 126, 112, 0.42);
    box-shadow: 0 0 22px rgba(255, 126, 112, 0.16);
    animation: chess-clock-pulse 1s ease-in-out infinite;
}

.guide-panel {
    margin-top: 6px;
}

.board-actions {
    margin-top: 14px;
}

.emoji-row {
    margin-top: 14px;
}

.result-box {
    margin-top: 14px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(123, 229, 192, 0.24);
    background: linear-gradient(180deg, rgba(123, 229, 192, 0.12), rgba(255, 255, 255, 0.03));
}

.result-box-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-box-copy span {
    color: var(--chess-sub);
    line-height: 1.5;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.result-box.error {
    border-color: rgba(255, 126, 112, 0.3);
    background: linear-gradient(180deg, rgba(255, 126, 112, 0.12), rgba(255, 255, 255, 0.03));
}

.move-list {
    display: grid;
    gap: 10px;
}

.move-row {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.move-row .index {
    color: var(--chess-sub);
}

.replay-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
}

.replay-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.replay-progress {
    color: var(--chess-sub);
    font-size: 0.84rem;
    font-weight: 700;
}

.replay-row {
    align-items: stretch;
}

.move-cell {
    font: inherit;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(7, 16, 30, 0.52);
    color: var(--chess-text);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: 0.18s ease;
}

.move-cell:hover:not(:disabled) {
    border-color: rgba(246, 196, 108, 0.28);
    background: rgba(246, 196, 108, 0.1);
}

.move-cell.active {
    border-color: rgba(123, 229, 192, 0.28);
    background: rgba(123, 229, 192, 0.12);
    color: #e9fff6;
}

.move-cell:disabled {
    opacity: 0.46;
    cursor: default;
}

.leader-rank {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(246, 196, 108, 0.16);
    color: var(--chess-accent);
    font-weight: 800;
}

.sidebar-card p {
    margin: 8px 0 14px;
}

.admin-shell {
    max-width: 1440px;
    margin: 0 auto;
}

.admin-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 18px;
    padding: 22px;
}

.admin-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
}

.admin-table {
    display: grid;
    gap: 12px;
}

.admin-row {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) auto auto;
}

.promotion-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.7);
    z-index: 40;
}

.promotion-surface {
    width: min(460px, 100%);
    padding: 24px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(10, 18, 31, 0.98), rgba(14, 24, 40, 0.98));
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.4);
}

.promotion-surface h3 {
    margin: 0 0 8px;
}

.promotion-choice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.promotion-choice {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 12px 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--chess-text);
    cursor: pointer;
}

.promotion-choice:hover {
    border-color: rgba(246, 196, 108, 0.42);
    background: rgba(246, 196, 108, 0.12);
}

@keyframes chess-clock-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
}

body.chess-room-focus-active .chess-shell {
    max-width: none;
    min-height: 100dvh;
    padding: 0;
}

body.chess-room-focus-active .chess-topbar,
body.chess-room-focus-active .hero-card,
body.chess-room-focus-active .mode-tabs,
body.chess-room-focus-active .mode-panel,
body.chess-room-focus-active .chess-sidebar {
    display: none !important;
}

body.chess-room-focus-active .chess-grid {
    display: block;
    margin-top: 0;
}

body.chess-waiting-active {
    background:
        radial-gradient(circle at top, rgba(14, 165, 233, 0.22), transparent 30%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.18), transparent 26%),
        #071225;
}

body.chess-waiting-active #activeRoomSection {
    display: grid !important;
    align-content: start;
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

body.chess-match-active {
    background:
        radial-gradient(circle at top, rgba(245, 158, 11, 0.2), transparent 30%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.18), transparent 28%),
        #071225;
}

body.chess-match-active #boardCard {
    display: grid;
    grid-template-rows: auto auto auto auto auto auto auto auto;
    min-height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

body.chess-match-active #activeRoomSection {
    display: none !important;
}

body.chess-match-active .board-shell {
    min-height: 0;
    flex: 1;
    align-items: center;
}

body.chess-match-active .board-frame {
    width: min(calc(100dvw - 42px), max(320px, calc(100dvh - 300px)));
}

body.chess-browser-fullscreen .board-frame {
    width: min(calc(100dvw - 32px), max(320px, calc(100dvh - 240px)));
}

@media (max-width: 1120px) {
    .chess-grid,
    .hero-card,
    .admin-overview {
        grid-template-columns: 1fr;
    }

    .online-lobby-grid,
    .mode-panel-grid,
    .quickstart-grid,
    .admin-kpis {
        grid-template-columns: 1fr;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .board-head,
    .battle-hud,
    .room-stage-head,
    .block-head,
    .admin-row {
        grid-template-columns: 1fr;
        display: grid;
    }

    .admin-row {
        gap: 10px;
    }

    .room-code-box {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .chess-shell {
        padding: 12px 12px 28px;
    }

    .chess-topbar,
    .hero-card,
    .mode-panel,
    .board-card,
    .sidebar-card,
    .room-stage,
    .admin-overview,
    .admin-block {
        border-radius: 24px;
    }

    .topbar-title {
        align-items: flex-start;
    }

    .battle-state,
    .battle-tools {
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
    }

    .join-code-row,
    .promotion-choice-grid,
    .room-card,
    .record-item,
    .result-item,
    .leader-item {
        grid-template-columns: 1fr;
    }

    .replay-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .replay-controls {
        width: 100%;
    }

    .room-card-side,
    .entry-side {
        justify-self: start;
        text-align: left;
    }

    .board-frame {
        padding: 10px;
        border-radius: 22px;
    }

    .coord {
        font-size: 0.64rem;
    }

    body.chess-match-active #boardCard,
    body.chess-waiting-active #activeRoomSection {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    body.chess-match-active .board-frame {
        width: min(calc(100dvw - 24px), max(220px, calc(100dvh - 390px)));
    }
}
