:root {
  --paper: #efe8da;
  --paper-hi: #fbf8f1;
  --sand: #e3dac8;
  --ink: #1d1b18;
  --ink-2: #4a463f;
  --mute: #8c857a;
  --red: #e5462b;
  --yel: #f4b81c;
  --teal: #2f8f83;
  --rule: rgba(29, 27, 24, .07);
  --sans: "IBM Plex Sans KR", system-ui, sans-serif;
  --disp: "Black Han Sans", "IBM Plex Sans KR", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.disp { font-family: var(--disp); font-weight: 400; }
kbd { font: 600 11px var(--mono); border: 1.5px solid var(--ink); border-bottom-width: 3px; border-radius: 4px; padding: 0 5px; background: var(--paper-hi); }

.screen { display: none; min-height: 100vh; }
.screen.on { display: block; }

/* 공용 부품 */
.sheet { background: var(--paper-hi); border: 2.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); position: relative; }
.sheet-head { display: flex; gap: 10px; align-items: center; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding: 8px 14px; background: var(--sand); }
.sheet-head span { background: var(--ink); color: var(--paper-hi); padding: 0 6px; }
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2.5px solid var(--ink); background: var(--paper-hi); box-shadow: 4px 4px 0 var(--ink);
  padding: 9px 18px; font-weight: 700; cursor: pointer; border-radius: 3px; transition: transform .05s, box-shadow .05s;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.red { background: var(--red); color: var(--paper-hi); }
.btn.red:hover { background: #ef5539; }
.btn.small { padding: 5px 12px; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); }
.btn.ghost { box-shadow: none; background: transparent; border-style: dashed; }
.btn.big { width: 100%; font: 400 26px var(--disp); padding: 16px; letter-spacing: .01em; }
.btn.big small { font: 500 13px var(--sans); opacity: .8; }
.stamp {
  font-family: var(--disp); color: var(--red); border: 3px solid var(--red); padding: 4px 12px; border-radius: 4px;
  transform: rotate(-7deg); letter-spacing: .06em; mix-blend-mode: multiply; display: inline-block;
}
input:focus-visible, .btn:focus-visible { outline: 3px solid var(--yel); outline-offset: 2px; }

/* 메인 */
.menu-wrap { max-width: 1120px; margin: 0 auto; padding: 34px 24px 60px; }
.mast { position: relative; padding-bottom: 22px; border-bottom: 3px double var(--ink); margin-bottom: 30px; }
.mast-meta { display: flex; gap: 22px; font-size: 12px; color: var(--ink-2); letter-spacing: .06em; }
.mast-meta span + span::before { content: "/"; margin-right: 22px; color: var(--mute); }
.mast h1 { font-size: clamp(64px, 11vw, 132px); line-height: .95; margin: 14px 0 12px; letter-spacing: -.01em; }
.mast h1 .hl { color: var(--paper-hi); background: var(--ink); padding: 0 .12em; box-shadow: 8px 8px 0 var(--red); }
.lede { max-width: 560px; font-size: 17px; margin: 18px 0 0; color: var(--ink-2); }
.mast-stamp { position: absolute; right: 8px; top: 64px; font-size: 30px; }

