:root {
  --card: rgba(236, 235, 229, 0.94);
  --ink: #23221f;
  --ink-soft: #55534d;
  --accent: #2f5d8a;
  --font: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10141c; font-family: var(--font); font-size: 16px; color: var(--ink); }
#app { position: fixed; inset: 0; }
#app canvas { display: block; touch-action: none; position: relative; z-index: 1; } /* 상영관 유튜브(CSS3D)가 캔버스 뒤에 깔린다 */
[hidden] { display: none !important; }

button {
  font: inherit; font-size: 16px; min-height: 40px; padding: 0 14px;
  border: 1px solid #b9b6ac; border-radius: 10px; background: #f6f5f0; color: var(--ink); cursor: pointer;
}
button:hover { background: #fff; }
a.btn {
  font: inherit; font-size: 16px; min-height: 40px; padding: 0 14px;
  border: 1px solid #b9b6ac; border-radius: 10px; background: #f6f5f0; color: var(--ink); cursor: pointer;
}
a.btn:hover { background: #fff; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-height: 48px; padding: 0 28px; }
button.primary:hover { background: #3a6d9e; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; overflow-y: auto; background: rgba(10, 13, 20, 0.55); padding: 16px; z-index: 10; }
.enter-card { background: var(--card); border-radius: 16px; padding: 28px 28px 20px; max-width: 460px; width: 100%; text-align: center; line-height: 1.6; }
.enter-card h1 { margin: 0 0 8px; font-size: 28px; }
.enter-card p { margin: 0 0 16px; }
.enter-card .name-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
#enter-name { width: 9em; max-width: calc(100% - 150px); min-width: 0; font: inherit; font-weight: 700; padding: 6px 10px; border: 1px solid #b9b5aa; border-radius: 8px; background: #f7f6f1; color: #23221f; text-align: center; }
#enter-name:focus { outline: 2px solid #3d5a80; outline-offset: 1px; }
.enter-card .name-err { margin: -10px 0 12px; color: #b0412e; font-size: 14px; }
.look-box { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 4px 0 14px; flex-wrap: wrap; }
#look-preview { width: 150px; height: 180px; background: #dedcd3; border-radius: 12px; }
#look-opts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.look-opt { display: grid; grid-template-columns: 72px 36px 104px 36px; align-items: center; gap: 4px; font-size: 15px; }
.look-opt button { min-height: 32px; padding: 0; font-size: 13px; }
.look-lab { color: var(--ink-soft); text-align: left; }
.look-val { text-align: center; font-weight: 600; }
.enter-card .small { font-size: 14px; color: var(--ink-soft); margin: 14px 0 0; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.card { position: absolute; pointer-events: auto; background: var(--card); border-radius: 12px; padding: 10px 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
#title { top: 16px; left: 16px; display: flex; gap: 14px; align-items: baseline; }
#title b { font-size: 18px; }
#count { color: var(--ink-soft); }
#timer { top: 16px; right: 16px; min-width: 200px; }
#timer #pomo-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
#timer .row { display: flex; gap: 8px; margin: 8px 0; }
#today { font-size: 14px; color: var(--ink-soft); }
#actions { bottom: 16px; left: 50%; transform: translateX(-50%); width: max-content; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 32px); }
#hint { top: 76px; left: 16px; font-size: 14px; color: var(--ink-soft); max-width: 460px; line-height: 1.5; }
#chat { bottom: 84px; left: 16px; width: min(400px, calc(100% - 32px)); padding: 10px; }
#chat-log { max-height: 190px; overflow-y: auto; font-size: 15px; line-height: 1.55; margin-bottom: 8px; overflow-wrap: anywhere; }
#chat-log:empty { display: none; }
#chat-log .who { min-height: 0; padding: 0 4px 0 0; border: none; background: none; font-size: 15px; font-weight: 700; color: var(--accent); cursor: pointer; }
#chat-log .who:disabled { cursor: default; color: var(--ink-soft); }
#chat-form { display: flex; gap: 6px; }
#chat-input { flex: 1; min-width: 0; font: inherit; font-size: 16px; min-height: 40px; padding: 0 10px; border: 1px solid #b9b6ac; border-radius: 10px; background: #fbfaf6; color: var(--ink); }
#toast { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); background: rgba(20, 22, 28, 0.82); color: #f4f2ec; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
#toast.show { opacity: 1; }

/* 시스템 알림창 */
#notice { position: absolute; top: 150px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(640px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.notice { background: rgba(12, 16, 28, 0.9); border: 1px solid #6fb7ff; border-radius: 6px; box-shadow: 0 0 18px rgba(111, 183, 255, 0.35), inset 0 0 12px rgba(111, 183, 255, 0.12); color: #e9f2ff; padding: 10px 20px; font-size: 16px; line-height: 1.5; letter-spacing: 0.02em; text-align: center; white-space: pre-line; word-break: keep-all; opacity: 0; transform: translateY(-8px); transition: opacity 0.35s, transform 0.35s; }
.notice.show { opacity: 1; transform: none; }
.notice .tag { color: #8fd0ff; font-weight: 700; margin-right: 8px; }
.notice.gold { border-color: #e8c36a; box-shadow: 0 0 18px rgba(232, 195, 106, 0.4), inset 0 0 12px rgba(232, 195, 106, 0.14); }
.notice.gold .tag { color: #f0d488; }
.notice.watch { border-color: #b48cff; box-shadow: 0 0 20px rgba(180, 140, 255, 0.45), inset 0 0 12px rgba(180, 140, 255, 0.16); color: #efe6ff; }

/* 구역 이동 */
#zones { top: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 8px; flex-wrap: wrap; justify-content: center; }
#zones button { min-height: 36px; padding: 0 12px; font-size: 15px; }
#zones button.here { background: var(--accent); border-color: var(--accent); color: #fff; }
.card-title { font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title button { min-height: 32px; font-size: 14px; padding: 0 10px; }

/* 카페 메뉴 */
#cafe-menu { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; padding: 14px; z-index: 6; }
.cafe-sec { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin: 4px 0 6px; }
.cafe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 10px; }
.cafe-list button { text-align: left; min-height: 48px; font-size: 15px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 10px; line-height: 1.35; }
.cafe-list small { font-size: 14px; color: var(--ink-soft); }

/* 퀴즈 방 */
#quiz { top: 150px; right: 16px; width: min(340px, calc(100% - 32px)); max-height: calc(100% - 260px); overflow-y: auto; }
#quiz .qz-h { font-weight: 800; font-size: 17px; margin: 4px 0 6px; }
#quiz .qz-meta { color: #6a675e; font-size: 13px; }
#quiz .qz-q { font-weight: 700; font-size: 17px; margin: 6px 0 8px; line-height: 1.4; }
#quiz .qz-note, #quiz .qz-why { font-size: 14px; color: #55524a; margin-top: 8px; line-height: 1.45; }
#quiz .qz-why { color: #2d2b26; font-weight: 600; }
#quiz .qz-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#quiz .qz-choices { display: grid; gap: 6px; }
#quiz .qz-choices.ox { grid-template-columns: 1fr 1fr; }
#quiz .qz-c { text-align: left; border-left: 8px solid var(--c); min-height: 44px; display: flex; align-items: center; gap: 6px; }
#quiz .qz-choices.ox .qz-c { justify-content: center; font-size: 26px; font-weight: 900; color: var(--c); border-left-width: 1px; }
#quiz .qz-c span { margin-left: auto; font-size: 13px; color: #6a675e; }
#quiz .qz-c.mine { outline: 3px solid var(--c); background: #fff; }
#quiz .qz-c.ok { background: #fff6c8; font-weight: 800; }
#quiz .qz-c.no { opacity: 0.45; }
#quiz .qz-bar { height: 8px; background: #d8d5cc; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
#quiz .qz-bar i { display: block; height: 100%; background: #2f7fe0; transition: width 0.25s linear; }
#quiz .qz-rank { margin: 4px 0; padding-left: 22px; font-size: 15px; line-height: 1.6; }
#quiz .qz-rank .me { font-weight: 800; }
/* 대련실 */
#dojo { top: 72px; left: 50%; transform: translateX(-50%); width: min(780px, calc(100% - 32px)); padding: 10px 14px; z-index: 6; background: rgba(28, 24, 20, 0.9); color: #f1e6c8; }
.dj-bars { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.dj-side .dj-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 16px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj-side.right .dj-name { flex-direction: row; }
.dj-wins { color: #ffd27a; letter-spacing: 2px; font-size: 14px; }
.dj-hp { height: 16px; background: #3a2f2a; border: 1px solid #6b5a4a; border-radius: 4px; overflow: hidden; display: flex; }
.dj-hp i { display: block; height: 100%; width: 100%; background: linear-gradient(#ffe36b, #e8a000); transition: width 0.25s; }
.dj-hp i.low { background: linear-gradient(#ff8a7a, #d8362b); }
.dj-side.right .dj-hp { justify-content: flex-end; }
.dj-mid { text-align: center; min-width: 96px; }
#dj-round { font-size: 13px; color: #d9c9a8; letter-spacing: 0.08em; }
#dj-clock { font: 800 30px/1.1 var(--font); font-variant-numeric: tabular-nums; color: #fff; }
.dj-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: #e4d8c0; }
.dj-row button { min-height: 34px; font-size: 14px; padding: 0 12px; }
#dj-forfeit { border-color: #d8463b; color: #d8463b; }
#dj-special { border-color: #2f7fe0; color: #1f5fb0; font-weight: 700; }
#dj-special:disabled, #dj-drill:disabled { opacity: 0.5; cursor: default; }
#dj-drill { border-color: #b98a2c; color: #7a5a12; }
#dj-quiz { top: 240px; right: 16px; width: min(360px, calc(100% - 32px)); padding: 10px 12px; z-index: 8; background: rgba(16, 22, 40, 0.93); color: #eaf4ff; border: 1px solid #6fb7ff; box-shadow: 0 0 18px rgba(111, 183, 255, 0.4); }
.dj-quiz-bar { height: 6px; background: #26324d; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.dj-quiz-bar i { display: block; height: 100%; width: 100%; background: #7fe0ff; }
#dj-quiz-q { font-weight: 700; font-size: 17px; line-height: 1.4; margin-bottom: 8px; word-break: keep-all; }
#dj-quiz-c { display: grid; grid-template-columns: 1fr; gap: 6px; }
#dj-quiz-c button { text-align: left; min-height: 44px; font-size: 15px; line-height: 1.3; padding: 6px 10px; word-break: keep-all; }
#dj-quiz-c button b { color: var(--accent); margin-right: 4px; }
#dj-quiz-c button.mine { outline: 3px solid #7fe0ff; }
#dj-quiz-c button.ok { background: #fff6c8; font-weight: 800; }
#dj-quiz-c button:disabled { cursor: default; }
#dj-quiz-note { font-size: 13px; color: #b9cbe6; margin-top: 8px; line-height: 1.4; }
.dj-pad-r button[data-k="s"] { border-color: #6fb7ff; color: #bfe6ff; }
#dock { display: none; }
#dj-banner.long { font-size: clamp(26px, 4.4vw, 54px); }
#dj-how { position: absolute; top: 190px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: rgba(28, 24, 20, 0.82); color: #e4d8c0; font-size: 14px; line-height: 1.4; padding: 6px 14px; border-radius: 10px; text-align: center; pointer-events: none; z-index: 6; }
#dj-banner { position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%); font: 900 clamp(40px, 8vw, 92px)/1 var(--font); color: #fff; text-shadow: 0 0 18px rgba(255, 190, 60, 0.9), 0 6px 24px rgba(0, 0, 0, 0.7); letter-spacing: 0.04em; white-space: nowrap; pointer-events: none; z-index: 9; }
#dj-banner.pop { animation: djpop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes djpop { 0% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
body.in-dojo #notice { top: 232px; }
body.in-dojo.dj-fighting #notice { top: 282px; } /* 조작 안내 한 줄 아래로 */
body.in-dojo #hint { display: none; } /* 대련 카드와 겹친다 */
#dj-pad { position: absolute; left: 16px; right: 16px; bottom: 96px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 7; }
.dj-pad-l, .dj-pad-r { display: flex; gap: 10px; align-items: flex-end; }
#dj-pad button { pointer-events: auto; width: 64px; height: 64px; border-radius: 50%; font-size: 15px; padding: 0; white-space: nowrap; font-weight: 700; background: rgba(28, 24, 20, 0.75); color: #f1e6c8; border: 2px solid #8a7256; touch-action: none; user-select: none; }
.dj-pad-r button[data-k="p"], .dj-pad-r button[data-k="k"] { border-color: #d8463b; }
/* 모카와 사진 */
#photo { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100% - 32px)); padding: 12px; z-index: 9; }
#photo-img { display: block; width: 100%; border-radius: 6px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); }
#photo .mocha-note { margin: 8px 0 0; }
#photo-save.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; font-weight: 700; }
#photo-count { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font: 900 120px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); pointer-events: none; z-index: 9; }
#photo-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 10; }
#photo-flash.go { animation: photoflash 0.6s ease-out; }
@keyframes photoflash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
/* 게임룸 게임 창 */
#arcade { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(900px, calc(100% - 32px), calc((100vh - 150px) * 4 / 3)); padding: 12px; z-index: 8; }
#arcade-canvas { display: block; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 8px; touch-action: none; outline: none; }
#arcade-score { font-variant-numeric: tabular-nums; margin-right: 6px; }
#arcade .mocha-note { margin: 8px 0 0; }

/* 상영관 */
#tv-bar { left: 50%; bottom: 84px; transform: translateX(-50%); width: min(720px, calc(100% - 32px)); padding: 10px 14px; }
#tv-now { font-size: 15px; line-height: 1.5; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tv-row + .tv-row { margin-top: 6px; }
.tv-row button { min-height: 36px; font-size: 14px; padding: 0 10px; }
#tv-play { min-width: 52px; font-size: 18px; font-weight: 700; }
#tv-seek { flex: 1; min-width: 120px; accent-color: #c4302b; height: 28px; cursor: pointer; }
#tv-time { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
#tv-list { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(600px, calc(100% - 32px)); max-height: 80vh; overflow-y: auto; z-index: 7; padding: 14px; }
#tv-items { display: flex; flex-direction: column; gap: 6px; }
#tv-items button { text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
#tv-items small { color: var(--ink-soft); font-size: 14px; white-space: nowrap; }

/* 모카와 대화 */
#mocha-chat { right: 16px; bottom: 84px; width: min(420px, calc(100% - 32px)); max-height: min(62vh, 560px); display: flex; flex-direction: column; padding: 12px; z-index: 6; }
#mocha-chat[hidden] { display: none !important; }
.mocha-note { font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; line-height: 1.45; }
#mocha-log { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; font-size: 16px; line-height: 1.55; }
.m-line { padding: 8px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-line.me { align-self: flex-end; background: #dfe7f1; }
.m-line.mocha { align-self: flex-start; background: #f3e8da; }
.m-line.other { align-self: flex-end; background: #e6e2ef; }
.m-line.thinking { color: var(--ink-soft); font-style: italic; }
.m-line.note { align-self: center; background: #e3efe0; font-size: 14px; color: #2f5a2f; }
#mocha-form { display: flex; gap: 6px; }
#mocha-input { flex: 1; min-width: 0; font: inherit; font-size: 16px; min-height: 40px; padding: 0 10px; border: 1px solid #b9b6ac; border-radius: 10px; background: #fbfaf6; color: var(--ink); }

@media (max-width: 900px) {
  body.in-theater #chat { display: none; } /* 막대와 겹치지 않게 */
  #hint { display: none; }
  #zones { top: auto; bottom: 84px; left: 16px; transform: none; }
  #chat { bottom: 140px; }
}

@media (max-width: 640px) {
  #title { flex-direction: column; gap: 2px; }
  #timer { top: 84px; right: 16px; min-width: 0; }
  #dojo { top: 150px; }
  body.in-dojo #notice { top: 300px; }
  #dj-pad { bottom: 190px; }
  #hint { display: none; }
  #chat { bottom: 186px; }
  #zones { bottom: 132px; }
  #mocha-chat { left: 16px; right: 16px; width: auto; bottom: 132px; max-height: 55vh; }
  #tv-bar { bottom: 132px; }
  body.mocha-open #chat { display: none; }
  #chat-log { max-height: 110px; }
}

/* 좁은 화면(휴대폰 세로 · 가로): main.js 가 body.compact 를 붙인다. 카드를 작게, 구역 · 동작 · 채팅은 아래 막대(#dock)에서 꺼내는 판으로. */
body.compact .card { padding: 8px 10px; border-radius: 10px; }
body.compact #title { top: 8px; left: 8px; padding: 6px 10px; flex-direction: row; gap: 8px; align-items: baseline; font-size: 13px; max-width: calc(100% - 128px); white-space: nowrap; overflow: hidden; }
body.compact #title b { font-size: 14px; }
body.compact #count { overflow: hidden; text-overflow: ellipsis; }
body.compact #timer { top: 8px; right: 8px; min-width: 0; padding: 6px 10px; font-size: 13px; cursor: pointer; }
body.compact #timer #pomo-time { font-size: 15px; }
body.compact #timer .row, body.compact #timer #today { display: none; }
body.compact #timer.open .row { display: flex; margin: 6px 0; }
body.compact #timer.open #today { display: block; }
body.compact #hint { display: none; }
body.compact #dock { display: flex; gap: 6px; bottom: 8px; left: 50%; transform: translateX(-50%); padding: 5px; z-index: 6; }
body.compact #dock button { min-height: 38px; padding: 0 16px; font-size: 15px; white-space: nowrap; }
body.compact #dock button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
body.compact #zones, body.compact #actions, body.compact #chat { display: none; }
body.compact.m-zones #zones, body.compact.m-actions #actions { display: flex; top: auto; left: 8px; right: 8px; transform: none; width: auto; max-width: none; padding: 8px; z-index: 6; }
body.compact #zones button, body.compact #actions button { flex: 1 1 28%; min-height: 40px; padding: 0 8px; font-size: 15px; }
body.compact.m-chat #chat { display: block; left: 8px; right: 8px; width: auto; z-index: 6; }
body.compact #chat-log { max-height: 30vh; }
body.compact #notice { top: 50px; max-width: calc(100% - 16px); gap: 6px; }
body.compact .notice { font-size: 14px; padding: 7px 12px; }
body.compact #toast { bottom: 64px; font-size: 14px; white-space: nowrap; }
body.compact #quiz { top: 48px; right: 8px; width: min(320px, calc(100% - 16px)); max-height: calc(100% - 120px); }
body.compact #tv-bar { left: 8px; right: 8px; transform: none; width: auto; padding: 6px 8px; }
body.compact #mocha-chat { left: 8px; right: 8px; width: auto; max-height: 55vh; }
/* 대련실 */
body.compact #dojo { top: 46px; left: 8px; right: 8px; transform: none; width: auto; padding: 6px 8px; }
body.compact .dj-bars { gap: 8px; }
body.compact .dj-side .dj-name { font-size: 13px; margin-bottom: 2px; }
body.compact .dj-wins { font-size: 11px; letter-spacing: 1px; }
body.compact .dj-hp { height: 10px; }
body.compact .dj-mid { min-width: 54px; }
body.compact #dj-round { font-size: 11px; }
body.compact #dj-clock { font-size: 20px; }
body.compact .dj-row { margin-top: 5px; gap: 5px; font-size: 12px; flex-wrap: nowrap; }
body.compact .dj-row button { min-height: 30px; font-size: 13px; padding: 0 8px; white-space: nowrap; flex: none; }
body.compact #dj-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.compact #dj-how { display: none; }
body.compact #dj-banner { top: 44%; }
body.compact.in-dojo #notice, body.compact.in-dojo.dj-fighting #notice { top: 132px; }
body.compact #dj-quiz { left: 8px; right: 8px; width: auto; padding: 8px; background: rgba(16, 22, 40, 0.86); }
body.compact #dj-quiz-c { grid-template-columns: 1fr 1fr; }
body.compact #dj-quiz-q { font-size: 15px; margin-bottom: 6px; }
body.compact #dj-quiz-c button { min-height: 38px; font-size: 14px; padding: 4px 8px; }
body.compact #dj-quiz-note { font-size: 12px; margin-top: 5px; }
body.compact #dj-pad { left: 8px; right: 8px; bottom: 10px; }
body.compact #dj-pad button { width: 56px; height: 56px; font-size: 13px; padding: 0; white-space: nowrap; letter-spacing: -0.5px; }
body.compact .dj-pad-l, body.compact .dj-pad-r { gap: 6px; }
body.compact .dj-pad-r { flex-wrap: wrap; justify-content: flex-end; max-width: 190px; }
body.compact.dj-fighting #dock { display: none; } /* 매트 위에서는 조작 단추만 */
body.compact.dj-fighting #zones, body.compact.dj-fighting #actions, body.compact.dj-fighting #chat { display: none; }

/* 인형 뽑기(claw.js, 11-12): 위 가운데 작은 판 + 휴대폰은 아래 방향 단추 */
#claw { top: 156px; right: 16px; width: min(330px, calc(100% - 32px)); padding: 10px 14px; z-index: 6; background: rgba(26, 15, 58, 0.92); color: #f3ecff; border: 1px solid #b48cff; }
#claw .cl-top { display: flex; gap: 12px; align-items: baseline; font-size: 16px; }
#claw .cl-top b { color: #ffe36b; font-size: 17px; }
#cl-time { font: 800 22px/1 var(--font); font-variant-numeric: tabular-nums; color: #fff; min-width: 3em; }
#cl-time.low { color: #ff7a8a; }
#cl-count { margin-left: auto; color: #d9c8ff; font-size: 14px; }
#cl-msg { min-height: 1.4em; margin-top: 4px; font-size: 14px; color: #e8dcff; }
#claw .cl-row { display: flex; gap: 8px; margin-top: 6px; }
#claw .cl-row button { min-height: 34px; font-size: 14px; padding: 0 12px; }
#cl-drop { border-color: #ffd23f; color: #6a4b00; font-weight: 700; }
#cl-drop:disabled { opacity: 0.5; cursor: default; }
#cl-pad { position: absolute; left: 16px; right: 16px; bottom: 96px; display: flex; justify-content: space-between; align-items: flex-end; z-index: 7; pointer-events: none; }
.cl-arrows { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cl-arrows > div { display: flex; gap: 6px; }
#cl-pad button { pointer-events: auto; width: 60px; height: 60px; border-radius: 50%; font-size: 20px; padding: 0; background: rgba(26, 15, 58, 0.78); color: #f3ecff; border: 2px solid #b48cff; touch-action: none; user-select: none; }
body.compact #claw { top: 8px; right: 8px; width: min(300px, calc(100% - 16px)); padding: 8px 10px; }
body.compact #cl-pad { left: 8px; right: 8px; bottom: 10px; }
body.compact #cl-pad button { width: 54px; height: 54px; }
body.claw-on #hint, body.claw-on #zones, body.claw-on #actions, body.claw-on #dock { visibility: hidden; }
#cl-pad #cl-pad-drop { width: 84px; height: 84px; font-size: 17px; font-weight: 800; background: rgba(255, 210, 63, 0.9); color: #3a2a00; border-color: #fff3b0; }
#cl-pad #cl-pad-drop:disabled { opacity: 0.45; }

/* 필살기 시간 정지 · 같이 푸는 문제(11-12): 잿빛 화면 · 멈춘 시계 · 방어 측 창(노랑) · 구경꾼 창 · 남이 틀린 답(빨간 테) */
#app > canvas { transition: filter 0.25s; }
body.dj-stop #app > canvas { filter: grayscale(0.85) brightness(0.9) contrast(1.05); }
#dj-clock.stop { color: #7fe0ff; }
#dj-quiz-who { font-size: 13px; font-weight: 700; color: #7fe0ff; margin-bottom: 6px; letter-spacing: 0.02em; }
#dj-quiz.defender { border-color: #ffd27a; box-shadow: 0 0 18px rgba(255, 210, 122, 0.45); }
#dj-quiz.defender #dj-quiz-who { color: #ffd27a; }
#dj-quiz.view { background: rgba(16, 22, 40, 0.82); }
#dj-quiz-c button.pick { outline: 3px solid #ff7a8a; }

/* 스태미너(11-12): 체력 밑 얇은 막대. 모자라서 동작이 안 나오면 깜빡이며 「숨 고르기」 */
.dj-st { position: relative; height: 6px; margin-top: 3px; background: #4d4639; border-radius: 3px; overflow: visible; display: flex; }
.dj-st i { display: block; height: 100%; width: 100%; border-radius: 3px; background: linear-gradient(#9be27a, #4fae3a); transition: width 0.1s linear; }
.dj-side.right .dj-st { justify-content: flex-end; }
.dj-st.low i { background: linear-gradient(#ffd27a, #e09a20); }
.dj-st.tired { animation: dj-st-blink 0.3s steps(2) infinite; }
.dj-st.tired::after { content: '숨 고르기'; position: absolute; top: 7px; left: 0; font-size: 11px; color: #ffb27a; white-space: nowrap; }
.dj-side.right .dj-st.tired::after { left: auto; right: 0; }
@keyframes dj-st-blink { 50% { background: #7a2a20; } }
.dj-st.inline { display: inline-flex; width: 80px; height: 8px; margin: 0 4px; vertical-align: middle; }
.dj-st.inline[hidden] { display: none; }
.dj-st-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.dj-side.right .dj-st-row { flex-direction: row-reverse; }
.dj-st-row .dj-st { flex: 1; margin-top: 0; }
.dj-st-lab { flex: none; font-size: 11px; font-weight: 700; color: #9be27a; letter-spacing: -0.02em; }
.dj-st-row .dj-st.tired::after { top: 8px; }
body.compact .dj-st-lab { font-size: 10px; }

/* 에어하키(hockey.js, 11-12): 인형 뽑기 판과 같은 자리 · 파란 테 */
#hockey { top: 156px; right: 16px; width: min(330px, calc(100% - 32px)); padding: 10px 14px; z-index: 6; background: rgba(10, 22, 48, 0.92); color: #eaf4ff; border: 1px solid #4fa8ff; }
#hockey .hk-top { display: flex; gap: 12px; align-items: baseline; font-size: 16px; }
#hockey .hk-top b { color: #7fd0ff; font-size: 17px; }
#hk-score { margin-left: auto; font: 800 18px/1 var(--font); font-variant-numeric: tabular-nums; color: #fff; }
#hk-msg { min-height: 1.4em; margin-top: 4px; font-size: 14px; color: #cfe6ff; }
#hockey .hk-row { display: flex; gap: 8px; margin-top: 6px; }
#hockey .hk-row button { min-height: 34px; font-size: 14px; padding: 0 12px; }
#hk-again { border-color: #ffd23f; color: #6a4b00; font-weight: 700; }
body.compact #hockey { top: 8px; right: 8px; width: min(300px, calc(100% - 16px)); padding: 8px 10px; }

/* 안개의 방(11-13) */
#fog { right: 16px; bottom: 84px; width: min(330px, calc(100% - 32px)); background: rgba(30, 28, 44, 0.9); color: #ece6fa; }
#fog .fog-title { font-weight: 700; margin-bottom: 8px; }
#fog .fog-row { display: flex; gap: 8px; }
#fog .fog-row button { flex: 1; min-height: 54px; padding: 0 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; background: #3b3654; color: #f3eefc; border-color: #6d6292; font-weight: 700; touch-action: manipulation; user-select: none; -webkit-user-select: none; white-space: nowrap; }
#fog .fog-row button small { font-weight: 400; font-size: 12px; color: #c9bfe6; }
#fog .fog-row button:hover { background: #4a4468; }
#fog .fog-row button.hit { background: #7a6ea6; }
#fog .fog-how { font-size: 13px; color: #c9bfe6; margin-top: 8px; line-height: 1.45; }
body.compact #fog { right: 8px; bottom: 58px; width: min(300px, calc(100% - 16px)); padding: 8px; }
body.compact #fog .fog-title, body.compact #fog .fog-how { display: none; }
/* 위쪽 자리 나누기(11-14, 구역 단추 열한 개): 왼쪽 열(이름 카드 · 안내 카드, 폭 372 px 안) | 가운데(구역 단추) | 오른쪽(집중 타이머 232 px).
   구역 단추는 두 카드 사이 폭 안에서 줄을 바꾼다 — 예전에는 가운데 고정이라 1180 px 아래에서 이름 카드를, 1440–1600 px 에서 안내 카드를 덮었다.
   알림은 구역 단추 아래(main.js 가 --zones-b 를 잰다). */
@media (min-width: 901px) {
  #zones { left: 400px; right: 232px; transform: none; justify-content: center; }
  #title { max-width: 372px; }
  #title b { flex: none; white-space: nowrap; }
  #title #count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #hint { max-width: 372px; }
  #notice { top: max(150px, calc(var(--zones-b, 0px) + 12px)); }
}
@media (min-width: 901px) and (max-width: 1399px) {
  #zones button { min-height: 34px; padding: 0 10px; font-size: 14px; }
}

/* 포탈의 방(11-14): 오른쪽 아래 카드 · 빨려 드는 동안 화면 덮개(취소 단추) */
#portal { right: 16px; bottom: 84px; width: min(330px, calc(100% - 32px)); background: rgba(28, 24, 48, 0.92); color: #ece6fa; }
#portal .portal-title { font-weight: 700; margin-bottom: 6px; }
#portal .portal-how { font-size: 13px; color: #c9bfe6; line-height: 1.45; margin-bottom: 10px; }
#portal .portal-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#portal .portal-list button { min-height: 40px; padding: 0 4px; background: #3b3654; color: #f3eefc; border-color: #6d6292; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; touch-action: manipulation; }
#portal .portal-list button:hover { background: #4a4468; }
#portal .portal-list button.near { background: #5b45b8; border-color: #8a74e6; color: #fff; }
#portal .portal-foot { font-size: 12px; color: #b3a8d6; margin-top: 8px; line-height: 1.4; }
body.compact #portal { right: 8px; bottom: 58px; width: min(300px, calc(100% - 16px)); padding: 8px; }
body.compact #portal .portal-how, body.compact #portal .portal-foot { display: none; }
body.compact #portal .portal-list button { min-height: 36px; font-size: 13px; }
#warp { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
#warp .warp-box { background: rgba(20, 14, 44, 0.78); color: #f1ebff; border: 1px solid #8a74e6; border-radius: 14px; padding: 18px 22px; display: grid; gap: 12px; width: min(340px, 100%); text-align: center; }
#warp .warp-title { font-size: 18px; font-weight: 700; }
#warp .warp-host { font-size: 13px; color: #c9bfe6; margin-top: -6px; }
#warp .warp-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#warp .warp-bar i { display: block; height: 100%; width: calc(var(--k, 0) * 100%); background: linear-gradient(90deg, #8f74ff, #6fd6ff); }
#warp-cancel { min-height: 42px; background: #3b3654; color: #f3eefc; border-color: #6d6292; }
#warp-cancel small { color: #c9bfe6; margin-left: 4px; }
