/* 회전 큐브 연구소 — 남색에서 청록으로 가는 연구소 배경 + 옅은 모눈 */
:root {
  --bg1: #0f1730; --bg2: #123a4a; --panel: #172340; --panel2: #1e2d52; --line: #32466f; --ink: #eef3ff; --dim: #9db0d4;
  --accent: #5ad1e6; --accent2: #ffe45e; --good: #6fe39a; --bad: #ff7b7b;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif; color: var(--ink); font-size: 15px; line-height: 1.5;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(160deg, var(--bg1) 0%, #142552 45%, var(--bg2) 100%);
  background-attachment: fixed; overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app { height: 100vh; height: 100dvh; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; padding-top: var(--safe-t); }

/* ───── 상단 바 ───── */
.topbar { flex: 0 0 56px; display: flex; align-items: center; gap: 8px; padding: 0 10px; min-width: 0; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; border-radius: 9px; background: rgba(23,35,64,.88); border: 1px solid var(--line); white-space: nowrap; flex: none; }
.back-btn:hover { border-color: var(--accent); }
.title { flex: 1; min-width: 0; text-align: center; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title .chip { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--accent); vertical-align: 1px; }
.top-right { display: flex; gap: 6px; flex: none; }
.mini { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(23,35,64,.88); font-size: 17px; padding: 0; }
.mini:hover { border-color: var(--accent); }

/* ───── 상태 줄 ───── */
.status { flex: 0 0 44px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 10px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.status .big { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.status .sub { color: var(--dim); font-size: 14px; }
.status .sub b { color: var(--ink); }
.status .warn { color: var(--accent2); }
.status .chips { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.status .chips button { border: 0; background: transparent; padding: 4px 12px; font-size: 13px; color: var(--dim); }
.status .chips button.on { background: var(--accent); color: #06202a; font-weight: 700; }
.status .chips button:disabled { opacity: .55; cursor: default; }
.rank { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: rgba(23,35,64,.7); border: 1px solid var(--line); font-size: 13px; }
.rank b { color: var(--accent2); }

/* ───── 캔버스 ───── */
.stage { position: relative; flex: 1 1 auto; min-height: 0; }
body[data-screen="home"] .stage { flex: 1 1 0; min-height: 34%; } /* 카드가 먼저 자리를 잡고 큐브가 남는 높이를 쓴다(카드 목록이 몇 px 스크롤되지 않게) */
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: move; outline: none; }
.cv-btn { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: rgba(23,35,64,.78); font-size: 22px; padding: 0; touch-action: none; }
.cv-btn:active { background: var(--panel2); border-color: var(--accent); }
.cv-peek { top: 4px; right: 10px; }
.cv-rotl { bottom: 6px; left: 10px; }
.cv-rotr { bottom: 6px; right: 10px; }
.net-slot { position: absolute; top: 4px; left: 10px; width: 120px; pointer-events: none; }
.banner { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: calc(100% - 140px); padding: 7px 14px; border-radius: 12px; background: rgba(15,23,48,.9); border: 1px solid var(--accent2); color: var(--accent2); font-weight: 700; font-size: 14px; text-align: center; pointer-events: none; }
.banner.count { font-size: 30px; padding: 4px 18px; border-color: var(--accent); color: var(--accent); }
.big-btn-wrap { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: rgba(10,16,34,.55); text-align: center; }
.big-btn-wrap p { margin: 0; color: var(--dim); font-size: 13px; }
.cover { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 6px; background: #0f1730; border-radius: 14px; margin: 4px 8px; cursor: pointer; }
.cover b { font-size: 22px; } .cover span { color: var(--dim); font-size: 13px; }

/* ───── 안내 한 줄·단추 줄 ───── */
.guide { flex: 0 0 40px; margin: 0; padding: 0 12px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 14px; color: var(--dim); line-height: 1.25; overflow: hidden; }
.guide b { color: var(--accent2); font-size: 17px; margin: 0 4px; }
.guide .alg { font-family: ui-monospace, 'Consolas', monospace; color: var(--ink); letter-spacing: .5px; }
.guide .alg i { font-style: normal; opacity: .45; } .guide .alg u { text-decoration: none; color: var(--accent2); font-weight: 800; }
.bar { flex: 0 0 auto; display: flex; gap: 8px; padding: 4px 10px calc(8px + var(--safe-b)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; border-color: var(--line); }
.btn.primary { background: linear-gradient(180deg, #6fe0f2, #37b4cc); color: #05222b; border-color: #8beaf8; font-weight: 800; }
.btn.big { min-height: 64px; padding: 0 34px; font-size: 20px; border-radius: 16px; }
.btn.glow { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(255,228,94,.25); }
.bar .btn { flex: 1 1 0; min-width: 0; padding: 0 6px; }
.bar .btn.narrow { flex: 0 0 52px; font-size: 20px; }
body[data-screen="home"] .guide, body[data-screen="home"] .bar { display: none; }
body[data-screen="play"] .home { display: none; }

/* ───── 홈 ───── */
.home { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px calc(10px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 10px 12px; min-height: 68px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(30,45,82,.95), rgba(23,35,64,.95)); }
.card:hover { border-color: var(--accent); }
.card .ic { grid-row: span 2; font-size: 26px; }
.card .nm { font-weight: 800; font-size: 15px; }
.card .ds { font-size: 12px; line-height: 1.25; color: var(--dim); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; word-break: keep-all; overflow-wrap: anywhere; }
.card .tag { position: absolute; top: -6px; right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--accent2); color: #2a2400; }
.card .tag.done { background: var(--good); color: #05301a; }
.card.soon { opacity: .55; }
.card.soon .tag { background: #5a6a8f; color: #fff; }
.home-foot { display: flex; gap: 8px; }
.home-foot .btn { flex: 1 1 0; min-width: 0; padding: 0 6px; }

/* ───── 목록 화면(문제집 등) ───── */
.panel { position: fixed; inset: 0; z-index: 40; background: linear-gradient(160deg, var(--bg1), #142552 45%, var(--bg2)); display: flex; flex-direction: column; padding-top: var(--safe-t); }
.panel-in { width: 100%; max-width: 760px; margin: 0 auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel-head { flex: 0 0 56px; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.panel-head h2 { flex: 1; margin: 0; font-size: 18px; text-align: center; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px calc(14px + var(--safe-b)); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.tabs button.on { background: var(--accent); color: #06202a; font-weight: 800; border-color: var(--accent); }
.tabs button.lock { opacity: .5; }
.ch-desc { margin: 0 0 10px; color: var(--dim); font-size: 13px; }
.grid8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pcell { display: grid; justify-items: center; gap: 2px; padding: 12px 4px; min-height: 84px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.pcell b { font-size: 20px; } .pcell small { color: var(--dim); font-size: 11px; } .pcell .st { font-size: 13px; letter-spacing: 1px; color: var(--accent2); }
.pcell.lock { opacity: .4; }
.pcell.done { border-color: #4a8f7a; }

/* ───── 모달 ───── */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5, 9, 22, .74); display: grid; place-items: center; padding: 14px; }
.modal-card { width: min(460px, 100%); max-height: 88vh; max-height: 88dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.modal-card h2 { margin: 0 0 10px; font-size: 20px; text-align: center; }
.modal-card h3 { margin: 14px 0 6px; font-size: 14px; color: var(--accent); }
.modal-card p { margin: 0 0 8px; }
.modal-card ul { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 3px; font-size: 14px; }
.modal-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.modal-btns .btn { flex: 1 1 40%; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: transparent; padding: 11px 6px; font-size: 14px; min-height: 44px; }
.seg button.on { background: var(--accent); color: #06202a; font-weight: 800; }
.seg button:disabled { opacity: .4; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(50,70,111,.6); }
.row:last-child { border-bottom: 0; }
.row span { color: var(--dim); font-size: 13px; } .row b { font-variant-numeric: tabular-nums; }
.res-big { text-align: center; font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0; }
.res-stars { text-align: center; font-size: 34px; letter-spacing: 6px; color: var(--accent2); }
.res-stars i { font-style: normal; color: #44527a; }
.res-note { text-align: center; color: var(--accent2); font-weight: 700; margin: 4px 0 8px; }
.scr { font-family: ui-monospace, 'Consolas', monospace; font-size: 12px; color: var(--dim); word-break: break-word; user-select: text; -webkit-user-select: text; }
.talist { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.talist .row { padding: 6px 10px; }
.talist button { border: 0; background: transparent; color: var(--bad); font-size: 15px; padding: 4px 8px; }
kbd { display: inline-block; padding: 0 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2); font-size: 12px; font-family: inherit; }

/* ───── 토스트·오류 ───── */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(118px + var(--safe-b)); z-index: 60; display: grid; justify-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.modal:not([hidden]) ~ .toast-wrap { bottom: auto; top: calc(62px + var(--safe-t)); } /* 창이 떠 있을 때는 위쪽에(창 아래쪽 단추를 가리지 않게) */
.toast { padding: 8px 14px; border-radius: 999px; background: rgba(15,23,48,.95); border: 1px solid var(--accent); font-size: 13px; font-weight: 600; animation: toast 2.4s ease forwards; max-width: 100%; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 10%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.fatal { position: fixed; inset: 0; z-index: 100; background: #0b1226; display: grid; place-items: center; padding: 20px; }
.fatal-card { max-width: 380px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.fatal-icon { font-size: 46px; } .fatal-card h2 { margin: 6px 0; } .fatal-card p { color: var(--dim); word-break: break-word; }
.fatal-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: #0b1226; }

/* ───── 좁은 화면·낮은 화면 ───── */
@media (max-width: 380px) { .back-txt { display: none; } .btn { font-size: 13px; } .card { padding: 8px 10px; column-gap: 6px; } .card .ic { font-size: 22px; } }
@media (max-height: 620px) { .topbar { flex-basis: 46px; } .status { flex-basis: 34px; } .status .big { font-size: 20px; } .guide { flex-basis: 30px; } .btn { min-height: 44px; } .card { min-height: 52px; padding: 6px 10px; } .card .ds { -webkit-line-clamp: 1; line-clamp: 1; } .cv-btn { width: 44px; height: 44px; } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (hover: none) and (pointer: coarse) { .kbd-help { display: none !important; } } /* 터치 전용 기기에서는 키보드 안내를 숨긴다 */
@media (prefers-reduced-motion: reduce) { .modal-card, .toast { animation-duration: .01s; } }

/* ───── 공식 기호 줄 ───── */
.alg { font-family: ui-monospace, 'Consolas', monospace; color: var(--ink); letter-spacing: .5px; font-size: 13px; line-height: 1.3; }
.alg i { font-style: normal; opacity: .4; } .alg u { text-decoration: none; color: var(--accent2); font-weight: 800; }
.mono { font-family: ui-monospace, 'Consolas', monospace; }
.rank small { color: var(--dim); margin-left: 3px; }

/* ───── 캔버스 위 겹침: 색종이·유령 손가락·전개도 ───── */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.finger { position: absolute; left: 0; top: 0; margin: -4px 0 0 -17px; font-size: 34px; line-height: 1; pointer-events: none; z-index: 3; filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); animation: swipe 1.7s ease-in-out infinite; }
@keyframes swipe {
  0% { transform: translate(var(--x0), var(--y0)); opacity: 0; } 15% { transform: translate(var(--x0), var(--y0)); opacity: 1; }
  70% { transform: translate(var(--x1), var(--y1)); opacity: 1; } 100% { transform: translate(var(--x1), var(--y1)); opacity: 0; }
}
.net-slot { display: flex; gap: 6px; width: auto; z-index: 1; }
body[data-cover] .net-slot { visibility: hidden; } /* 일시정지 덮개가 떠 있는 동안은 전개도도 가린다 */
.net-slot figure { margin: 0; padding: 4px 4px 2px; border-radius: 10px; background: rgba(15,23,48,.74); border: 1px solid var(--line); }
.net-slot figure.goal { border-color: var(--accent2); }
.net-slot canvas { display: block; }
.net-slot figcaption { font-size: 11px; text-align: center; color: var(--dim); line-height: 1.4; }
.net-slot figure.goal figcaption { color: var(--accent2); font-weight: 700; }

/* ───── 설명 카드(배우기·처음 안내) ───── */
.lesson { flex: 0 0 auto; margin: 2px 10px calc(8px + var(--safe-b)); padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(23,35,64,.95); }
.lesson-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.lesson-head b { color: var(--accent); font-size: 15px; } .lesson-head span { color: var(--dim); font-size: 12px; white-space: nowrap; }
.lesson-text { margin: 0 0 6px; font-size: 14px; line-height: 1.45; } .lesson-text b { color: var(--accent2); }
.lesson-cap { margin: 0 0 8px; font-size: 13px; color: var(--dim); line-height: 1.4; } .lesson-cap:empty { display: none; } .lesson-cap b { color: var(--accent2); }
.lesson-btns { display: flex; gap: 8px; } .lesson-btns .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 6px; }
body[data-card] .guide, body[data-card] .bar { display: none; }
body[data-rep] #bar { display: none; }
.rep-bar .btn { font-size: 17px; }

/* ───── 목록: 수업·무늬·기록 ───── */
.sec { margin: 14px 0 6px; font-size: 15px; color: var(--accent); } .sec small { color: var(--dim); font-weight: 400; font-size: 12px; margin-left: 6px; }
.lrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px; min-height: 60px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.lrow:hover, .patcell:hover, .pcell:hover { border-color: var(--accent); }
.lrow .stamp { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); font-weight: 800; color: var(--accent); font-size: 16px; }
.lrow.done { border-color: #4a8f7a; } .lrow.done .stamp { background: transparent; font-size: 26px; }
.lrow .lt { flex: 1; min-width: 0; display: grid; } .lrow .lt small { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .go { color: var(--accent); }
.patgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.patcell { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.patcell canvas { max-width: 100%; } .patcell b { font-size: 13px; } .patcell .st { color: var(--accent2); font-size: 13px; letter-spacing: 1px; }
.patcell.lock { opacity: .4; } .patcell.done { border-color: #4a8f7a; }
.pcell canvas { display: block; }
.rec-body .seg { margin-bottom: 8px; } .empty { color: var(--dim); font-size: 13px; text-align: center; padding: 14px 0; }
.achlist { display: grid; gap: 6px; }
.ach { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); opacity: .55; }
.ach.on { opacity: 1; border-color: #a58c2e; } .ach .ic { font-size: 22px; flex: 0 0 30px; text-align: center; } .ach .lt { flex: 1; min-width: 0; display: grid; } .ach .lt small, .ach .dt { color: var(--dim); font-size: 12px; }
.dlist { display: grid; gap: 4px; }
.drow { display: grid; grid-template-columns: 84px 1fr 1fr; gap: 6px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(23,35,64,.6); font-size: 13px; font-variant-numeric: tabular-nums; }
.dcell { color: var(--dim); white-space: nowrap; } .dcell.on { color: var(--accent2); }

/* ───── 결과·설정 ───── */
.stamp-big { text-align: center; font-size: 64px; line-height: 1.15; animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: scale(2.4) rotate(-18deg); opacity: 0; } }
.res-ach { text-align: center; margin: 6px 0 0; font-size: 13px; color: var(--good); font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.swatch { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: transparent; min-height: 62px; min-width: 0; }
.swatch.on { border-color: var(--accent); background: rgba(90,209,230,.14); } .swatch.lock { opacity: .5; }
.swatch .dots { display: flex; gap: 2px; } .swatch .dots i { width: 12px; height: 12px; border-radius: 3px; }
.swatch b { font-size: 13px; } .swatch small { font-size: 10px; color: var(--dim); white-space: nowrap; }

/* ───── 옆 패널: 넓은 화면(PC)과 가로로 든 휴대폰 ───── */
.side { display: none; }
.side-card { background: rgba(23,35,64,.82); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; font-size: 13px; }
.side-card h3 { margin: 10px 0 6px; font-size: 14px; color: var(--accent); } .side-card h3:first-child { margin-top: 0; }
.side-card p { margin: 0 0 6px; color: var(--dim); } .side-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--dim); }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) and (min-width: 620px) {
  #app { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: 56px 44px minmax(0, 1fr) auto auto auto; column-gap: 14px; padding-left: 12px; padding-right: 12px; }
  .topbar { grid-column: 1 / -1; grid-row: 1; padding: 0; }
  .status { grid-column: 1; grid-row: 2; }
  .stage, body[data-screen="home"] .stage { grid-column: 1; grid-row: 3; min-height: 0; }
  .lesson { grid-column: 1; grid-row: 4; }
  .guide { grid-column: 1; grid-row: 5; min-height: 40px; }
  .bar { grid-column: 1; grid-row: 6; }
  .home, .side { grid-column: 2; grid-row: 2 / 7; min-height: 0; }
  .home { justify-content: center; padding: 4px 0 12px; }
  .side { display: block; overflow-y: auto; padding: 4px 0 12px; }
  body[data-screen="home"] .side { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (orientation: landscape) and (max-height: 520px) and (min-width: 620px) {
  #app { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: 46px 34px minmax(0, 1fr) auto auto auto; }
  .guide { min-height: 30px; }
  .home { justify-content: flex-start; overflow-y: auto; }
  .lesson { padding: 6px 10px; margin-bottom: 4px; } .lesson-text { font-size: 13px; margin-bottom: 4px; } .lesson-btns .btn { min-height: 40px; }
}
@media (max-width: 380px) { .patgrid { gap: 6px; } .lesson-text { font-size: 13px; } }
@media (min-width: 620px) { .achlist { grid-template-columns: 1fr 1fr; } .patgrid { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .finger { animation-duration: 3s; } .stamp-big { animation: none; } }
.rec-tabs { overflow: visible; }
.rec-tabs button { flex: 1 1 0; min-width: 0; padding: 9px 2px; font-size: 13px; white-space: nowrap; }
.rec-body .modal-btns { margin: 10px 0; }
/* 제목이 길면 칩 글자만 줄임표로 (칩이 통째로 사라지지 않게) */
.title { display: flex; align-items: center; justify-content: center; gap: 6px; }
.title b { flex: none; }
.title .chip { min-width: 0; margin-left: 0; overflow: hidden; text-overflow: ellipsis; }