.menu-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; margin-bottom: 30px; }
.me-body { display: flex; gap: 18px; padding: 18px; }
.me-preview { flex: 0 0 auto; background: var(--sand); border: 2px solid var(--ink); background-image: radial-gradient(var(--rule) 1.5px, transparent 1.5px); background-size: 12px 12px; }
.me-preview canvas { display: block; width: 200px; height: auto; }
.me-form { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .join-row input, .chat-form input {
  border: 2px solid var(--ink); background: #fff; padding: 8px 10px; border-radius: 2px; font-size: 15px; min-width: 0;
}
.look-row { display: grid; grid-template-columns: 54px 30px 1fr 30px; align-items: center; gap: 6px; font-size: 13px; }
.look-row > span:first-child { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.look-row button { height: 28px; border: 2px solid var(--ink); background: var(--paper-hi); cursor: pointer; font-weight: 700; border-radius: 2px; }
.look-row button:active { background: var(--yel); }
.look-row .val { text-align: center; font-weight: 600; border-bottom: 2px dotted var(--mute); padding-bottom: 2px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.look-row .sw { width: 13px; height: 13px; border: 1.5px solid var(--ink); display: inline-block; }

.card-play { padding-bottom: 6px; display: flex; flex-direction: column; }
.card-play > .btn.big { width: auto; margin: 18px 18px 0; }
.card-play > .btn.big + .btn.big { margin-top: 14px; }
.join-row { display: flex; gap: 10px; margin: 16px 18px 0; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: .3em; font-size: 18px; }
.rules { margin: 18px 18px 12px; padding: 14px 0 0; border-top: 2px dashed var(--mute); list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.rules b { color: var(--ink); }

.game-list { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; counter-reset: g; }
.game-list li { counter-increment: g; display: flex; align-items: baseline; gap: 8px; padding: 7px 8px; border-bottom: 1px solid var(--rule); font-weight: 600; }
.game-list li::before { content: counter(g, decimal-leading-zero); font: 500 11px var(--mono); color: var(--mute); }
.game-list li { box-shadow: inset 4px 0 0 var(--ac, transparent); }
.game-list li i { margin-left: auto; }
/* 종목 색 칩 */
.ax { display: inline-block; font: 700 11px var(--sans); font-style: normal; letter-spacing: 0; color: #fff; background: var(--ac); border: 1.5px solid var(--ink); border-radius: 10px; padding: 0 7px; white-space: nowrap; vertical-align: middle; }

/* 대기실 */
.room-wrap { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 22px; min-height: 100vh; }
.room-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; }
.rh-left { display: flex; align-items: center; gap: 18px; }
.rh-label { font-size: 12px; letter-spacing: .1em; color: var(--ink-2); writing-mode: horizontal-tb; }
.rh-code { font-size: 38px; font-weight: 700; letter-spacing: .22em; }
.rh-right { display: flex; align-items: center; gap: 20px; }
.rh-count b { font: 400 44px var(--disp); }
.rh-count span { font: 600 16px var(--mono); color: var(--mute); margin-left: 4px; }
.rh-status { font-weight: 700; background: var(--ink); color: var(--paper-hi); padding: 6px 14px; min-width: 170px; text-align: center; }
.rh-status.hot { background: var(--red); }
.room-main { display: grid; grid-template-columns: 1fr 340px; gap: 22px; flex: 1; min-height: 0; }
.stage-box { padding: 0; overflow: hidden; background: var(--sand); }
.stage-box canvas { width: 100%; height: auto; display: block; }
.room-main { align-items: start; }
.room-main .chat-slot { height: min(520px, 60vh); }
.room-foot { display: flex; align-items: center; gap: 18px; }
.host-ctl { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.guest-note { margin-left: auto; color: var(--ink-2); font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* 채팅 */
body > .chat { display: none; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { font-size: 12px; letter-spacing: .08em; padding: 7px 12px; border-bottom: 2px solid var(--ink); background: var(--sand); display: flex; justify-content: space-between; }
.chat-head span { color: var(--mute); }
.chat-log { list-style: none; margin: 0; padding: 8px 12px; flex: 1; overflow-y: auto; min-height: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.chat-log li { word-break: break-all; }
.chat-log li b { margin-right: 6px; }
.chat-log li.sys { color: var(--mute); font-size: 12px; }
.chat-log li.me b { background: var(--yel); padding: 0 3px; }
.chat-form { display: flex; gap: 8px; padding: 8px; border-top: 2px solid var(--ink); }
.chat-form input { flex: 1; padding: 6px 8px; font-size: 14px; }
.chat-slot { display: flex; flex-direction: column; min-height: 0; }

/* 경기 */
#scr-game.on { display: block; height: 100vh; overflow: hidden; }
.arena { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; height: 100vh; padding: 12px; }
.side { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: min-content; gap: 6px; align-content: center; min-width: 0; }
.pn { position: relative; border: 2px solid var(--ink); background: var(--paper-hi); cursor: default; overflow: hidden; }
.pn canvas { display: block; width: 100%; aspect-ratio: 4 / 3; image-rendering: auto; }
.pn .nm { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; font-weight: 600; background: rgba(251, 248, 241, .9); border-top: 1.5px solid var(--ink); padding: 0 4px; display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; overflow: hidden; }
.pn .nm span { overflow: hidden; text-overflow: ellipsis; }
.pn .nm b { font-family: var(--mono); }
.pn .rk { position: absolute; top: 0; left: 0; font: 700 10px var(--mono); background: var(--ink); color: var(--paper-hi); padding: 0 4px; }
.pn.danger { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.pn.danger .rk { background: var(--red); }
.pn.hit { animation: hit .5s; }
@keyframes hit { 0%, 100% { transform: none; } 25% { transform: translateX(-3px) rotate(-2deg); } 75% { transform: translateX(3px) rotate(2deg); } }
.pn.out canvas { filter: grayscale(1) contrast(.8); opacity: .45; }
.pn.out::after { content: "탈락"; position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); font: 400 15px var(--disp); white-space: nowrap; color: var(--red); border: 2px solid var(--red); padding: 0 6px; background: rgba(251, 248, 241, .8); }
.pn.watch { cursor: pointer; }
.pn.watch:hover { outline: 3px solid var(--yel); }
.pn.watching { outline: 3px solid var(--teal); }
.pn.cpu .nm span::after { content: " CPU"; font: 500 8px var(--mono); color: var(--mute); }

.center { display: flex; flex-direction: column; gap: 8px; width: min(680px, calc((100vh - 250px) * 4 / 3)); min-width: 420px; }
.hud { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0 14px; border: 2.5px solid var(--ink); background: var(--paper-hi); padding: 8px 14px 0; box-shadow: 4px 4px 0 var(--ink); }
.hud-round { font-size: 12px; font-weight: 700; background: var(--ink); color: var(--paper-hi); padding: 2px 8px; }
.hud-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hud-title b { font: 400 24px var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title span { font-size: 12px; font-weight: 700; color: #fff; background: var(--ac, var(--ink-2)); border: 1.5px solid var(--ink); border-radius: 10px; padding: 0 7px; white-space: nowrap; }
.hud-alive { text-align: right; line-height: 1; }
.hud-alive b { font: 400 28px var(--disp); }
.hud-alive span { font-size: 12px; margin-left: 4px; color: var(--ink-2); }
.hud-timer { grid-column: 1 / -1; height: 8px; margin: 8px -14px 0; border-top: 2px solid var(--ink); background: var(--sand); }
.hud-timer i { display: block; height: 100%; background: var(--ink); width: 0; }
.hud-timer i.low { background: var(--red); }
.hud-me { display: flex; gap: 8px; align-items: stretch; }
.hud-me > div:not(.badges) { flex: 1; border: 2px solid var(--ink); background: var(--paper-hi); padding: 3px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.hud-me span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.hud-me b { font-size: 20px; }
.hud-me.safe #meRank { color: var(--teal); }
.hud-me.danger #meRank { color: var(--red); }
.badges { display: flex; gap: 6px; }
.badges i { font: 700 12px var(--sans); font-style: normal; display: flex; align-items: center; padding: 0 8px; border: 2px solid var(--ink); }
.badges i.shield { background: var(--teal); color: var(--paper-hi); }
.badges i.boost { background: var(--yel); }
.badges i.debuff { background: var(--red); color: var(--paper-hi); font-family: var(--mono); }

.stage { position: relative; border: 2.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); background: var(--paper-hi); }
.stage canvas { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { transition: transform .18s ease-out; }
.ov { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; pointer-events: none; }
.ov.on { display: flex; }
.ov .card { pointer-events: auto; background: var(--paper-hi); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 22px 28px; width: min(470px, 86%); text-align: center; position: relative; }
.ov .card .axis { font: 600 12px var(--mono); letter-spacing: .12em; color: var(--ink-2); }
.ov .card h2 { font: 400 46px/1.05 var(--disp); margin: 6px 0 10px; }
.ov .card p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
/* 한국어는 단어 중간에서 줄이 바뀌지 않게 */
:lang(ko) .ov .card p, :lang(ko) .vopt span, :lang(ko) .lede { word-break: keep-all; }
.ov .card .ctrl { display: inline-block; font-size: 13px; font-weight: 700; border: 2px solid var(--ink); padding: 3px 10px; background: var(--sand); }
.ov .card .cut { margin-top: 14px; font-size: 13px; font-weight: 600; }
.ov .card .cut b { color: var(--red); }
.ov .card .count { position: absolute; top: -26px; right: -22px; width: 64px; height: 64px; border-radius: 50%; background: var(--red); color: var(--paper-hi); border: 3px solid var(--ink); font: 400 34px/58px var(--disp); }
.ov .card .row { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.ov.bottom { align-items: flex-end; padding-bottom: 18px; }
.ov .tag { pointer-events: none; background: var(--ink); color: var(--paper-hi); font-weight: 700; padding: 4px 14px; }

.dock { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; height: 132px; min-height: 0; }
.items { display: flex; gap: 6px; }
.slot { width: 74px; border: 2.5px solid var(--ink); background: var(--paper-hi); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px; position: relative; }
.slot kbd { position: absolute; top: 4px; left: 4px; }
.slot .ico svg { width: 38px; height: 38px; display: block; }
.slot em { font-style: normal; font-size: 12px; font-weight: 700; }
.slot.empty { background: repeating-linear-gradient(45deg, var(--sand) 0 6px, var(--paper-hi) 6px 12px); cursor: default; box-shadow: none; }
.slot:not(.empty):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.feed { list-style: none; margin: 0; padding: 6px 8px; border: 2px solid var(--ink); background: var(--paper-hi); font-size: 12px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.feed li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed li .k { font-weight: 700; padding: 0 4px; border: 1.5px solid var(--ink); margin: 0 3px; font-size: 11px; }
.feed li .k.ink { background: var(--ink); color: var(--paper-hi); }
.feed li .k.shake { background: var(--yel); }
.feed li .k.mirror { background: #b8d6f5; }
.feed li .k.blocked { background: var(--teal); color: var(--paper-hi); }
.feed li.me { background: #ffe9a8; }
.game-chat { border: 2px solid var(--ink); background: var(--paper-hi); }
.game-chat .chat-head { display: none; }
.game-chat .chat-log { padding: 4px 8px; font-size: 12.5px; }
.game-chat .chat-form { padding: 4px; border-top-width: 1.5px; }
.game-chat .chat-form input { padding: 3px 6px; font-size: 13px; }
.game-chat .chat-form .btn { display: none; }

/* 방 설정 */
.rh-plan { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--ink-2); }
.rh-plan .plan { color: var(--ink); font-weight: 700; max-width: 520px; text-align: right; }
.num { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.num input { width: 64px; border: 2px solid var(--ink); background: #fff; padding: 5px 6px; font: 700 15px var(--mono); }
.head-note { margin-left: auto; font-style: normal; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.btn.big.ghostish { background: var(--sand); font-size: 22px; padding: 12px; }
.game-list li { cursor: pointer; }
.game-list li:hover { background: var(--yel); }

/* 경기: 나가기 · 엿보기 */
#btnExit { display: none; }
#btnExit.on { display: inline-flex; }
.pn { cursor: pointer; }
.pn:hover { outline: 3px solid var(--yel); z-index: 1; }
.pn.peeking { outline: 3px solid var(--teal); }
.side.tiny .nm span { display: none; }
.side.tiny .nm { justify-content: center; font-size: 9.5px; }
.side.tiny .rk { font-size: 8.5px; padding: 0 2px; }
.peek { display: none; position: fixed; top: 12px; z-index: 30; background: var(--paper-hi); border: 2.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.peek.on { display: block; }
.peek-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-bottom: 2px solid var(--ink); background: var(--sand); }
.peek-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek canvas { display: block; width: 100%; height: auto; }
.peek-note { font-size: 11.5px; color: var(--ink-2); padding: 4px 10px; border-top: 1.5px solid var(--ink); }

/* 연습 */
.prac-wrap { display: grid; grid-template-columns: 280px minmax(0, 720px); gap: 24px; justify-content: center; padding: 20px; min-height: 100vh; align-items: start; }
.prac-side { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.prac-list { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; counter-reset: g; }
.prac-list li { counter-increment: g; display: flex; gap: 8px; align-items: baseline; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--rule); box-shadow: inset 4px 0 0 var(--ac, transparent); }
.prac-list li::before { content: counter(g, decimal-leading-zero); font: 500 11px var(--mono); color: var(--mute); }
.prac-list li i { margin-left: auto; font: 600 12px var(--mono); font-style: normal; color: var(--ink-2); }
.prac-list li:hover { background: var(--sand); }
.prac-list li.on { background: var(--ink); color: var(--paper-hi); }
.prac-list li.on i, .prac-list li.on::before { color: var(--paper-hi); }
.prac-back { padding: 10px; border-top: 2px solid var(--ink); }
.prac-main { display: flex; flex-direction: column; gap: 10px; width: min(720px, calc((100vh - 170px) * 4 / 3)); }
.prac-foot { display: flex; gap: 22px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.prac-foot b { color: var(--ink); font-size: 16px; }
.ov .card .big-score { font: 400 72px/1 var(--disp); margin: 4px 0 6px; }
.ov .card .rec { display: inline-block; margin-bottom: 8px; }

/* 상단 바 · 계정 · 언어 */
.topbar { display: flex; align-items: center; gap: 14px; justify-content: flex-end; margin-bottom: 8px; min-height: 40px; }
.topbar .online { margin-right: auto; font-size: 12px; color: var(--ink-2); letter-spacing: .06em; }
.lang { border: 2px solid var(--ink); background: var(--paper-hi); font: 600 13px var(--sans); padding: 5px 8px; border-radius: 2px; cursor: pointer; }
.menu-tools { display: grid; gap: 6px; }
.help-dialog { width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); background: var(--paper-hi); color: var(--ink); font: inherit; }
.help-dialog::backdrop { background: rgba(29, 27, 24, .6); }
.help-heading { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 2px solid var(--ink); background: var(--sand); }
.help-heading h2 { margin: 0; font-size: 28px; line-height: 1.2; }
.help-heading .btn { flex: none; }
.help-body { padding: 20px 22px; }
.help-body section + section { margin-top: 18px; }
.help-body h3 { margin: 0 0 6px; font-size: 16px; }
.help-body p { margin: 0; color: var(--ink-2); line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere; }
.help-body .help-note { margin-top: 20px; padding-top: 12px; border-top: 1px dashed var(--mute); font-size: 13px; }
.acct { display: flex; align-items: center; }
.me-chip { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); background: var(--paper-hi); padding: 4px 6px 4px 10px; box-shadow: 3px 3px 0 var(--ink); }
.me-chip b { font-size: 14px; }
.me-chip .mono { font-size: 13px; font-weight: 700; }
.tier { display: inline-block; font: 700 11px var(--sans); color: #fff; background: var(--tc, var(--ink)); border: 1.5px solid var(--ink); padding: 0 6px; border-radius: 3px; letter-spacing: .02em; white-space: nowrap; }
.sheet-head b { font-weight: 600; }
.mast { padding-bottom: 18px; margin-bottom: 24px; }
.mast h1 { margin-top: 4px; font-size: clamp(48px, 8.4vw, 108px); }
.lede { font-size: 16px; margin-top: 14px; }
.card-play { gap: 0; }
.card-play > .btn.big:first-of-type { margin-top: 18px; }
.btn.big.locked { background: var(--sand); color: var(--ink-2); }
.invite { display: flex; gap: 10px; margin: 14px 18px 0; }
.invite input { flex: 1; min-width: 0; border: 2px solid var(--ink); background: #fff; padding: 8px 10px; font-size: 17px; letter-spacing: .25em; text-transform: uppercase; }
.card-play > .btn.big.ghostish { margin: 14px 18px 18px; }
.menu-grid.lower { grid-template-columns: 1fr; align-items: start; }
[hidden], .hud-title span:empty { display: none !important; }
.lb-list { list-style: none; margin: 0; padding: 8px 14px 14px; display: flex; flex-direction: column; }
.lb-list li { display: grid; grid-template-columns: 26px auto 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.lb-list li i { font-style: normal; color: var(--mute); font-size: 12px; }
.lb-list li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list li.empty { display: block; color: var(--mute); border: 0; }
.rate-line { margin-top: 6px; font-size: 15px; }
.rate-line .up { color: var(--teal); }
.rate-line .down { color: var(--red); }
.tag.big-count { font: 400 64px var(--disp); padding: 6px 26px; }

/* 경기 중에는 시스템 커서를 숨기고 캔버스에 십자선을 그린다 */
.stage canvas.playing { cursor: none; }

/* 패널 말풍선 */
/* 캐릭터 머리 위 말풍선(꼬리가 머리를 가리킨다) */
.pn { overflow: visible; }
.pn canvas { overflow: hidden; }
.pn .bub { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); max-width: 96%; display: none; z-index: 2; background: var(--paper-hi); border: 1.5px solid var(--ink); border-radius: 6px; font-size: 10.5px; font-weight: 700; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 2px 2px 0 var(--ink); }
.pn .bub::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 7px; height: 7px; background: var(--paper-hi); border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.pn .bub.on { display: block; animation: tin .18s ease-out; }
.side.tiny .pn .bub { font-size: 9px; padding: 0 3px; }

/* 종목 투표 */
.vote { pointer-events: auto; width: min(600px, 94%); background: var(--paper-hi); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 16px 18px 18px; }
.vote-top { display: flex; justify-content: space-between; align-items: center; }
.vote-top b { font: 400 30px var(--disp); }
.vote-top span { font-size: 26px; font-weight: 700; background: var(--ink); color: var(--paper-hi); min-width: 44px; text-align: center; padding: 0 8px; }
.vote-cut { margin: 6px 0 12px; font-size: 15px; font-weight: 600; }
.vote-cut b { color: var(--red); font-size: 22px; }
.vote-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vopt { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; border: 2.5px solid var(--ink); background: var(--paper); padding: 10px 10px 34px; cursor: pointer; font: inherit; color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transition: transform .08s; }
.vopt:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.vopt.on { background: var(--yel); }
.vopt:disabled { cursor: default; }
.vopt kbd { position: absolute; top: 6px; right: 8px; font: 700 11px var(--mono); color: var(--mute); }
.vopt { border-top: 7px solid var(--ac, var(--ink)); }
.vopt b { font: 400 21px/1.1 var(--disp); }
.vopt span { font-size: 12px; color: var(--ink-2); }
.vbar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 18px; border: 2px solid var(--ink); background: var(--paper-hi); }
.vbar u { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--red); transition: width .25s; }
.vbar em { position: absolute; right: 5px; top: -1px; font-style: normal; font-size: 12px; font-weight: 700; }
.vote-note { margin-top: 10px; font-size: 13px; color: var(--mute); text-align: center; }
.feed li .k.flip, .feed li .k.fog, .feed li .k.tiny { background: #d9d2f0; }
.feed li .k.steal, .feed li .k.bomb { background: #f6c8bd; }
.feed li .k.insurance { background: #cfe8e3; }

.snd { position: fixed; right: 14px; bottom: 14px; z-index: 40; display: flex; align-items: center; gap: 6px; border: 2px solid var(--ink); background: var(--paper-hi); box-shadow: 3px 3px 0 var(--ink); padding: 4px 10px 4px 6px; font: 700 12px var(--sans); cursor: pointer; }
.snd svg { width: 20px; height: 20px; display: block; }
.snd.off { background: var(--sand); color: var(--mute); }
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper-hi); padding: 8px 16px; font-weight: 700; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--red); animation: tin .18s ease-out; }
.toast.warn { background: var(--red); box-shadow: 4px 4px 0 var(--ink); }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } }

@media (max-width: 1100px) {
  .menu-grid, .menu-grid.lower { grid-template-columns: 1fr; }
  .room-main { grid-template-columns: 1fr; }
  .room-main .chat-slot { height: 260px; }
  .mast-stamp { display: none; }
}
@media (max-width: 1000px) {
  #scr-game.on { height: auto; overflow: auto; }
  .arena { grid-template-columns: 1fr; height: auto; }
  .side { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .center { width: 100%; min-width: 0; order: -1; }
  .dock { grid-template-columns: auto 1fr; height: auto; }
  .game-chat { grid-column: 1 / -1; height: 150px; }
  .me-body { flex-direction: column; align-items: center; }
  .me-form { width: 100%; }
  .room-head { flex-direction: column; gap: 12px; align-items: flex-start; }
  .room-foot { flex-wrap: wrap; }
  .host-ctl { flex-wrap: wrap; }
  .prac-wrap { grid-template-columns: 1fr; }
  .prac-main { width: 100%; order: -1; }
  .prac-side { max-height: 320px; }
  .peek { width: min(360px, calc(100vw - 24px)); left: 12px; right: auto; }
}
