:root {
  --bg: #faf5ee;
  --surface: #ffffff;
  --card: #f4ebdf;
  --card-strong: #efe2d0;
  --border: #ece2d4;
  --ink: #3d2e20;
  --ink-soft: #6f5d49;
  --muted: #a08b73;
  --accent: #b07d43;
  --accent-soft: #e7d6bf;
  --gold: #c69a5a;
  --track: #e6dccc;
  --ok: #7a9a5f;
  --warn: #c67b5a;
  --danger: #d1614e;
  --shadow: 0 1px 2px rgba(61, 46, 32, .06), 0 6px 20px rgba(61, 46, 32, .05);
  --radius: 14px;
  --nav-h: 56px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- App layout ---------- */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Top nav ---------- */
.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-brand { display: flex; align-items: center; gap: 10px; margin-right: 12px; }
.nav-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #8a5a2b, #b07d43);
  color: #fff; font-weight: 800; font-size: 15px;
  display: grid; place-items: center;
}
.nav-title { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.nav-tab:hover { background: #f3ece1; }
.nav-tab.active { background: var(--accent-soft); color: var(--ink); }
.nav-spacer { flex: 1; }
.nav-right { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); }
.nav-online { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(122,154,95,.18); }
.nav-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #f3ece1; font-size: 15px; border: 0; cursor: pointer; color: inherit; }
.nav-guest {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 999px; background: #f3ece1;
}
.nav-guest .av { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-size: 13px; }
.nav-guest .who { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* ---------- Main / layout with sidebar ---------- */
.main { flex: 1; display: flex; gap: 16px; padding: 18px 20px; max-width: 1440px; width: 100%; margin: 0 auto; }
.content { flex: 1; min-width: 0; }
.sidebar {
  width: 300px; flex: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-self: flex-start; position: sticky; top: calc(var(--nav-h) + 18px);
  height: calc(100dvh - var(--nav-h) - 36px);
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 2px 16px; }
.page-back { border: 0; background: #f3ece1; width: 32px; height: 32px; border-radius: 9px; font-size: 16px; color: var(--ink-soft); }
.page-back:hover { background: var(--accent-soft); }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--muted); margin-left: 4px; }

/* ---------- Welcome banner ---------- */
.banner {
  background: linear-gradient(135deg, #f6ecdd, #efe0cb);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.banner h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.banner p { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; }
.stats { display: flex; gap: 30px; }
.stat .n { font-size: 20px; font-weight: 800; color: var(--accent); }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- Section label ---------- */
.section-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 4px 2px 12px; }

/* ---------- Mode cards (lobby) ---------- */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); text-align: left; transition: transform .12s ease, background .12s;
  display: flex; flex-direction: column; gap: 10px; min-height: 150px;
}
.mode-card:hover { transform: translateY(-2px); background: var(--card-strong); }
.mode-ic { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, #a5764a, #c69a5a); color: #fff; display: grid; place-items: center; font-size: 20px; }
.mode-card h3 { margin: 0; font-size: 17px; }
.mode-card p { margin: 0; color: var(--ink-soft); font-size: 13px; flex: 1; }
.mode-cta { color: var(--accent); font-weight: 700; font-size: 13px; }

/* ---------- Game list (solo) ---------- */
.game-list { display: flex; flex-direction: column; gap: 12px; }
.game-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); text-align: left; transition: transform .12s, background .12s;
}
.game-item:hover { transform: translateY(-1px); background: var(--card-strong); }
.gi-top { display: flex; align-items: flex-start; gap: 14px; }
.gi-ic { width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.gi-body { flex: 1; min-width: 0; }
.gi-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gi-title { font-size: 16px; font-weight: 700; }
.gi-desc { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }
.gi-right { text-align: right; flex: none; }
.gi-lv { font-weight: 800; color: var(--accent); font-size: 14px; }
.gi-count { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge.rec { background: #e3ecd8; color: #5a7040; }
.badge.hi { background: #f0e0d2; color: #a5643a; }
.badge.new { background: #e5ddf0; color: #6a5a95; }
.badge.hot { background: #f7dcd2; color: #b8543c; }
.progress { margin-top: 12px; }
.progress .bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress .bar > i { display: block; height: 100%; background: linear-gradient(90deg, #b07d43, #c69a5a); }
.progress .lbl { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- Multiplayer room table ---------- */
.mp-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.mp-search { flex: 1; position: relative; }
.mp-search input {
  width: 100%; padding: 10px 12px 10px 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; color: var(--ink);
}
.mp-search::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .6; }
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px;
}
.btn:hover { background: var(--card-strong); }
.btn.primary { background: linear-gradient(135deg, #a5764a, #b07d43); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }

.rooms { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rooms table { width: 100%; border-collapse: collapse; }
.rooms th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.rooms td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.rooms tr:last-child td { border-bottom: 0; }
.rooms tbody tr:hover { background: #faf5ee; cursor: pointer; }
.room-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.state.wait { background: #e3ecd8; color: #5a7040; }
.state.play { background: #f7dcd2; color: #b8543c; }
.host { color: var(--ink-soft); }
.rooms-empty { text-align: center; color: var(--muted); padding: 28px 0 !important; cursor: default; }

/* ---------- 방 생성/참가 모달 ---------- */
.room-modal {
  background: #f1e7d5; border-radius: 20px; padding: 26px 28px 28px;
  width: 400px; max-width: calc(100vw - 32px); border: 1px solid #e6dac4;
  box-shadow: 0 24px 64px rgba(61,46,32,.32); display: flex; flex-direction: column; gap: 20px;
}
.room-modal-head { display: flex; align-items: center; justify-content: space-between; }
.room-modal-head h2 { margin: 0; font-size: 19px; }
.rm-field { display: flex; flex-direction: column; gap: 9px; }
.rm-field > label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.rm-input {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid #e7dcc7;
  background: #fdf9ee; color: var(--ink); font-size: 15px; font-weight: 600;
}
.rm-input::placeholder { color: var(--muted); font-weight: 500; }
.rm-input:focus { outline: none; border-color: var(--accent); background: #fffdf6; }
select.rm-input { appearance: none; cursor: pointer; }
.rm-upper { text-transform: uppercase; letter-spacing: .08em; }
.rm-upper::placeholder { text-transform: none; letter-spacing: normal; }
.rm-slider-label { font-size: 14px; font-weight: 800; color: var(--ink); }
.rm-slider-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rm-toggle-row { display: flex; align-items: center; justify-content: space-between; }
.rm-toggle-row > span { font-size: 15px; font-weight: 700; }
.rm-switch {
  position: relative; width: 46px; height: 26px; border-radius: 999px; border: 0;
  background: var(--track); cursor: pointer; transition: background .15s; flex: none;
}
.rm-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.rm-switch.on { background: var(--accent); }
.rm-switch.on::after { transform: translateX(20px); }
.rm-actions { display: flex; gap: 12px; margin-top: 4px; }
.rm-btn { flex: 1; padding: 15px 0; border-radius: 12px; border: 0; font-size: 15px; font-weight: 800; cursor: pointer; }
.rm-btn.ghost { background: #fdf9ee; color: var(--ink-soft); border: 1px solid #e7dcc7; }
.rm-btn.ghost:hover { background: #fffdf6; }
.rm-btn.primary { background: var(--ink); color: #fff; }
.rm-btn.primary:hover { filter: brightness(1.2); }

/* 다크 테마 — 크림 대신 어두운 톤 유지 (패널보다 입력이 밝게) */
:root[data-theme="dark"] .room-modal { background: #29231d; border-color: #3d342a; }
:root[data-theme="dark"] .rm-input { background: #352d24; border-color: #45392d; }
:root[data-theme="dark"] .rm-input:focus { background: #3d3329; }
:root[data-theme="dark"] .rm-btn.ghost { background: #352d24; border-color: #45392d; }
:root[data-theme="dark"] .rm-btn.ghost:hover { background: #3d3329; }

/* ---------- 방(대기실) 화면 ---------- */
.room-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.room-head-actions .btn { padding: 8px 16px; }
.room-gear-wrap { position: relative; }
.room-gear-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.room-gear-menu[hidden] { display: none; }
.rgm-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.room-info-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 0 2px 18px; font-size: 14px; color: var(--ink-soft);
}
.room-info-name { font-weight: 800; color: var(--ink); }
.room-info-meta { font-size: 12px; color: var(--muted); }
.room-mode-tag { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.room-slots { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.slot {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; min-height: 60px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--border);
}
.slot.me-slot { border-color: var(--accent); }
.slot .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #fff; font-weight: 700; flex: none; }
.slot-name { flex: 1; font-size: 15px; font-weight: 700; }
.slot-badge { font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 999px; background: var(--card-strong); color: var(--ink-soft); }
.slot-badge.host { background: var(--card-strong); color: var(--ink-soft); }
.slot-badge.on { background: #e3ecd8; color: #5a7040; }        /* 준비 완료 = 초록 */
.slot-badge.off { background: #f7dcd2; color: #b8543c; }       /* 대기중 = 빨강 */
.slot-badge.ready-btn { border: 0; cursor: pointer; }
.slot-badge.ready-btn:hover { filter: brightness(.97); }
.slot.empty { background: transparent; border-style: dashed; }
:root[data-theme="dark"] .slot-badge.on { background: #2e3a26; color: #a7c48a; }
:root[data-theme="dark"] .slot-badge.off { background: #3d2a24; color: #d99b86; }

/* ---------- Sidebar (chat / users) ---------- */
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.side-head .t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.side-head .c { font-size: 12px; color: var(--muted); }
.side-scroll { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-line { font-size: 13px; line-height: 1.4; }
.chat-line .u { font-weight: 700; color: var(--accent); margin-right: 4px; }
.chat-line .sys { color: var(--muted); font-style: italic; }
.user-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.user-row .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #fff; }
.user-row .me-tag { margin-left: auto; font-size: 11px; color: var(--muted); }
.side-input { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; gap: 8px; }
.side-input input { flex: 1; border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 13px; background: var(--bg); color: var(--ink); }
.side-input button { border: 0; background: var(--accent); color: #fff; width: 38px; border-radius: 9px; font-size: 15px; }

/* ---------- Spot the difference ---------- */
.sd-wrap { max-width: 980px; margin: 0 auto; }
.sd-hud { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.sd-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); }
.sd-pill .l { font-size: 11px; color: var(--muted); }
.sd-pill .v { font-size: 18px; font-weight: 800; color: var(--ink); }
.sd-pill.accent .v { color: var(--accent); }
.sd-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sd-board { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.sd-board .cap { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.sd-grid { display: grid; gap: 6px; }
.sd-cell {
  aspect-ratio: 1 / 1; border-radius: 10px; background: var(--card);
  display: grid; place-items: center; font-size: clamp(18px, 3.4vw, 30px);
  border: 2px solid transparent; user-select: none; transition: transform .08s;
}
.sd-cell:hover { transform: scale(1.04); }
.sd-cell.found { border-color: var(--ok); background: #eef4e6; box-shadow: 0 0 0 3px rgba(122,154,95,.15); }
.sd-cell.miss { animation: shake .32s; border-color: var(--danger); }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
.sd-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- Vowel game (자음 모음 조합) ---------- */
.vg-wrap { max-width: 720px; margin: 0 auto; }
.vg-hud { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.vg-levels { max-width: 560px; margin: 0 auto; }
.vg-levels-head { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 18px; }
.vg-levels-sub { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 8px; }
.vg-level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.vg-lvl {
  aspect-ratio: 1 / 1; border-radius: 14px; border: 2px solid var(--border); background: var(--card);
  font-size: 20px; font-weight: 800; color: var(--ink); cursor: pointer; display: grid; place-items: center;
  transition: transform .1s;
}
.vg-lvl:not(.locked):hover { transform: translateY(-2px); }
.vg-lvl.cleared { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.vg-lvl.current { background: linear-gradient(135deg, #a5764a, #c69a5a); border-color: transparent; color: #fff; box-shadow: var(--shadow); }
.vg-lvl.locked { background: var(--bg); color: var(--muted); border-style: dashed; cursor: not-allowed; opacity: .7; font-size: 16px; }
.ok-msg { color: var(--ok); font-weight: 800; }
.vg-board { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.vg-caption { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }
.vg-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 22px; }
.vg-tile {
  width: 58px; height: 66px; border-radius: 12px; background: var(--card); border: 2px solid var(--border);
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: var(--ink);
  transition: all .12s;
}
.vg-tile.used { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.vg-inputrow { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.vg-input {
  flex: 1; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--bg); color: var(--ink); font-size: 20px; font-weight: 700; text-align: center;
}
.vg-input:focus { outline: none; border-color: var(--accent); }
.vg-input.ready { border-color: var(--ok); background: #eef4e6; }
.vg-input.bad { border-color: var(--danger); }
.vg-result { min-height: 28px; text-align: center; margin-top: 18px; }
.vg-win { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.vg-win .plus { color: var(--ok); }
.vg-lose { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--ink-soft); }
.bad-msg { color: var(--danger); font-weight: 700; }
.vg-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.vg-error { text-align: center; color: var(--ink-soft); padding: 40px; font-size: 15px; }
.vg-error .btn { margin-top: 14px; }
:root[data-theme="dark"] .vg-input.ready { background: #2e3a26; }

/* ---------- Overlay (win) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(61,46,32,.4); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--surface); border-radius: 18px; padding: 30px 34px; text-align: center; box-shadow: 0 20px 60px rgba(61,46,32,.3); max-width: 360px; }
.modal .big { font-size: 44px; }
.modal h2 { margin: 8px 0 4px; }
.modal p { color: var(--ink-soft); margin: 0 0 20px; }
.modal .row { display: flex; gap: 10px; justify-content: center; }

/* ---------- Multiplayer vowel (실시간 대전) ---------- */
.vm-wrap { max-width: 860px; margin: 0 auto; }
.vm-waiting { text-align: center; color: var(--muted); padding: 60px 0; }
.vm-top { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.vm-solvedbar { font-size: 14px; color: var(--ink-soft); }
.vm-solvedbar b { color: var(--accent); font-size: 18px; }
.vm-main { display: grid; grid-template-columns: 1fr 200px; gap: 18px; align-items: start; }
.vm-hint { text-align: center; margin: 4px 0 14px; color: var(--ink-soft); font-size: 15px; letter-spacing: 2px; }
.vm-hint b { color: var(--accent); }
.vm-score { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.vm-score-h-row { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; font-weight: 800; font-size: 12px; color: var(--muted); }
.vm-score-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.vm-score-row:first-of-type { border-top: none; }
.vm-score-row.pending { opacity: .55; }
.vm-rank { width: 24px; text-align: center; flex-shrink: 0; }
.vm-status { width: 16px; text-align: center; flex-shrink: 0; color: var(--ok); font-weight: 800; }
.vm-score-row.pending .vm-status { color: var(--muted); }
.vm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-pts { font-weight: 800; color: var(--accent); text-align: right; }
.vm-modal { max-width: 420px; }
.vm-answers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.vm-ans { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 14px; font-weight: 700; }
.vm-rs { text-align: left; max-width: 260px; margin: 0 auto; }
.vm-rs-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; color: var(--ink-soft); }
.vm-next { margin-top: 16px !important; font-size: 13px; color: var(--muted); }
.vm-reveal { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border); text-align: center; }
.vm-reveal-head { font-weight: 800; font-size: 16px; margin-bottom: 12px; }
.vm-reveal .vm-next { margin-top: 14px !important; }
.vm-final { margin-bottom: 18px; }
.vm-final-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 15px; }
.vm-final-row.win { background: var(--accent-soft); }
.vm-final-row .vm-pts { font-size: 16px; }
.room-start-hint { text-align: center; color: var(--muted); font-size: 13px; margin: -6px 0 10px; }
@media (max-width: 720px) { .vm-main { grid-template-columns: 1fr; } }

/* ---------- Login screen ---------- */
.login-shell {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(135deg, #f6ecdb 0%, #fdf7e6 55%, #fbf2dd 100%);
}
.login-top { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.login-top .nav-icon { border: 0; cursor: pointer; }
.login-top .nav-icon:hover { background: var(--accent-soft); }
.login-main { flex: 1; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-input {
  width: 100%; padding: 17px 18px; border-radius: 14px; border: 1px solid var(--border);
  background: #eaddc7; color: var(--ink); font-size: 16px; font-weight: 700; text-align: center;
}
.login-input::placeholder { color: #b3a184; font-weight: 700; }
.login-input:focus { outline: none; border-color: var(--accent); background: #efe6d4; }
.login-div { height: 1px; background: #cbb89a; margin: 6px 2px 2px; }
.login-actions { display: flex; gap: 14px; }
.login-btn { flex: 1; padding: 15px 0; border-radius: 14px; border: 0; font-size: 16px; font-weight: 800; cursor: pointer; }
.login-btn.primary { background: #a68763; color: #fff; }
.login-btn.primary:hover { background: #9a7a56; }
.login-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 10px 0 2px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.social { display: flex; flex-direction: column; gap: 10px; }
.social-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 0;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: filter .12s;
}
.social-btn svg { position: absolute; left: 16px; width: 18px; height: 18px; }
.social-btn.kakao { background: #FEE500; color: #191600; }
.social-btn.naver { background: #03C75A; color: #fff; }
.social-btn.google { background: #fff; color: #3c4043; border: 1px solid #dadce0; }
.social-btn:hover { filter: brightness(0.97); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-title, .page-sub { display: none; }
  .sd-boards { grid-template-columns: 1fr; }
  .nav { padding: 0 12px; }
  .main { padding: 12px; }
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --bg: #1d1915;
  --surface: #29231d;
  --card: #322a22;
  --card-strong: #3b3128;
  --border: #3d342a;
  --ink: #f1e7d8;
  --ink-soft: #cbbca8;
  --muted: #9c8b76;
  --accent: #d3a869;
  --accent-soft: #4a3d2b;
  --gold: #d6ad6a;
  --track: #40372c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
}
/* dark overrides for hardcoded light surfaces */
:root[data-theme="dark"] .login-shell { background: linear-gradient(135deg, #241e18 0%, #2b241d 55%, #201b15 100%); }
:root[data-theme="dark"] .login-input { background: #322a22; }
:root[data-theme="dark"] .login-input::placeholder { color: #8a7a64; }
:root[data-theme="dark"] .login-input:focus { background: #3a3128; }
:root[data-theme="dark"] .login-div { background: #4a3f31; }
:root[data-theme="dark"] .banner { background: linear-gradient(135deg, #342a20, #2c241c); }
:root[data-theme="dark"] .nav-tab:hover,
:root[data-theme="dark"] .nav-icon,
:root[data-theme="dark"] .nav-guest,
:root[data-theme="dark"] .page-back { background-color: #363029; }
:root[data-theme="dark"] .rooms tbody tr:hover { background: #2f2820; }
:root[data-theme="dark"] .sd-cell.found { background: #2e3a26; }
:root[data-theme="dark"] .social-btn.google { background: #f5f2ec; }

/* ---------- Range sliders ---------- */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: var(--track); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer;
  border: 2px solid var(--surface);
}

/* ---------- Settings panel ---------- */
.settings {
  background: var(--surface); border-radius: 18px; padding: 22px 24px 26px; width: 340px; max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); border: 1px solid var(--border);
}
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.settings-head h2 { margin: 0; font-size: 18px; }
.settings-close { border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 9px; }
.settings-close:hover { background: var(--card); color: var(--ink); }
.set-row { padding: 14px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.set-label { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.set-val { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.set-ctl { display: flex; align-items: center; gap: 12px; }
.set-toggle { flex: none; width: 38px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--ink); font-size: 13px; cursor: pointer; }
.set-toggle.on { background: var(--accent); color: #fff; border-color: transparent; }
.theme-seg { display: flex; gap: 8px; }
.theme-seg button {
  flex: 1; padding: 11px 0; border-radius: 11px; border: 1px solid var(--border); background: var(--card);
  color: var(--ink-soft); font-size: 14px; font-weight: 700; cursor: pointer;
}
.theme-seg button.active { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.logout-btn {
  width: 100%; padding: 13px 0; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--danger); font-size: 14px; font-weight: 700; cursor: pointer;
}
.logout-btn:hover { background: var(--danger); color: #fff; border-color: transparent; }
