﻿:root {
    color-scheme: dark;
    --panel: rgba(8, 20, 38, 0.84);
    --line: rgba(255, 255, 255, 0.16);
    --text: #f6fbff;
    --muted: #b6c7d8;
    --accent: #52e2ff;
    --green: #7df7b9;
    --danger: #ff6b7f;
    --warn: #ffd166;
    --game-width: 1316px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    padding: 12px;
    color: var(--text);
    font-family: Arial, "Noto Sans KR", sans-serif;
    background:
        radial-gradient(circle at 18% 16%, rgba(82, 226, 255, 0.16), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(125, 247, 185, 0.1), transparent 24%),
        linear-gradient(180deg, #06101e 0%, #11172f 54%, #050917 100%);
}

.shell {
    width: min(1560px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 12px;
}

.topbar,
.rooms-view,
.lobby-view,
.game-view {
    width: min(var(--game-width), 100%);
    justify-self: center;
}

.panel,
.room-card,
.slot,
.info-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.3);
}

.panel { padding: 18px; }
.topbar,
.panel-head,
.stats-row,
.info-row,
.room-meta,
.slot-head,
.buttons {
    display: flex;
}

.topbar,
.panel-head {
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topbar h1,
.panel h2,
.panel h3,
p { margin: 0; }
.topbar h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1; }
.topbar p,
.muted,
.room-card p,
.slot p,
.section p,
.section li { color: var(--muted); line-height: 1.6; }
.topbar p {
    font-size: 14px;
}
.top-actions,
.head-actions,
.buttons { flex-wrap: wrap; gap: 10px; }
.buttons.left { justify-content: flex-start; }

button,
a.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #03111c;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

button.secondary,
a.button.secondary {
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

button.danger { background: var(--danger); color: #26070d; }
.rooms-view,
.lobby-view {
    display: grid;
    gap: 10px;
    padding: 14px;
}
.room-list,
.slot-list { display: grid; gap: 12px; }
.room-card,
.slot,
.info-card { padding: 12px; }
.room-card,
.slot { padding: 14px; }
.room-card { display: grid; gap: 10px; }
.room-card h3,
.slot h3 { margin: 0; font-size: 20px; }
.room-meta,
.stats-row { gap: 12px; flex-wrap: wrap; }
.chip,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.chip.ok { color: var(--green); }
.chip.warn { color: var(--warn); }
.empty-message { margin: 0; color: var(--muted); }
.room-list {
    max-height: min(30vh, 280px);
    overflow: auto;
    padding-right: 4px;
}
.lobby-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(240px, 300px);
    gap: 12px;
    max-height: min(31vh, 300px);
    overflow: auto;
    padding-right: 4px;
}
.slot-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.slot { display: grid; gap: 8px; min-height: 118px; }
.slot-head { align-items: center; justify-content: space-between; }
.info-card { display: grid; gap: 8px; }
.info-row { align-items: center; justify-content: space-between; gap: 12px; }
.compact-guide p {
    font-size: 13px;
    line-height: 1.6;
}
.game-view {
    display: grid;
    grid-template-columns: minmax(360px, 460px) minmax(260px, 360px) minmax(360px, 460px);
    gap: 18px;
    align-items: start;
}
.board-panel,
.center-panel { display: grid; gap: 14px; }
.section {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: rgba(255,255,255,0.04);
}
.section p {
    line-height: 1.65;
}
.section h3 {
    margin-bottom: 2px;
}
.panel-head.slim { margin-bottom: 4px; }
.mini-stat {
    flex: 1 1 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
}
.mini-stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.mini-stat strong { display: block; margin-top: 6px; font-size: 22px; }
canvas {
    display: block;
    width: 100%;
    border-radius: 6px;
    background: #060b16;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
#board,
#opponentBoard { aspect-ratio: 1 / 2; }
#next { width: 156px; height: 156px; }
.overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(3, 8, 18, 0.78);
    backdrop-filter: blur(8px);
}
.overlay[hidden] { display: none; }
.overlay-card {
    width: min(360px, 100%);
    display: grid;
    gap: 12px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 20, 38, 0.96);
    text-align: center;
}
.overlay-title { font-size: 28px; font-weight: 900; }
.overlay-text { color: var(--muted); line-height: 1.6; }
.start-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 30;
    min-width: 220px;
    padding: 18px 26px;
    border: 1px solid rgba(82, 226, 255, 0.42);
    border-radius: 999px;
    background: rgba(5, 16, 30, 0.92);
    color: var(--text);
    font-size: clamp(22px, 4vw, 36px);
    font-weight: 900;
    text-align: center;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.start-flash[hidden] {
    display: none;
}
.key {
    display: inline-flex;
    min-width: 34px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font-weight: 800;
}
ul { margin: 0; padding-left: 18px; }
@media (max-width: 1120px) {
    .game-view { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .lobby-grid { grid-template-columns: 1fr; }
    .slot-list { grid-template-columns: 1fr; }
    .lobby-grid {
        max-height: none;
    }
}
@media (max-width: 640px) {
    body { padding: 10px; }
    .topbar,
    .panel-head { align-items: start; flex-direction: column; }
}
