:root {
  --bg: #15171b;
  --bg2: #1c1f25;
  --panel: #20242b;
  --line: #2f343d;
  --text: #ece8df;
  --muted: #9a9a93;
  --accent: #d9a441;
  --accent-ink: #1b1508;
  --jade: #5fb59a;
  --red: #e0675a;
  --black-stone: #111;
  --white-stone: #f4f1ea;
  --radius: 12px;
  --serif: 'Noto Serif KR', serif;
  --sans: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { min-height: 100vh; background:
  radial-gradient(1200px 600px at 80% -10%, rgba(217,164,65,.08), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, rgba(95,181,154,.06), transparent 60%), var(--bg); }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* 상단 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
  background: rgba(21,23,27,.9); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark { position: relative; width: 28px; height: 22px; }
.brand-mark i { position: absolute; width: 18px; height: 18px; border-radius: 50%; top: 2px; }
.brand-mark .b { left: 0; background: radial-gradient(circle at 35% 30%, #555, #000 70%); }
.brand-mark .w { left: 10px; background: radial-gradient(circle at 35% 30%, #fff, #cfcabd 80%); }
.brand-name { font-family: var(--serif); font-weight: 800; font-size: 19px; letter-spacing: .02em; }
.top-right { display: flex; align-items: center; gap: 12px; }
.nick { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.nick input { width: 110px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); }
.engine-badge { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.engine-badge.katago { border-color: rgba(95,181,154,.5); color: var(--jade); }
.engine-badge.heuristic { border-color: rgba(217,164,65,.45); color: var(--accent); }

/* 공통 */
.view { max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn { border: 1px solid var(--line); background: var(--bg2); padding: 9px 16px; border-radius: 10px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #4a515d; background: #262a32; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: #e6b354; }
.btn.danger { color: var(--red); }
/* 나가기: 배경과 확실히 구분되게 */
.btn.exit { background: rgba(224,103,90,.16); border-color: rgba(224,103,90,.6); color: #f3b3a9; font-weight: 700; }
.btn.exit:hover:not(:disabled) { background: rgba(224,103,90,.28); border-color: #e0675a; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.tiny { padding: 3px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 12px 28px; font-size: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.eyebrow b { color: var(--accent); font-family: ui-monospace, monospace; }

/* 로비 */
.lobby-hero { padding: 32px 0 28px; }
.lobby-hero h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); line-height: 1.2; margin: 0 0 12px; }
.lobby-hero h1 em { font-style: normal; color: var(--accent); }
.lobby-hero p { color: var(--muted); margin: 0 0 22px; max-width: 560px; line-height: 1.6; }
.create { display: flex; gap: 10px; max-width: 520px; }
.create input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.room-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.room { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room .rname { font-weight: 700; margin-bottom: 4px; }
.room .rmeta { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; white-space: nowrap; vertical-align: 1px; font-size: 11px; padding: 2px 8px; border-radius: 99px; margin-right: 6px; border: 1px solid var(--line); }
.pill.st-waiting { color: var(--jade); border-color: rgba(95,181,154,.5); }
.pill.st-playing, .pill.st-scoring { color: var(--accent); border-color: rgba(217,164,65,.5); }
.empty { color: var(--muted); padding: 20px 0; }

/* 대기실 */
.waiting { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.wait-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.wait-head h2 { margin: 2px 0 0; font-family: var(--serif); font-size: 24px; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.seat { border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; min-height: 96px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.seat.filled { border-style: solid; background: var(--bg2); }
.seat .sname { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.seat .stag { font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jade); display: inline-block; }
.dot.off { background: #666; }
.crown { font-size: 11px; color: var(--accent); border: 1px solid rgba(217,164,65,.5); border-radius: 6px; padding: 1px 6px; }
.settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.settings select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); }
.settings select:disabled { opacity: .8; }
.wait-actions { display: flex; justify-content: space-between; align-items: center; }
.hint { color: var(--muted); font-size: 13px; text-align: right; margin: 10px 0 0; min-height: 1em; }

/* 채팅 */
.chat-panel { display: flex; flex-direction: column; min-height: 260px; }
.waiting .chat-panel { height: 520px; }
.chat-log { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.55; padding-right: 4px; min-height: 120px; }
.chat-log .sys { color: var(--muted); font-size: 12px; }
.chat-log .from { color: var(--accent); font-weight: 700; margin-right: 6px; }
.chat-log .from.me { color: var(--jade); }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); }

/* 대국 */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.board-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.scorebar { display: grid; grid-template-columns: 1fr minmax(160px, 1.3fr) 1fr; gap: 12px; align-items: stretch; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; transition: border-color .2s, box-shadow .2s; }
.pcard.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pcard .prow { display: flex; align-items: center; gap: 8px; }
.stone-icon { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.stone-icon.b { background: radial-gradient(circle at 35% 30%, #666, #000 70%); }
.stone-icon.w { background: radial-gradient(circle at 35% 30%, #fff, #cbc5b8 85%); }
.pcard .pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .me-tag { font-size: 11px; color: var(--jade); border: 1px solid rgba(95,181,154,.5); border-radius: 6px; padding: 0 5px; }
.pcard .pmeta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--muted); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; color: var(--text); }
.clock.byo { color: var(--accent); }
.clock.low { color: var(--red); }
.gauge { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.gauge-bar { position: relative; height: 22px; border-radius: 99px; overflow: hidden; background: var(--white-stone); border: 1px solid #3a3f48; }
.gauge-black { position: absolute; inset: 0 auto 0 0; width: 50%; background: linear-gradient(90deg, #000, #2a2a2a); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.gauge-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--accent); opacity: .8; }
.gauge-text { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; }
.gauge-text { flex-wrap: wrap; row-gap: 2px; }
.gauge-text .lead { font-weight: 700; color: var(--accent); text-align: center; order: 3; flex-basis: 100%; line-height: 1.35; }
.board-wrap { position: relative; width: 100%; max-width: min(100%, calc(100vh - 230px)); min-width: 280px; margin: 0 auto; aspect-ratio: 1; }
#board { width: 100%; height: 100%; display: block; border-radius: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.45); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.zoom-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: -4px; }
.zoom-hint { flex: 1; font-size: 12px; color: var(--muted); }
.zbtn { min-width: 44px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.zbtn#zoomReset { font-size: 13px; }
.zoom-level { font-size: 12px; color: var(--accent); padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(217,164,65,.4); }
.zoom-level:empty { display: none; }
.confirm-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.confirm-bar #confirmText { flex: 1; font-size: 14px; }
.confirm-bar #confirmText .muted { display: block; font-size: 12px; }
.confirm-bar .btn.big { padding: 12px 26px; }
@media (pointer: fine) { .touch-only { display: none !important; } }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.controls .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); }
.review-bar { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; background: rgba(217,164,65,.1); border: 1px solid rgba(217,164,65,.35); border-radius: 10px; padding: 6px; }
.review-bar span { min-width: 120px; text-align: center; color: var(--accent); }
.undo-pop { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(20,22,26,.95); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 5; white-space: nowrap; }
/* 대국 종료 알림창 (바둑판 위) */
.result-pop { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(8,10,14,.45); border-radius: 6px; animation: rp-fade .25s ease-out; }
.result-pop.hidden { display: none; }
.rp-card { position: relative; width: min(330px, 100%); text-align: center; background: rgba(24,27,33,.97); border: 1px solid var(--accent); border-radius: 16px; padding: 20px 18px 16px; box-shadow: 0 18px 50px rgba(0,0,0,.6); animation: rp-pop .3s cubic-bezier(.2,1.4,.4,1); }
.result-pop.win .rp-card { border-color: var(--jade); }
.result-pop.lose .rp-card { border-color: var(--red); }
.rp-x { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.rp-x:hover { background: var(--bg2); color: var(--text); }
.rp-icon, .rp-flag { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.rp-head { font-size: 24px; font-weight: 800; color: var(--accent); }
.result-pop.win .rp-head { color: var(--jade); }
.result-pop.lose .rp-head { color: var(--red); }
.rp-why { margin-top: 8px; font-size: 16px; font-weight: 600; color: var(--text); }
.rp-text { margin-top: 4px; font-size: 13px; color: var(--muted); }
.rp-rec { margin-top: 8px; font-size: 12px; color: var(--jade); }
.rp-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.rp-actions .btn { padding: 10px 14px; }
@keyframes rp-fade { from { opacity: 0; } }
@keyframes rp-pop { from { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .result-pop, .rp-card { animation: none; } }

.side { display: flex; flex-direction: column; gap: 14px; }
#graph { width: 100%; height: 150px; display: block; cursor: crosshair; }
.graph-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.engine-tag { font-size: 11px; color: var(--muted); }
.last-eval { margin-top: 10px; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--bg2); min-height: 20px; }
.last-eval .good { color: var(--jade); font-weight: 700; }
.last-eval .bad { color: var(--red); font-weight: 700; }
.last-eval .meh { color: var(--accent); font-weight: 700; }
.game-info .info-actions { display: flex; gap: 8px; margin-top: 10px; }
#gameMeta { font-size: 13px; line-height: 1.6; }
.side .chat-panel { height: 260px; }
.result h3, .scoring h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; }
.result { border-color: var(--accent); }
.result .actions, .scoring .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.score-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 6px; }
.score-table td { padding: 4px 0; border-bottom: 1px solid var(--line); }
.score-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.score-table tr.total td { font-weight: 700; color: var(--accent); border-bottom: none; }
.accepted { color: var(--jade); font-size: 12px; }

/* 첫 화면: 게임 선택 */
.home-hero { padding: 40px 0 26px; }
.home-hero h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); margin: 0 0 12px; }
.home-hero p { color: var(--muted); margin: 0; max-width: 600px; line-height: 1.6; }
.game-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pick-card { display: flex; gap: 20px; align-items: center; text-align: left; padding: 20px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; transition: border-color .2s, transform .15s, box-shadow .2s; }
.pick-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.35); }
.pick-card h2 { font-family: var(--serif); font-size: 28px; margin: 0 0 6px; }
.pick-card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.pick-count { font-size: 12px; color: var(--jade); }
.pick-art { flex: none; width: 132px; height: 132px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.4);
  --st-b: radial-gradient(circle closest-side, #4a4a4a 0, #111 55%, #000 86%, transparent 92%);
  --st-w: radial-gradient(circle closest-side, #fff 0, #f1ede3 55%, #c9c2b2 86%, transparent 92%); }
.baduk-art {
  background:
    var(--st-b) 38px 38px / 20px 20px no-repeat, var(--st-w) 56px 38px / 20px 20px no-repeat,
    var(--st-b) 56px 56px / 20px 20px no-repeat, var(--st-w) 74px 56px / 20px 20px no-repeat,
    var(--st-b) 74px 74px / 20px 20px no-repeat, var(--st-w) 38px 74px / 20px 20px no-repeat,
    var(--st-b) 92px 20px / 20px 20px no-repeat,
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(59,42,18,.7) 8px 9px, transparent 9px 18px),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(59,42,18,.7) 8px 9px, transparent 9px 18px),
    linear-gradient(135deg, #e2b86a, #c99a48);
}
.omok-art {
  background:
    var(--st-b) 20px 92px / 20px 20px no-repeat, var(--st-b) 38px 74px / 20px 20px no-repeat,
    var(--st-b) 56px 56px / 20px 20px no-repeat, var(--st-b) 74px 38px / 20px 20px no-repeat,
    var(--st-b) 92px 20px / 20px 20px no-repeat,
    var(--st-w) 56px 74px / 20px 20px no-repeat, var(--st-w) 74px 56px / 20px 20px no-repeat,
    var(--st-w) 38px 56px / 20px 20px no-repeat,
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(59,42,18,.7) 8px 9px, transparent 9px 18px),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(59,42,18,.7) 8px 9px, transparent 9px 18px),
    linear-gradient(135deg, #ecc98a, #d4a95c);
}
.game-chip { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: rgba(217,164,65,.15); color: var(--accent); border: 1px solid rgba(217,164,65,.4); }
.back { margin-top: 4px; }
.lobby-hero { padding-top: 18px; }
.settings label.wide select { min-width: 0; }
.rule-desc { font-size: 13px; color: var(--accent); background: rgba(217,164,65,.08); border: 1px solid rgba(217,164,65,.25); border-radius: 8px; padding: 8px 12px; margin: -6px 0 18px; }
.room .rtype { font-size: 11px; color: var(--muted); margin-right: 6px; }

.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 18px; border-radius: 14px; background: var(--panel); border: 1px solid rgba(217,164,65,.45); }
.install-card img { border-radius: 10px; flex: none; }
.install-text { flex: 1; font-size: 13px; line-height: 1.5; color: var(--muted); }
.install-text b { color: var(--text); font-size: 14px; }

.update-bar { position: sticky; top: 0; z-index: 31; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; background: #2d4a3f; color: #e6f4ee; font-size: 13px; border-bottom: 1px solid rgba(95,181,154,.5); }
.update-bar.hidden { display: none; }
.conn-bar { position: sticky; top: 0; z-index: 30; background: #7a2e25; color: #fff; text-align: center; font-size: 13px; padding: 8px 12px; }
.offline-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  background: rgba(224,103,90,.12); border: 1px solid rgba(224,103,90,.45); color: #f1c3bc; }
.offline-bar span { flex: 1; min-width: 200px; }
.clock.paused { color: var(--muted); }

/* 전적 */
.my-records { margin-top: 26px; }
.rec-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rec-mini-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.rec-mini-card:hover { border-color: var(--accent); }
.rm-title { font-family: var(--serif); font-size: 17px; font-weight: 800; }
.rm-line { font-size: 14px; }
.lobby-rec { font-size: 14px; margin: -10px 0 20px !important; }
.lobby-rec a { color: var(--accent); }
.rec-head h1 { font-family: var(--serif); font-size: clamp(28px, 4.5vw, 40px); margin: 14px 0 6px; }
.rec-head p { margin: 0 0 18px; font-size: 13px; line-height: 1.6; }
.rec-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.rtab { padding: 9px 22px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-weight: 700; }
.rtab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rec-stats { margin-bottom: 14px; }
.rec-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.rb-num { font-family: var(--serif); font-size: 32px; font-weight: 800; line-height: 1.1; }
.rb-num small { font-size: 15px; margin-left: 2px; color: var(--muted); }
.rb-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.wbar { position: relative; display: flex; height: 8px; border-radius: 99px; background: rgba(224,103,90,.55); overflow: hidden; }
.wbar i { display: block; height: 100%; background: var(--jade); }
.wbar b { display: block; height: 100%; background: #6b6f78; }
.rec-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; font-size: 14px; }
.rec-sides > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rec-recent { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; }
.rec-recent i { font-style: normal; width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; font-weight: 700; font-size: 11px; }
.dot-win { background: rgba(95,181,154,.25); color: var(--jade); }
.dot-loss { background: rgba(224,103,90,.22); color: var(--red); }
.dot-draw { background: rgba(255,255,255,.08); color: var(--muted); }
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.rec-side { display: flex; flex-direction: column; gap: 14px; }
.rec-games { list-style: none; margin: 0; padding: 0; }
.rec-games li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rec-games li:last-child { border-bottom: 0; }
.rg-main { flex: 1; min-width: 0; }
.rg-main > div:first-child { display: flex; align-items: center; gap: 6px; }
.rg-main .muted { font-size: 12px; margin-top: 2px; }
.rec-games .stone-icon { width: 14px; height: 14px; }
.rg-res { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }
.res-win { background: rgba(95,181,154,.2); color: var(--jade); }
.res-loss { background: rgba(224,103,90,.18); color: var(--red); }
.res-draw { background: rgba(255,255,255,.08); color: var(--muted); }
.opp-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.opp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-rec { font-size: 13px; color: var(--muted); white-space: nowrap; }
.code-panel h3 { margin: 0 0 6px; font-size: 15px; }
.code-panel h4 { margin: 0 0 8px; font-size: 14px; }
.code-panel p { font-size: 13px; line-height: 1.55; margin: 0 0 10px; }
.code-big { font: 800 26px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 3px; text-align: center; padding: 12px; background: rgba(217,164,65,.12); color: var(--accent); border-radius: 12px; margin-bottom: 8px; user-select: all; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font: 700 16px ui-monospace, monospace; letter-spacing: 2px; text-transform: uppercase; }
.code-sep { height: 1px; background: var(--line); margin: 16px 0 14px; }
.seat .stag.rec { color: var(--text); }
.rec-note { margin-top: 8px; font-size: 13px; color: var(--jade); }

/* AI와 두기 */
.ai-panel { margin: 0 0 26px; border-color: rgba(95,181,154,.45); }
.ai-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ai-head h2 { margin: 0 0 2px; font-size: 18px; font-family: var(--serif); }
.ai-head .muted { font-size: 13px; }
.ai-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: rgba(95,181,154,.18); color: var(--jade); border: 1px solid rgba(95,181,154,.5); letter-spacing: .02em; }
.ai-opts { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.ai-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.ai-field select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); min-width: 120px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg2); }
.seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--text); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--jade); color: #0d241d; font-weight: 700; }
.ai-desc { font-size: 13px; margin: 12px 0 12px; line-height: 1.5; }
.ai-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ai-rec { font-size: 13px; color: var(--muted); }
.thinking { color: var(--jade); font-weight: 700; }
.thinking::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.ai-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.rec-games.compact li { padding: 7px 0; font-size: 13px; }
.rec-games.compact .rg-res { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
@media (max-width: 640px) {
  .seg button { padding: 8px 11px; font-size: 13px; }
  .ai-actions .btn.big { width: 100%; }
}

/* 설치 도움말 */
.help-dlg { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 18px 18px 16px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.help-dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.dlg-head h3 { margin: 0; font-size: 18px; font-family: var(--serif); }
.dlg-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font-size: 16px; }
.help-lead { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.install-now { width: 100%; height: 46px; margin-bottom: 12px; }
.help-warn { font-size: 13px; line-height: 1.55; padding: 10px 12px; margin-bottom: 12px; border-radius: 10px; background: rgba(224,103,90,.12); border: 1px solid rgba(224,103,90,.45); color: #f1c3bc; }
.help-warn .btn { margin-top: 8px; display: block; }
.help-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.help-tabs button { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font-size: 13px; }
.help-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.help-steps { display: none; margin: 0 0 12px; padding-left: 22px; font-size: 14px; line-height: 1.7; }
.help-steps.on { display: block; }
.help-steps b { color: var(--accent); }
.help-foot { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .top { gap: 8px; }
  .top-right { gap: 6px; }
  .brand { gap: 7px; min-width: 0; }
  .brand-mark { flex: none; }
  .game-chip { flex: none; white-space: nowrap; }
  .brand-name { white-space: nowrap; font-size: 17px; }
  .top-right .btn.small { padding: 6px 9px; }
  .nick input { width: 84px; padding: 6px 8px; }
}
@media (max-width: 400px) { .game-chip { display: none; } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #2b2f37; border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .game { grid-template-columns: 1fr; }
  .rec-grid { grid-template-columns: 1fr; }
  .waiting { grid-template-columns: 1fr; }
  .waiting .chat-panel { height: 300px; }
  .board-wrap { max-width: 100%; }
}
@media (max-width: 640px) {
  .view { padding: 14px 10px 30px; }
  .top { padding: 10px 12px; }
  .engine-badge { display: none; }
  .settings { grid-template-columns: 1fr 1fr; }
  .scorebar { grid-template-columns: 1fr 1fr; }
  .gauge { grid-column: 1 / -1; order: -1; }
  .create { flex-direction: column; }
  .clock { font-size: 14px; }
  .pcard .pmeta { flex-direction: column; align-items: flex-start; }
  .seats { grid-template-columns: 1fr; }
  .confirm-bar { position: sticky; bottom: 8px; z-index: 6; }
  .controls .btn { padding: 10px 14px; }
  .game-pick { grid-template-columns: 1fr; }
  .pick-card { padding: 16px; gap: 14px; }
  .rec-big .rb-num { font-size: 26px; }
  .rec-sides { grid-template-columns: 1fr; }
  .pick-art { zoom: .72; }
  .pick-card h2 { font-size: 22px; }
  .nick span { display: none; }
}
@media (max-width: 980px) and (min-width: 641px) {
  .game-pick { grid-template-columns: 1fr; }
}
