/* 탄산 방울 대전 */
:root {
  --bg: #0e1628; --bg2: #172238; --panel: #1f2d49; --line: rgba(255,255,255,0.13);
  --text: #f1f6ff; --dim: #9fb0cc; --accent: #5fe0ff; --gold: #ffd34d; --go: #58d68d; --red: #ff6b6b;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 50% -10%, #1d3358, var(--bg) 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  word-break: keep-all; overflow-wrap: break-word;   /* 한글은 낱말 단위로 줄바꿈 */
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }

/* 상단 바 */
.topbar { display: flex; align-items: center; gap: 8px; height: calc(44px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0; flex: none; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--line); color: var(--text);
  text-decoration: none; font-size: 0.82rem; font-weight: 600; white-space: nowrap;
}
.back-btn:hover { background: rgba(255,255,255,0.16); }
.tb-title { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: 6px; margin-left: auto; }
.mini { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.08); font-weight: 700; padding: 0; flex: none; }
.mini:hover { background: rgba(255,255,255,0.16); }
#pauseBtn { margin-left: 4px; }
@media (pointer: coarse) { .mini { width: 40px; height: 40px; font-size: 1rem; } #pauseBtn { margin-left: 8px; } }

/* 공통 */
.screen { flex: 1; overflow-y: auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
#scrMenu { padding-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; min-height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 700; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #6fe6ff, #35bfe8); color: #06283a; border-color: transparent; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 0.85rem; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.star { font-style: normal; color: rgba(255,255,255,0.22); }
.star.on { color: var(--gold); text-shadow: 0 0 8px rgba(255,211,77,0.5); }

/* 메뉴 */
.logo { text-align: center; margin: 6px 0 14px; }
.logo-fizz { height: 46px; display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.logo-fizz i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.25); animation: bob 2.2s ease-in-out infinite; box-shadow: inset 3px 4px 0 rgba(255,255,255,0.45); }
.logo-fizz i:nth-child(1) { background: #ff5d73; animation-delay: -0.2s; }
.logo-fizz i:nth-child(2) { background: #ffd23f; animation-delay: -0.9s; }
.logo-fizz i:nth-child(3) { background: #5fd068; animation-delay: -0.5s; width: 28px; height: 28px; }
.logo-fizz i:nth-child(4) { background: #4cb8ff; animation-delay: -1.4s; }
.logo-fizz i:nth-child(5) { background: #a678f0; animation-delay: -1.1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.logo h1 { margin: 6px 0 4px; font-size: 1.7rem; letter-spacing: -0.5px; }
.tagline { margin: 0; color: var(--dim); font-size: 0.9rem; }
.modes { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.mode-card {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: var(--r);
  background: var(--bg2); border: 1px solid var(--line); width: 100%;
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mc-ico { font-size: 1.9rem; flex: none; width: 44px; text-align: center; }
.mc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mc-body b { font-size: 1.05rem; }
.mc-body small { color: var(--dim); font-size: 0.8rem; line-height: 1.35; }
.mc-note { flex: none; color: var(--gold); font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.menu-foot { max-width: 560px; margin: 18px auto 0; text-align: center; font-size: 0.82rem; }
.menu-foot p { margin: 4px 0; line-height: 1.5; }

/* 사다리 목록 */
/* 화면 머리(메뉴 버튼·제목·정보)는 목록을 스크롤해도 위에 남는다 */
.scr-head {
  max-width: 576px; margin: 0 auto 6px; padding: 6px 8px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 5; background: rgba(18,29,50,0.94); border-radius: 0 0 12px 12px; box-shadow: 0 6px 14px rgba(8,14,28,0.55);
}
.scr-head h2 { margin: 0; font-size: 1.15rem; flex: 1; }
.scr-info { color: var(--gold); font-weight: 700; }
.scr-sub { max-width: 560px; margin: 0 auto 10px; color: var(--dim); font-size: 0.8rem; }
.ladder { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column-reverse; gap: 8px; }
.rung {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: var(--r); width: 100%;
  background: var(--bg2); border: 1px solid var(--line); border-left: 4px solid rgba(255,255,255,0.18);
}
.rung:hover:not(:disabled) { border-color: var(--accent); }
.rung.beaten { border-left-color: var(--go); }
.rung.perfect { border-left-color: var(--gold); background: #2a2a2c; }
.rung.next { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(95,224,255,0.18); }
.rung.locked { opacity: 0.45; cursor: not-allowed; }
.r-n { flex: none; width: 20px; text-align: center; font-weight: 800; color: var(--dim); }
.r-face { flex: none; font-size: 1.7rem; width: 36px; text-align: center; }
.r-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.r-body b { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job { font-style: normal; font-weight: 500; font-size: 0.72rem; color: var(--dim); margin-left: 6px; }
.r-body small { color: var(--dim); font-size: 0.74rem; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.r-home { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.r-home small { color: var(--dim); font-size: 0.66rem; }
.r-stars { flex: none; font-size: 1rem; letter-spacing: 1px; }
.b-ico { display: block; }

/* 판 */
.game { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.g-top {
  flex: none; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 0.86rem;
  background: rgba(0,0,0,0.22); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden;
}
.t-face { font-size: 1.3rem; }
.t-name { overflow: hidden; text-overflow: ellipsis; }
.t-clock { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--dim); }
.t-clock.hot { color: var(--gold); }
.t-rush { background: var(--red); color: #fff; border-radius: 999px; padding: 2px 8px; font-weight: 800; font-size: 0.76rem; animation: throb 0.7s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.08); } }
.t-wave b { color: var(--accent); }
.t-shield { margin-left: auto; color: var(--gold); font-weight: 700; }
.t-level { color: var(--dim); }
.g-zone { flex: 1; min-height: 0; display: flex; flex-direction: column; touch-action: none; cursor: grab; }
.g-main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px 6px; }
.g-bottle { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.g-bottle canvas, .g-opp canvas { display: block; will-change: transform; }
.g-side { flex: none; width: 70px; align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.g-opp { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.g-next { display: flex; flex-direction: column; align-items: center; gap: 3px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px 6px; }
.g-next span { font-size: 0.66rem; color: var(--dim); }
.g-stat { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.st { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 3px 2px; }
.st span { font-size: 0.62rem; color: var(--dim); }
.st b { font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.g-keys { display: none; }
.g-cap { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
#cap0, #cap1 { display: none; }
.g-banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  font-weight: 900; font-size: 1.5rem; padding: 8px 18px; border-radius: 14px; background: rgba(8,16,32,0.78); border: 2px solid var(--accent);
  animation: pop-in 0.22s ease-out;
}
.g-banner.count { font-size: 3rem; background: none; border: none; text-shadow: 0 3px 0 rgba(0,0,0,0.5), 0 0 24px rgba(95,224,255,0.8); }
.g-banner.rush { border-color: var(--red); color: #ffd9d9; }
.g-banner.wave { border-color: #bfe9ff; }
@keyframes pop-in { from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } }

/* 얼음 받침 */
.tray {
  flex: none; height: 36px; margin: 0 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 10px; background: rgba(0,0,0,0.28); border: 1px solid var(--line); font-size: 0.8rem; overflow: hidden;
}
.tray-empty { color: rgba(255,255,255,0.3); font-size: 0.74rem; }
.tray .pend, .tray .hold { display: inline-flex; align-items: center; gap: 3px; }
.tray .hold { opacity: 0.5; animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.tray b { margin-left: 3px; font-variant-numeric: tabular-nums; color: #dff4ff; }
.ic { display: inline-block; background: linear-gradient(135deg, #f6fcff, #a4d2ee); border: 1px solid #74aacd; }
.ic.one { width: 9px; height: 9px; border-radius: 3px; }
.ic.row { width: 24px; height: 10px; border-radius: 3px; }
.ic.big { width: 20px; height: 20px; border-radius: 5px; box-shadow: inset 0 0 0 2px rgba(116,170,205,0.5); }
.tray.small { height: 18px; width: 100%; margin: 0; font-size: 0.68rem; gap: 2px; border: none; background: none; }
.tray.small b { margin: 0; color: #fff; }
.tray.small i { font-style: normal; opacity: 0.6; }

/* 아래 띠: 흔들기·게이지 */
.g-bottom {
  flex: none; height: calc(72px + env(safe-area-inset-bottom)); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: stretch; gap: 8px;
}
.shake-btn {
  position: relative; flex: none; width: 92px; min-height: 56px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); font-weight: 800; font-size: 0.86rem; display: flex; align-items: center; justify-content: center; gap: 4px;
  opacity: 0.4; touch-action: none; padding: 0 6px;
}
.shake-btn.ready { opacity: 1; border-color: var(--accent); }
.shake-btn.ready.no { opacity: 0.6; border-color: var(--line); }
.shake-btn.glow { background: linear-gradient(180deg, #2b6f8f, #1d4c6b); box-shadow: 0 0 14px rgba(95,224,255,0.65); animation: throb 0.8s ease-in-out infinite; }
.shake-btn:active { transform: scale(0.96); }
.sk-arrow { font-size: 1rem; color: var(--accent); }
.sk-dots { position: absolute; left: 0; right: 0; bottom: 5px; display: flex; justify-content: center; gap: 3px; }
.sk-dots b { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.g-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.gauge { position: relative; height: 22px; border-radius: 999px; background: rgba(0,0,0,0.4); border: 1px solid var(--line); overflow: hidden; }
.gauge-fill { height: 100%; width: 0; background: linear-gradient(90deg, #36c6f0, #9af3ff); transition: width 0.15s; }
.gauge-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.55); }
.gauge-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800;
  /* 밝은 채움 위에서도 읽히게 어두운 테를 두른다 */
  text-shadow: -1px -1px 0 #06182a, 1px -1px 0 #06182a, -1px 1px 0 #06182a, 1px 1px 0 #06182a, 0 0 4px #06182a, 0 0 4px #06182a;
}
.g-tools { display: flex; gap: 6px; justify-content: center; }
.g-tools:empty { display: none; }

/* PC 가로 */
.game.wide .g-main { gap: 24px; }
.game.wide .g-bottle { flex: none; height: auto; flex-direction: column; }
.game.wide .g-cap { height: 26px; font-size: 0.82rem; font-weight: 700; color: var(--dim); white-space: nowrap; }
.game.wide #cap0 { display: flex; }
.game.wide #cap1 { display: inline; }
.game.wide.solo #cap0 { display: none; }
.game.wide .tray.small { width: auto; }
.game.wide .g-side { width: 180px; align-self: center; gap: 12px; }
.game.wide .g-opp { flex: none; }
.game.wide .g-opp .tray.small { height: 24px; font-size: 0.85rem; }
.game.wide .g-opp .tray.small:empty { display: none; }
.game.wide .g-stat { flex-direction: row; }
.game.wide .st { flex: 1; padding: 6px 2px; }
.game.wide .st b { font-size: 1.05rem; }
.game.wide .g-keys { display: block; font-size: 0.72rem; color: var(--dim); line-height: 1.7; text-align: center; white-space: nowrap; }
.game.wide .tray, .game.wide .g-bottom { max-width: 720px; width: 100%; align-self: center; }
.game.wide .g-zone { cursor: default; }

/* 창 */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(5,10,22,0.72); display: flex; align-items: center; justify-content: center;
  padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); -webkit-user-select: text; user-select: text;
}
.panel {
  width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,0.5); animation: rise 0.2s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.panel h2 { margin: 0 0 8px; font-size: 1.25rem; }
.panel p { margin: 6px 0; line-height: 1.5; font-size: 0.92rem; }
.panel small { color: var(--dim); }
.panel.err small { word-break: break-all; }
.face { font-size: 3rem; line-height: 1.1; }
.quote { color: #d7e6ff; font-style: italic; }
.q-face { font-style: normal; margin-right: 6px; font-size: 1.3rem; }
.home { display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.25); border-radius: 10px; padding: 6px 12px; font-size: 0.85rem; margin: 4px 0; }
.goals { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; display: grid; gap: 6px; }
.goals li { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.22); border-radius: 10px; padding: 8px 10px; font-size: 0.86rem; }
.goals li span { flex: 1; }
.goals li i { font-style: normal; font-weight: 900; width: 18px; text-align: center; flex: none; }
.goals li i.ok { color: var(--go); }
.goals li i.no { color: rgba(255,255,255,0.3); }
.goals li.new { outline: 1px solid var(--gold); background: rgba(255,211,77,0.12); }
.goals li em { font-style: normal; color: var(--gold); font-weight: 800; font-size: 0.74rem; flex: none; }
.goals li small { flex: none; }
.stats { display: flex; gap: 6px; margin-top: 10px; }
.stats div { flex: 1; background: rgba(0,0,0,0.22); border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats small { font-size: 0.66rem; white-space: nowrap; }
.stats b { font-variant-numeric: tabular-nums; }
.tip { background: rgba(95,224,255,0.1); border: 1px solid rgba(95,224,255,0.35); border-radius: 10px; padding: 8px 10px; text-align: left; font-size: 0.85rem !important; }
.result.win h2 { color: var(--gold); }
.big-score { font-size: 2.2rem !important; font-weight: 900; margin: 2px 0 !important; color: var(--accent); }
.big-score small { font-size: 1rem; margin-left: 2px; }
.top5 { list-style: decimal inside; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; text-align: left; font-size: 0.85rem; }
.top5 li { background: rgba(0,0,0,0.22); border-radius: 8px; padding: 5px 10px; }
.top5 li.me { outline: 1px solid var(--gold); }
.top5 li small { float: right; }
.help .pics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help figure { margin: 0; background: rgba(0,0,0,0.22); border-radius: 12px; padding: 8px 6px; }
.pic { position: relative; height: 104px; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; }
.pic canvas { flex: none; margin-top: -4px; }
.pic-arrow { position: absolute; left: 6px; top: 34px; font-style: normal; font-size: 1.5rem; color: var(--accent); animation: nudge 0.9s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(-5px); } }
.help figcaption { font-size: 0.76rem; line-height: 1.4; color: #d7e6ff; margin-top: 4px; }
.help figcaption b, .help-line b { color: var(--gold); }
.help-line { font-size: 0.84rem !important; }
.keys { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.78rem; }
.keys th, .keys td { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: left; }
.keys th { color: var(--dim); font-weight: 600; }
.keys td:first-child { color: var(--accent); font-weight: 700; white-space: nowrap; }

/* 연출 층 */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.beam {
  position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f6fcff, #9ad0f0); color: #0f3550; font-weight: 900; font-size: 0.8rem;
  box-shadow: 0 0 16px 4px rgba(170,230,255,0.75);
}
.noscript { text-align: center; padding: 40px 16px; }

/* 작은 화면 */
@media (max-width: 359px) {
  .back-txt { display: none; }
  .shake-btn { width: 76px; font-size: 0.78rem; }
  .g-side { width: 62px; }
}
@media (max-height: 560px) {
  .g-top { height: 32px; }
  .tray { height: 28px; }
  .g-bottom { height: calc(60px + env(safe-area-inset-bottom)); padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .shake-btn { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-fizz i, .t-rush, .shake-btn.glow, .pic-arrow { animation: none; }
}

/* ───── 2차: 문제집·오늘의 연쇄·둘이서 대전·기록·설정 ───── */
.center { text-align: center; }
.btn.big { min-height: 52px; padding: 12px 32px; font-size: 1.05rem; }
.btn.danger { border-color: rgba(255,107,107,0.6); color: #ffc9c9; }
.btn.danger:hover { background: rgba(255,107,107,0.18); }

/* 메뉴: 연습 권유·아래 버튼 */
.tut-ask { max-width: 560px; margin: 0 auto 12px; padding: 12px 14px; border-radius: var(--r); background: rgba(95,224,255,0.1); border: 1px solid rgba(95,224,255,0.45); }
.tut-ask p { margin: 0 0 2px; font-size: 0.88rem; line-height: 1.45; }
.tut-ask .row { margin-top: 10px; justify-content: flex-end; }
.menu-btns { max-width: 560px; margin: 12px auto 0; display: flex; gap: 8px; justify-content: center; }
.menu-btns .btn { flex: 1; min-height: 42px; }
.mode-card.shine { border-color: var(--gold); animation: shine 1.1s ease-in-out 3; }
@keyframes shine { 50% { box-shadow: 0 0 0 4px rgba(255,211,77,0.35); transform: translateY(-2px); } }

/* 글 위주 화면 */
.page-body { max-width: 560px; margin: 0 auto; }
.page-body .scr-sub { margin-bottom: 12px; line-height: 1.5; }
.page-body h3 { margin: 0 0 8px; font-size: 0.98rem; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.page-body h3 small { color: var(--dim); font-weight: 500; font-size: 0.76rem; margin-left: auto; }

/* 문제집 목록 */
.chap { margin-bottom: 16px; }
.chap h3 span { color: var(--accent); }
.chap.locked { opacity: 0.55; }
.pz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pz {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; min-width: 0;
  background: var(--bg2); border: 1px solid var(--line);
}
.pz:hover:not(:disabled) { border-color: var(--accent); }
.pz:disabled { cursor: not-allowed; }
.pz.solved { border-color: rgba(88,214,141,0.55); background: #1b2f3a; }
.pz canvas { display: block; }
.pz b { font-size: 0.86rem; }
.pz-goal { font-size: 0.66rem; color: var(--dim); white-space: nowrap; }
.pz-stars { font-size: 0.74rem; letter-spacing: 1px; }

/* 판: 위 띠의 생각 모드 정보 */
.t-goal { overflow: hidden; text-overflow: ellipsis; }
.t-left { margin-left: auto; color: var(--dim); font-variant-numeric: tabular-nums; flex: none; }
.t-now { color: var(--dim); flex: none; }
.t-now b { color: var(--gold); }
.t-now + .t-left { margin-left: auto; }
/* 말풍선(30초 연습)·코치 칩 */
.g-say {
  position: absolute; left: 50%; top: 44%; transform: translateX(-50%); width: max-content; max-width: min(88%, 320px); z-index: 2; pointer-events: none;
  background: #fff; color: #10233a; font-weight: 700; font-size: 0.86rem; line-height: 1.4; padding: 8px 12px; border-radius: 14px; text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.g-say::after { content: ''; position: absolute; left: 50%; top: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom-color: #fff; border-top: 0; }
/* 코치 칩: 병 위쪽 가장자리에 가로로(병 한가운데·배너를 가리지 않는다). 넓은 화면은 옆 기둥에 키 안내가 있어 띄우지 않는다 */
.g-chips { position: absolute; left: 0; right: 0; top: 2px; display: flex; flex-flow: row wrap; justify-content: center; gap: 4px; pointer-events: none; z-index: 1; }
.g-chips:empty { display: none; }
.g-chips span { background: rgba(8,16,32,0.86); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 9px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; transition: opacity 0.4s, transform 0.4s; }
.game.wide .g-chips { display: none; }
.g-banner { z-index: 3; }
.g-chips span.done { opacity: 0; transform: translateY(-10px) scale(0.9); border-color: var(--go); }
.g-banner.note { font-size: 0.92rem; white-space: normal; width: max-content; max-width: 88%; text-align: center; border-color: var(--gold); top: auto; bottom: 2%; transform: translateX(-50%); animation: none; }
.g-banner.win { border-color: var(--gold); color: var(--gold); }

/* 생각 모드의 아래 띠: 게이지 대신 도구 버튼 */
.game.think .gauge { display: none; }
.game.think .g-bottom { height: calc(96px + env(safe-area-inset-bottom)); }
.game.think .g-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; height: 100%; }
.game.think .g-tools.col { grid-template-columns: 1fr; }
.game.think.noshake .shake-btn { display: none; }
.game.think.noshake .g-bottom { height: calc(72px + env(safe-area-inset-bottom)); }
.game.think.noshake .g-tools { grid-template-columns: repeat(4, 1fr); }
.tool { border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 0.78rem; padding: 0 4px; min-height: 36px; white-space: nowrap; overflow: hidden; }
.tool:hover { border-color: var(--accent); }
.tool:active { transform: scale(0.97); }
.game.think .shake-btn { width: 84px; }
.game.think .tray { font-size: 0.74rem; }
.game.think .tray .tray-empty { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }

/* 받침: 상쇄하면 깨진다 */
.tray.crack, .d-tray.crack { animation: crack 0.35s ease-out; }
@keyframes crack { 0% { background: rgba(190,240,255,0.75); transform: scale(1.06); } 100% { transform: scale(1); } }
.shard { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 2px; background: linear-gradient(135deg, #ffffff, #9ad0f0); }

/* 둘이서 대전 화면 */
.duel { flex: 1; min-height: 0; display: flex; flex-direction: column; touch-action: none; overflow: hidden; }
.d-half { flex: 1; min-height: 0; min-width: 0; display: flex; align-items: stretch; justify-content: center; gap: 6px; padding: 3px 6px; cursor: grab; }
.duel:not(.wide) #dh1 { transform: rotate(180deg); padding-bottom: 13px; }   /* 180° 돌아 있어 아래 여백이 화면 위쪽 — 흔들기 버튼을 상단 바의 홈 링크에서 띄운다 */
.d-half .g-bottle { flex: none; height: auto; }
.d-col { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding: 2px 0; min-height: 0; }
.d-col .shake-btn { width: 100%; min-height: 56px; flex: none; flex-direction: column; gap: 0; font-size: 0.74rem; }
.d-col .gauge { width: 100%; height: 18px; flex: none; }
.d-col .gauge-txt { font-size: 0.64rem; }
.d-col .g-next { flex: none; }
.d-name { font-weight: 800; font-size: 0.8rem; color: var(--accent); margin-bottom: auto; }
.d-tray { width: 100%; text-align: center; font-size: 0.8rem; background: rgba(0,0,0,0.28); border: 1px solid var(--line); border-radius: 8px; padding: 4px 2px; margin-bottom: auto; white-space: nowrap; }
.d-tray b { color: #dff4ff; }
.d-tray i { font-style: normal; opacity: 0.6; }
.d-tray .hold { animation: blink 0.5s steps(2) infinite; }
.d-mid {
  flex: none; height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; font-size: 0.74rem;
  background: rgba(0,0,0,0.35); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.d-sc { color: var(--gold); letter-spacing: 1px; }
.d-sc b { color: var(--text); letter-spacing: 0; margin-right: 2px; }
.duel:not(.wide) .d-sc.flip { transform: rotate(180deg); }
.d-clock { color: var(--dim); font-variant-numeric: tabular-nums; }
.d-clock.hot { color: var(--red); font-weight: 800; }
.d-keys { display: none; }
.duel.wide { flex-direction: row; align-items: stretch; }
.duel.wide .d-half { align-items: center; cursor: default; }
.duel.wide .d-col { align-self: stretch; padding: 8% 0; }
.duel.wide #dh0 { order: 1; }
.duel.wide .d-mid { order: 2; width: 170px; height: auto; flex-direction: column; justify-content: center; gap: 12px; border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line); white-space: normal; text-align: center; font-size: 0.86rem; }
.duel.wide #dh1 { order: 3; }
.duel.wide .d-sc.flip { order: 3; }
.duel.wide .d-keys { display: block; order: 4; font-size: 0.68rem; color: var(--dim); line-height: 1.7; }
.duel.wide .d-keys b { color: var(--accent); }

/* 2인 설정 */
.opt { margin-bottom: 14px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-width: 0; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-weight: 700; font-size: 0.82rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; }
.seg button.on { border-color: var(--accent); background: #1d4660; box-shadow: 0 0 0 1px var(--accent) inset; }
.steppers { display: flex; gap: 10px; }
.stepper { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.stepper span { color: var(--accent); font-weight: 800; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 900; font-size: 1.1rem; }
.stepper button:disabled { opacity: 0.35; cursor: default; }

/* 기록 */
.rec { margin-bottom: 18px; }
.rec-list, .ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rec-list li { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 6px 10px; font-size: 0.84rem; }
.rec-list li b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-list li small { color: var(--dim); flex: none; font-size: 0.72rem; }
.rec-list li.dim { opacity: 0.5; }
.stats.wrap { flex-wrap: wrap; margin-top: 0; }
.stats.wrap div { flex: 1 1 22%; background: var(--bg2); align-items: center; text-align: center; padding: 8px 4px; }
.stats.wrap.three div { flex: 1 1 30%; }
.stats.wrap.chains { margin-top: 6px; }
.stats.wrap.chains div { flex: 1 1 14%; }
.stats.wrap small { color: var(--dim); }
.ach-list { grid-template-columns: 1fr 1fr; }
.ach-list li { display: grid; grid-template-columns: 30px 1fr; align-items: center; column-gap: 6px; background: var(--bg2); border-radius: 10px; padding: 6px 8px; opacity: 0.5; }
.ach-list li.on { opacity: 1; outline: 1px solid rgba(255,211,77,0.45); }
.ach-list li span { grid-row: span 2; font-size: 1.3rem; text-align: center; }
.ach-list li b { font-size: 0.82rem; }
.ach-list li small { font-size: 0.68rem; color: var(--dim); line-height: 1.3; }
.page-body .top5 { margin-top: 0; }
.page-body .top5 li { background: var(--bg2); }

/* 설정 */
.sw-list { display: grid; gap: 8px; margin-bottom: 6px; }
.sw { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--line); width: 100%; min-height: 56px; }
.sw span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sw small { color: var(--dim); font-size: 0.74rem; line-height: 1.35; }
.sw i { flex: none; width: 46px; height: 26px; border-radius: 999px; background: rgba(255,255,255,0.16); position: relative; transition: background 0.15s; }
.sw i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.sw.on i { background: var(--go); }
.sw.on i::after { transform: translateX(20px); }

/* 결과 창 덧붙임 */
.big-stars { font-size: 2rem !important; margin: 0 !important; letter-spacing: 4px; }
.share { background: rgba(0,0,0,0.3); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; font-size: 0.82rem !important; -webkit-user-select: all; user-select: all; }
.result .stats { flex-wrap: wrap; }

/* 알림 */
#toasts { position: fixed; left: 0; right: 0; top: calc(52px + env(safe-area-inset-top)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: #10233a; border: 1px solid var(--gold); color: var(--text); font-weight: 700; font-size: 0.86rem; padding: 8px 16px; border-radius: 999px; box-shadow: 0 8px 22px rgba(0,0,0,0.45); animation: toast 2.8s ease-in-out forwards; max-width: 92%; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
/* 판 화면: 위 띠의 목표·기준 글자를 가리지 않게 상단 바(제목 자리) 위에 작게 */
body.ingame #toasts { top: calc(6px + env(safe-area-inset-top)); }
body.ingame .toast { font-size: 0.76rem; padding: 7px 12px; max-width: 76%; }

@media (max-width: 359px) {
  .d-col { width: 64px; }
  .pz-grid { gap: 6px; }
  .game.think .shake-btn { width: 70px; }
}
@media (max-height: 560px) {
  .game.think .g-bottom { height: calc(84px + env(safe-area-inset-bottom)); }
  .game.think .tool { min-height: 32px; }
  .d-col .shake-btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .mode-card.shine, .toast { animation: none; }
}
/* 생각 모드의 위 띠: 목표 문구가 길면 두 줄까지 */
.game.think .g-top { height: auto; min-height: 40px; padding-top: 4px; padding-bottom: 4px; white-space: normal; line-height: 1.3; }
.game.think .t-goal { overflow: visible; }
.game.think .t-left, .game.think .t-now { white-space: nowrap; }

/* 오늘의 연쇄 안내 창의 조작 한 줄 */
.how { background: rgba(95,224,255,0.1); border: 1px solid rgba(95,224,255,0.35); border-radius: 10px; padding: 7px 10px; font-size: 0.84rem !important; font-weight: 700; }
.how small { font-weight: 500; }

/* 휴대폰을 가로로 든 1인 판(낮은 화면): 옆 기둥을 가로 한 줄로 펴서 다음 짝·점수가 받침·흔들기 버튼과 겹치지 않게 */
@media (orientation: landscape) and (max-height: 480px) {
  .game:not(.wide) .g-side { flex-direction: row; width: auto; align-self: center; align-items: center; gap: 10px; padding: 0 6px; }
  .game:not(.wide) .g-bottle { flex: none; }
  .game:not(.wide) .g-stat { width: 64px; }
  .game:not(.wide) .g-main { gap: 14px; }
  /* 코치 칩은 병 왼쪽 빈자리에 세로로 */
  .game:not(.wide) .g-chips { left: auto; right: 100%; top: 8%; margin-right: 12px; width: max-content; flex-flow: column nowrap; align-items: flex-end; }
}
