/* 서비스 공통 틀(상단 메뉴·하단·로그인·오류·첫 사용 안내·사용량·학생 학습 카드).
   style.css 다음에 불러오므로 같은 선택자는 여기 값이 이긴다.

   휴대폰 앱 틀 (760px 이하) — 다른 화면에서 쓸 수 있는 약속:
   --tabbar-h        하단 탭 높이(안전 영역 포함). 탭이 없거나 숨겨지면 0px.
                     자기 하단 고정 버튼 줄: bottom: var(--tabbar-h, 0px)
   --appbar-h        상단 앱 바 높이(안전 영역 제외). sticky 요소: top: calc(var(--appbar-h) + env(safe-area-inset-top))
   body.has-page-actionbar  화면 자체 하단 버튼 줄이 있음 → 휴대폰에서 하단 탭을 숨긴다(--tabbar-h: 0).
                     {% set page_actionbar = true %} 또는 아무 요소에 data-page-actionbar 를 달면 켜진다.
   .sheet / window.Sheet    바텀 시트 (static/shell.js 머리말 참고). */

:root { --tabbar-h: 0px; --appbar-h: 0px; --tap: 44px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --sheet-radius: 18px; --shadow-up: 0 -6px 24px rgba(30, 48, 41, .10); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-x: none; }
body { -webkit-tap-highlight-color: rgba(47, 107, 79, .14); }
button, .btn, a, summary, label, input, select, textarea, [role=button] { touch-action: manipulation; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: calc(8px + env(safe-area-inset-top)); }
main:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.field-hint { margin: 5px 0 0; color: var(--soft); font-size: 12.5px; line-height: 1.5; }
.input-narrow { width: 88px; }
.card-title { margin-top: 0; }
.card-first { margin-top: 0; }
.card-last { margin-bottom: 0; }
.card-actions { margin-top: 8px; }
.narrow-card { max-width: 440px; }
:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
code { background: #EEF1EC; border-radius: 5px; padding: 1px 6px; font-size: .92em; }

/* ── 상단 메뉴 ─────────────────────────────────────────────── */
nav.app-nav .brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink);
  min-width: 0; max-width: 46vw; }
nav.app-nav .brand img { flex: none; border-radius: 5px; }
nav.app-nav .brand-academy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group > summary { list-style: none; border-bottom: 2px solid transparent; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▾"; font-size: 11px; margin-left: 4px; color: var(--soft); }
/* 하위 화면이 열려 있으면 상위 묶음도 강조 */
.nav-group.has-active > summary { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.nav-logout-form { display: contents; }
nav .nav-logout { background: none; border: 0; border-radius: 0; color: var(--ink); font-weight: inherit;
  padding: 12px 10px; cursor: pointer; text-align: left; }
nav .nav-logout:hover { color: var(--danger); }

/* 햄버거/하위 메뉴 전환 폭을 760px 하나로 통일 (style.css 는 640/760 이 섞여 있음) */
@media (max-width: 760px) {
  #nav-toggle { display: block; margin-left: auto; background: #fff; color: var(--ink);
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 17px; }
  #nav-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch;
    gap: 0; padding: 4px 0 10px; }
  #nav-menu.open { display: flex; }
  #nav-menu a.item { border-bottom: 0; border-left: 3px solid transparent; padding: 10px 8px; font-size: 14.5px; }
  #nav-menu a.item.on { border-left-color: var(--accent); }
  #nav-menu .spacer { display: none; }
  #nav-menu .who { padding: 8px 8px 0; }
  .nav-group > summary { padding: 10px 8px; border-bottom: 0; border-left: 3px solid transparent; }
  .nav-group.has-active > summary { border-left-color: var(--accent); }
  .nav-submenu { position: static; box-shadow: none; border: 0; border-left: 1px solid var(--line);
    border-radius: 0; margin-left: 12px; padding: 0 0 4px; min-width: 0; }
  nav .nav-logout { padding: 10px 8px; font-size: 14.5px; border-left: 3px solid transparent; }
}

/* ── 하단 ─────────────────────────────────────────────────── */
.site-footer { max-width: 880px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); color: var(--soft); font-size: 12.5px; text-align: center; }
.site-footer-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; }
.site-footer-links a { color: var(--soft); padding: 4px 2px; }
.site-footer-links a:hover { color: var(--accent); }
.site-footer-links b { font-weight: 700; color: var(--ink); }
.site-footer-name { margin-top: 6px; }
main { min-height: 60vh; }

/* ── 로그인 ────────────────────────────────────────────────── */
.login-wrap { max-width: 380px; margin: 44px auto 0; }
.login-head { text-align: center; margin-bottom: 14px; }
.login-head img { border-radius: 14px; display: block; margin: 0 auto 10px; }
.login-head h1 { margin: 0; }
.login-head p { margin: 4px 0 0; }
.login-note { margin: 14px 0 6px; }
.login-links { margin: 6px 0 0; }
.login-install { margin-top: 12px; }
.a2hs { margin-top: 10px; }
.install-hint:not([hidden]) + .login-install { display: none; }
.a2hs ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.a2hs p { margin: 8px 0 0; }
.a2hs [data-close] { margin-top: 10px; }
details.field > summary { cursor: pointer; color: var(--soft); font-size: 13px; padding: 4px 0; }
details.field[open] > summary { margin-bottom: 8px; }
@media (max-width: 640px) { .login-wrap { margin-top: 18px; } }

/* ── 오류 화면 ──────────────────────────────────────────────── */
.error-page { max-width: 520px; margin: 40px auto; text-align: center; padding: 28px 22px; }
.error-code { font-size: 44px; font-weight: 800; color: var(--accent-light); margin: 0; line-height: 1; }
.error-page h1 { margin: 10px 0 8px; }
.error-message { font-weight: 600; }
.error-rid { background: var(--bg); border-radius: 8px; padding: 10px; font-size: 13px; }
.error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ── 첫 사용 체크리스트 ─────────────────────────────────────── */
.onboarding { border-color: var(--accent-light); }
.onboarding-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.onboarding-head h2 { margin: 0 0 4px; }
.onboarding-head p { margin: 0; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0;
  border-radius: 99px; background: #ECEEEA; overflow: hidden; }
progress::-webkit-progress-bar { background: #ECEEEA; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.onboarding-progress { margin: 12px 0 6px; }
.onboarding-steps { list-style: none; margin: 0; padding: 0; }
.onboarding-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); }
.onboarding-steps li:last-child { border-bottom: 0; }
.step-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: #ECEEEA; color: var(--soft); }
.onboarding-steps li.done .step-mark { background: var(--accent); color: #fff; }
.onboarding-steps li.next .step-mark { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.onboarding-steps li.done .step-body b { color: var(--soft); text-decoration: line-through; font-weight: 600; }
.step-body { flex: 1; min-width: 0; }
.step-body small { display: block; color: var(--soft); font-size: 12.5px; }
.step-action { flex: none; }
.onboarding-foot { margin: 8px 0 0; }
@media (max-width: 520px) {
  .onboarding-head { flex-direction: column; }
  .onboarding-steps li { flex-wrap: wrap; }
  .step-action { margin-left: 40px; }
}

/* ── 사용량 ─────────────────────────────────────────────────── */
.usage-widget { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; margin: 16px 0; }
.usage-widget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.usage-widget-head h2 { margin: 0 0 8px; }
.usage-widget-head a { font-size: 13px; }
.usage-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 22px; }
.usage-meter-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.usage-meter-label span { color: var(--soft); }
.usage-meter.is-high progress::-webkit-progress-value { background: var(--warn); }
.usage-meter.is-high progress::-moz-progress-bar { background: var(--warn); }
.usage-warn { margin: 10px 0 0; color: var(--warn); font-size: 13px; font-weight: 600; }
.usage-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.usage-summary .stat { margin-bottom: 0; display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--soft); font-size: 13px; font-weight: 600; }
.stat b { font-size: 24px; }
.stat b small { font-size: 14px; color: var(--soft); font-weight: 600; }
.stat .stat-plan { font-size: 18px; }
.usage-summary + .muted { margin-top: 12px; }
.usage-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-table th.num { text-align: right; }
.usage-table tr.is-empty td { color: var(--soft); }
.usage-table tfoot th, .usage-table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; }

/* ── 학원 로그인 주소·QR·안내 카드 ──────────────────────────── */
.login-link-card { display: flex; gap: 20px; align-items: center; }
.login-link-qr svg { display: block; width: 180px; height: 180px; }
.login-link-body { flex: 1; min-width: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
@media (max-width: 560px) {
  .login-link-card { flex-direction: column; align-items: stretch; }
  .login-link-qr { align-self: center; }
}
.print-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.login-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.login-card { background: #fff; border: 1.5px dashed #9AA39D; border-radius: 10px; padding: 12px 14px;
  break-inside: avoid; page-break-inside: avoid; display: flex; flex-direction: column; gap: 8px; }
.login-card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.login-card header b { font-size: 15px; }
.login-card header span { font-size: 11.5px; color: var(--soft); }
.login-card-main { display: flex; gap: 10px; align-items: center; }
.login-card dl { flex: 1; margin: 0; }
.login-card dl div { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 9px; }
.login-card dt { flex: none; width: 76px; font-size: 12.5px; color: var(--soft); font-weight: 700; }
.login-card dd { flex: 1; margin: 0; border-bottom: 1px solid #555; min-height: 22px; font-weight: 700; font-size: 15px; }
.login-card-qr svg { display: block; width: 104px; height: 104px; }
.login-card footer { font-size: 11px; color: #444; line-height: 1.45; }
.login-card-url { display: block; font-size: 12px; font-weight: 700; word-break: break-all; color: #000; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  nav.app-nav, .site-footer, .no-print, #toast-host, .msg { display: none !important; }
  main { max-width: none; padding: 0; }
  .login-cards { grid-template-columns: 1fr 1fr; gap: 6mm; }
  .login-card { min-height: 62mm; }
}

/* ── 도움말 ─────────────────────────────────────────────────── */
.help-steps, .help-tips { padding-left: 22px; line-height: 1.7; margin: 0 0 12px; }
.help-steps li, .help-tips li { margin-bottom: 4px; }
.faq { border-bottom: 1px solid var(--line); padding: 8px 0; }
.faq:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 2px; color: var(--ink); }

/* ── 학생 단어 카드 학습 ────────────────────────────────────── */
.study-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  margin-bottom: 12px; background: var(--card); }
.study-tabs a { padding: 8px 16px; color: var(--ink); font-weight: 600; font-size: 14px; }
.study-tabs a + a { border-left: 1px solid var(--line); }
.study-tabs a.on { background: var(--accent); color: #fff; }
.study-filter { align-items: flex-end; }
button.study-card { width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; position: relative;
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; margin-bottom: 12px; font-weight: 400; text-align: center; }
button.study-card:hover { border-color: var(--accent-light); }
button.study-card:disabled { cursor: default; }
.study-card .eng { display: block; font-size: 30px; font-weight: 800; word-break: keep-all; overflow-wrap: anywhere; }
.study-card .kor { display: block; font-size: 20px; color: var(--accent); margin-top: 8px; min-height: 28px; }
.study-flip-hint { display: block; color: var(--soft); font-size: 12.5px; margin-top: 6px; }
.study-mark-badge { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 99px; }
.study-mark-badge.known { background: var(--accent-soft); color: var(--accent); }
.study-mark-badge.unknown { background: var(--danger-soft); color: var(--danger); }
.study-nav button { min-width: 96px; }
.study-marks { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.study-marks button { flex: 1; max-width: 180px; padding: 11px 12px; background: #fff; }
.study-marks .study-known { color: var(--accent); border-color: var(--accent); }
.study-marks .study-unknown { color: var(--danger); border-color: var(--danger); }
.study-marks .study-known[aria-pressed="true"] { background: var(--accent); color: #fff; }
.study-marks .study-unknown[aria-pressed="true"] { background: var(--danger); color: #fff; }
.study-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; align-items: center; margin-top: 14px; }
.study-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13.5px; color: var(--ink); font-weight: 600; }
.study-note { text-align: center; margin-top: 10px; }

/* ══ 휴대폰 앱 틀 ═══════════════════════════════════════════════ */
.appbar, .tabbar { display: none; }
.appbar-home { display: none !important; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

@media (max-width: 760px) {
  body.has-tabbar { --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px)); --appbar-h: 52px;
    padding-bottom: var(--tabbar-h); }
  body.has-tabbar.has-page-actionbar, body.has-tabbar.kb-open, body.has-tabbar:has(.tm-bottombar) { --tabbar-h: 0px; }
  /* .tm-bottombar(교사 작업 화면의 하단 버튼 줄)가 있으면 탭을 숨긴다 — 서버 표시 없이도 겹치지 않게 */
  body.has-tabbar nav.app-nav { display: none; }

  /* 상단 앱 바: 학원 이름(작게) + 화면 제목 + 뒤로 */
  .appbar { display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 50;
    min-height: calc(var(--appbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
  .appbar-back, .appbar-action { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px;
    border-radius: 12px; border: 0; background: transparent; color: var(--ink); padding: 0; font-weight: 800; font-size: 18px; }
  .appbar-back:active, .appbar-action:active { background: var(--accent-soft); }
  .appbar-action { color: var(--soft); border: 1.5px solid var(--line); width: 34px; height: 34px; border-radius: 50%;
    font-size: 15px; margin: 5px; position: relative; }
  .appbar-action::after { content: ""; position: absolute; inset: -6px; }
  .appbar-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; padding: 0 6px; }
  .appbar-back:not([hidden]) + .appbar-titles { padding-left: 0; }
  body:has(.tm-bottombar) [data-history-back][hidden] + .appbar-home { display: inline-grid !important; }
  .appbar-home + .appbar-titles { padding-left: 6px; }
  body:has(.tm-bottombar) [data-history-back][hidden] + .appbar-home + .appbar-titles { padding-left: 0; }
  .appbar-academy { font-size: 11.5px; color: var(--soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar-title { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 하단 탭 */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; top: auto; gap: 0; border-bottom: 0;
    z-index: 60; height: var(--tabbar-h); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left);
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: var(--shadow-up);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
  body.has-page-actionbar .tabbar, body.kb-open .tabbar, body:has(.tm-bottombar) .tabbar { display: none; }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px;
    min-width: 0; padding: 4px 2px 6px; color: var(--soft); background: none; border: 0; border-radius: 0; font: inherit;
    font-weight: 600; cursor: pointer; }
  .tab-ico { position: relative; display: grid; place-items: center; width: 44px; height: 30px; border-radius: 99px;
    transition: background-color .15s; }
  .tab-label { font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tab.on { color: var(--accent); }
  .tab.on .tab-ico { background: var(--accent-soft); }
  .tab.on .tab-label { font-weight: 800; }
  .tab:active .tab-ico { background: var(--accent-soft); }
  .tab-primary .tab-ico { width: 52px; height: 52px; margin-top: -20px; border-radius: 50%; background: var(--accent); color: #fff;
    box-shadow: 0 6px 16px rgba(47, 107, 79, .35), 0 0 0 4px #fff; }
  .tab-primary.on .tab-ico, .tab-primary:active .tab-ico { background: #245A41; }
  .tab-primary .tab-label { color: var(--accent); font-weight: 800; }
  .tab-badge { position: absolute; top: -3px; left: 25px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
    background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
    box-shadow: 0 0 0 2px #fff; font-variant-numeric: tabular-nums; }

  /* 전역 휴대폰 타이포·간격·입력 */
  body { font-size: 15.5px; line-height: 1.6; }
  main { padding: 16px max(14px, env(safe-area-inset-right)) 28px max(14px, env(safe-area-inset-left)); min-height: 50vh; }
  h1 { font-size: 22px; line-height: 1.3; margin: 2px 0 14px; }
  h2 { font-size: 17px; }
  .card { padding: 14px 15px; border-radius: 14px; }
  input, select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select { min-height: 44px; }
  input[type=file] { font-size: 15px; max-width: 100%; }
  button, .btn { min-height: 44px; }
  button.small, .btn.small { min-height: 40px; padding: 8px 12px; }
  label { font-size: 13.5px; }
  .row > .grow, .row > div { min-width: 0; }
  .site-footer { padding-bottom: 20px; }
  #toast-host { bottom: calc(max(var(--tabbar-h), env(safe-area-inset-bottom, 0px)) + 14px); }
}
@media (hover: none) { .tab, .sheet-link, .sheet-grip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }

/* ══ 바텀 시트 (window.Sheet) ═══════════════════════════════════ */
.sheet { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 30, 25, 0); transition: background-color .22s; }
.sheet.open { background: rgba(20, 30, 25, .45); }
.sheet-panel { position: relative; width: 100%; max-width: 560px; max-height: min(88vh, 88dvh); overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--card);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; padding: 6px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(10, 25, 18, .22); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.sheet.open .sheet-panel { transform: none; }
.sheet.dragging .sheet-panel { transition: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: #D5DAD3; margin: 6px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px;
  position: sticky; top: -6px; background: var(--card); padding-top: 4px; z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-x { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; background: #EEF1EC; border: 0;
  color: var(--ink); font-size: 16px; }
.sheet-msg { margin: 4px 0 14px; color: var(--ink); line-height: 1.6; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.sheet-actions button, .sheet-actions .btn { width: 100%; min-height: 50px; font-size: 16px; text-align: center; }
.sheet-actions .danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.sheet-group { margin: 14px 2px 6px; color: var(--soft); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-link { display: flex; align-items: center; min-height: 50px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); font-weight: 700; background: #fff; }
.sheet-link.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sheet-link:active { background: var(--accent-soft); }
.sheet-logout { margin: 18px 0 0; }
.sheet-logout button { color: var(--danger); border-color: var(--line); }
/* 시트 안 행 동작 목록 (⋯ 메뉴) */
.sheet-menu { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.sheet-menu > * + * { border-top: 1px solid var(--line); }
.sheet-menu form { margin: 0; }
.sheet-menu .menu-item { display: flex; width: 100%; align-items: center; min-height: 50px; padding: 10px 4px; border: 0;
  border-radius: 0; background: none; color: var(--ink); font-weight: 700; text-align: left; font-size: 15.5px; }
.sheet-menu .menu-item.danger { color: var(--danger); background: none; }
.sheet-menu .menu-form { padding: 12px 0; }
.sheet-menu .menu-form .row { flex-wrap: nowrap; align-items: flex-end; }
.sheet-menu .menu-form .row > div { flex: 1; }
.sheet-menu .menu-form input:not([type=checkbox]), .sheet-menu .menu-form select { width: 100%; }
.sheet-note { color: var(--soft); font-size: 13px; margin: 10px 0 0; }
@media (min-width: 761px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel { border-radius: 16px; transform: translateY(16px) scale(.98); opacity: 0;
    transition: transform .2s, opacity .2s; padding-bottom: 20px; }
  .sheet.open .sheet-panel { transform: none; opacity: 1; }
  .sheet-grip { display: none; }
}
body.sheet-lock { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-panel, .tab-ico { transition: none !important; }
}

/* ══ 표 → 휴대폰 카드 (table.table-cards, td[data-label]) ═══════════ */
.row-menu-btn { min-width: 44px; min-height: 40px; padding: 4px 10px; font-size: 18px; line-height: 1;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 760px) {
  .list-card { background: transparent; border: 0; padding: 0; overflow: visible; }
  table.table-cards, table.table-cards tbody, table.table-cards tfoot { display: block; }
  table.table-cards thead, table.table-cards tr.thead { display: none; }
  table.table-cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
  table.table-cards td { display: block; border: 0; padding: 0; min-width: 0; }
  table.table-cards td[data-label]:not(.td-main):not(.td-act)::before { content: attr(data-label) " "; color: var(--soft);
    font-size: 12.5px; font-weight: 600; margin-right: 4px; }
  table.table-cards td:not(.td-main):not(.td-act):not(.td-sel) { grid-column: 1; font-size: 14px; }
  table.table-cards td.td-main { grid-column: 1; font-size: 16px; }
  table.table-cards td.td-act { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: right; }
  table.table-cards td.td-empty { grid-column: 1 / -1; }
  table.table-cards td:empty { display: none; }
  table.table-cards tr.is-dim { opacity: .62; }
}

/* ══ 선택 모드 (학생 일괄 작업) ══════════════════════════════════ */
.select-toggle { margin-left: auto; }
.bulkbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.bulkbar-count { font-weight: 800; color: var(--accent); align-self: center; }
@media (max-width: 760px) {
  .td-sel { display: none !important; }
  .selecting .td-sel { display: block !important; grid-column: 2; grid-row: 1; }
  .selecting .td-act { display: none; }
  .selecting table.table-cards tr:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
  .bulkbar { display: none; }
  .selecting .bulkbar { display: flex; position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 55; margin: 0;
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow-up); padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  body.has-tabbar .selecting .bulkbar { padding-bottom: 12px; }
  .selecting .bulkbar > div { flex: 1 1 40%; }
  .selecting .bulkbar-count { flex: 1 1 100%; }
  .selecting .bulkbar select, .selecting .bulkbar input { width: 100% !important; }
  .selecting .bulkbar button { flex: 1 1 100%; }
  .selecting .list-card { padding-bottom: 170px; }
  .td-sel input[type=checkbox] { width: 26px; height: 26px; }
}
@media (min-width: 761px) { .select-toggle { display: none; } .bulkbar-count { display: none; } }

/* ══ 목록 검색 ═══════════════════════════════════════════════════ */
.list-search { position: relative; margin: 0 0 12px; }
.list-search input { width: 100%; padding-left: 38px; }
.list-search::before { content: ""; position: absolute; left: 13px; top: 50%; width: 13px; height: 13px; margin-top: -9px;
  border: 2px solid var(--soft); border-radius: 50%; pointer-events: none; }
.list-search::after { content: ""; position: absolute; left: 25px; top: 50%; width: 2px; height: 7px; margin-top: 2px;
  background: var(--soft); transform: rotate(-45deg); pointer-events: none; }
.list-empty { text-align: center; color: var(--soft); padding: 18px 8px; }
.chip-scroll { position: static; z-index: auto; background: none; border: 0; flex-wrap: nowrap; align-items: center;
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 12px 0 6px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .pill { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; font-size: 13.5px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); }
.chip-scroll .pill.ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.page-toolbar h2 { margin: 0; }
@media (max-width: 760px) { .chip-scroll .pill { min-height: 40px; } }

/* ══ 선생님 홈 ═══════════════════════════════════════════════════ */
.today-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.today-card { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 13px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.today-card:active { background: var(--accent-soft); }
.today-label { font-size: 12.5px; color: var(--soft); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-num { font-size: 26px; line-height: 1.15; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.today-num small { font-size: 13px; color: var(--soft); font-weight: 700; margin-left: 2px; }
.today-sub { font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-card.is-attn { border-color: #DED1A8; background: var(--warn-soft); }
.today-card.is-attn .today-num, .today-card.is-attn .today-sub { color: var(--warn); }
.today-card.is-high .today-num { color: var(--warn); }
.cta-upload { display: none; }
.onboarding > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.onboarding > summary::-webkit-details-marker { display: none; }
.onboarding-sum-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.onboarding-sum-text > b { font-size: 16px; }
.onboarding-sum-text small { color: var(--soft); font-size: 13px; }
.onboarding-chevron { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft);
  transform: rotate(45deg); margin: -4px 6px 0; transition: transform .2s; }
.onboarding[open] .onboarding-chevron { transform: rotate(-135deg); margin-top: 4px; }
.onboarding-lead { margin: 0 0 4px; }
.onboarding-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-head .section-more { font-size: 13.5px; font-weight: 700; padding: 8px 0; }
.recent-list { list-style: none; margin: 0 0 12px; padding: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; }
.recent-list > li + li { border-top: 1px solid var(--line); }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); min-height: 60px; }
.recent-item:hover, .recent-item:active { background: #FAFBF9; }
.recent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent-main small { color: var(--soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.recent-score { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recent-empty { margin: 0; border: 0; }
@media (max-width: 760px) {
  .home-hello { font-size: 19px; margin-bottom: 12px; }
  .today-cards { gap: 8px; }
  .today-card { padding: 11px 10px; }
  .today-num { font-size: 23px; }
  .cta-upload { display: flex; align-items: center; gap: 14px; min-height: 72px; margin: 0 0 14px; padding: 14px 18px;
    border-radius: 16px; background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(47, 107, 79, .25); }
  .cta-upload:active { background: #245A41; }
  .cta-ico { font-size: 26px; }
  .cta-text { flex: 1; display: flex; flex-direction: column; }
  .cta-text b { font-size: 18px; }
  .cta-text small { color: #DCEAE2; font-size: 13px; }
  .cta-arrow { font-size: 30px; line-height: 1; opacity: .8; }
  .home-menu { grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-menu a.primary, .home-menu a[href="/review-queue"] { display: none; }
  .home-menu a { padding: 14px 13px; font-size: 15px; border-radius: 14px; }
  .home-menu small { font-size: 12px; }
  .home-flow { display: none; }
  .section-head { display: flex !important; }
  .recent-list { border-radius: 14px; }
  .onboarding-steps li { padding: 12px 0; }
  .onboarding-steps .step-body a { display: inline-block; padding: 4px 0; }
}
@media (max-width: 760px) { .home-menu ~ .usage-widget { display: none; } }

/* ══ 학생 포털 ═══════════════════════════════════════════════════ */
.my-assign-list { display: grid; gap: 10px; margin-bottom: 8px; }
.my-assign { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.my-assign-head { display: flex; flex-direction: column; gap: 2px; }
.my-assign-head b { font-size: 16.5px; }
.my-assign-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.my-assign-go { align-self: flex-start; }
.result-list, .word-cards { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.result-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; }
.result-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.result-date { font-size: 13px; color: var(--soft); font-weight: 600; }
.result-title { grid-column: 1 / -1; grid-row: 2; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-score { grid-column: 2; grid-row: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-score b { font-size: 20px; }
.result-score small { color: var(--soft); }
.result-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #ECEEEA; overflow: hidden; margin-top: 6px; }
.result-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.result-pdf { flex: none; min-height: 44px; display: inline-flex; align-items: center; }
.my-quick { margin-top: 14px; }
.wrong-tools { display: grid; gap: 10px; margin-bottom: 12px; }
.wrong-tools .list-search { margin: 0; }
.wrong-study { text-align: center; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.wrong-study.is-disabled { opacity: .45; pointer-events: none; }
.word-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.word-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.word-card-main b { font-size: 17px; overflow-wrap: anywhere; }
.word-card-main span { color: var(--ink); font-size: 14.5px; }
.word-card-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.word-card-side small { color: var(--soft); font-size: 12px; }
@media (min-width: 761px) { .word-cards { grid-template-columns: 1fr 1fr; } .wrong-tools { grid-template-columns: 1fr auto; align-items: center; } }

/* 학습 카드 */
.study-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.study-top .study-tabs { margin: 0; }
.study-tabs a { display: inline-flex; align-items: center; min-height: 42px; }
.study-range-btn { margin-left: auto; }
.study-range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.study-filter .field select, .study-filter .field input { width: 100%; }
.study-scope { margin: 0 0 8px; }
.study-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.study-progress-track { flex: 1; height: 6px; border-radius: 99px; background: #E3E8E4; overflow: hidden; }
.study-progress-track > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.study-counter { flex: none; font-size: 13px; color: var(--soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.study-stage { perspective: 1200px; }
button.study-card { touch-action: pan-y; -webkit-user-select: none; user-select: none; will-change: transform;
  box-shadow: 0 6px 22px rgba(30, 48, 41, .08); transition: transform .2s; }
button.study-card.dragging { transition: none; }
.study-card.anim-flip { animation: study-flip .32s ease; }
.study-card.anim-next { animation: study-in-right .26s ease; }
.study-card.anim-prev { animation: study-in-left .26s ease; }
@keyframes study-flip { 0% { transform: rotateY(90deg); } 100% { transform: none; } }
@keyframes study-in-right { 0% { transform: translateX(36px); opacity: .2; } 100% { transform: none; opacity: 1; } }
@keyframes study-in-left { 0% { transform: translateX(-36px); opacity: .2; } 100% { transform: none; opacity: 1; } }
.study-swipe-hint { font-size: 12.5px; }
.study-marks button { min-height: 52px; font-size: 16.5px; }
@media (prefers-reduced-motion: reduce) {
  button.study-card, .study-progress-track > span { transition: none; }
  .study-card.anim-flip, .study-card.anim-next, .study-card.anim-prev { animation: none; }
}
@media (hover: hover) { .study-swipe-hint { visibility: hidden; } }
@media (max-width: 760px) {
  .my-hello { font-size: 20px; }
  .my-assign-go { align-self: stretch; text-align: center; }
  body.page-study .study-h1 { display: none; }
  body.page-study main { display: flex; flex-direction: column; padding-top: 12px;
    min-height: calc(100vh - var(--appbar-h) - var(--tabbar-h));
    min-height: calc(100dvh - var(--appbar-h) - var(--tabbar-h) - env(safe-area-inset-top, 0px)); }
  body.page-study .site-footer { display: none; }
  .study-top .study-tabs { flex: 1; display: grid; grid-template-columns: 1fr 1fr; }
  .study-tabs a { justify-content: center; padding: 8px 6px; }
  .study-range-btn { min-height: 44px; padding: 8px 12px; }
  .study { flex: 1; display: flex; flex-direction: column; }
  .study-stage { flex: 1; display: flex; min-height: 240px; }
  button.study-card { flex: 1; min-height: 0; margin-bottom: 10px; border-radius: 20px; padding: 24px 18px; }
  .study-card .eng { font-size: clamp(30px, 9vw, 40px); }
  .study-card .kor { font-size: clamp(20px, 6vw, 26px); }
  .study-nav { justify-content: space-between; }
  .study-nav button { min-width: 0; min-height: 44px; padding: 8px 14px; }
  .study-marks { position: sticky; bottom: var(--tabbar-h); z-index: 2; gap: 10px; margin-top: 10px; padding: 8px 0; background: var(--bg); }
  .study-marks button { max-width: none; min-height: 60px; border-radius: 16px; font-size: 18px; border-width: 2px; }
  .study-tools { margin-top: 16px; }
  .result-card { padding: 12px; }
  .result-pdf { padding: 8px 12px; }
}

/* ══ 로그인 (휴대폰 우선) ══════════════════════════════════════════ */
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 72px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 40px; min-width: 56px;
  padding: 6px 10px; border: 0; background: transparent; color: var(--accent); font-size: 14px; }
.pw-toggle:hover { background: var(--accent-soft); }
.login-form .field > input { width: 100%; }
.login-submit { min-height: 50px; font-size: 16.5px; margin-top: 4px; }
.login-academy-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 18px;
  background: var(--accent); color: #fff; font-size: 30px; font-weight: 800; box-shadow: 0 8px 20px rgba(47, 107, 79, .25); }
.login-academy-name { font-size: 25px; line-height: 1.3; word-break: keep-all; }
.login-links a { display: inline-block; padding: 8px 2px; }
.install-hint { position: relative; margin-top: 12px; padding: 14px 44px 14px 16px; border-radius: 14px;
  background: var(--accent-soft); color: var(--ink); border: 1px solid #BFD5C7; }
.install-hint p { margin: 4px 0 0; font-size: 14px; }
.install-hint [data-install-app] { margin-top: 10px; }
.install-hint-x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; min-height: 40px; padding: 0;
  background: transparent; border: 0; color: var(--soft); font-size: 15px; }
.install-hint:not([hidden]) + .login-install { display: none; }
.a2hs ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
@media (max-width: 760px) {
  body.page-login { background: linear-gradient(180deg, var(--accent-soft) 0, var(--bg) 320px); }
  body.page-login main { display: flex; flex-direction: column; justify-content: center;
    min-height: calc(100vh - 110px); min-height: calc(100dvh - 110px); padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .login-wrap { margin: 0 auto; width: 100%; max-width: 420px; }
  .login-box { padding: 22px 18px 16px; border-radius: 18px; box-shadow: 0 10px 30px rgba(30, 48, 41, .08); }
  .login-head h1 { font-size: 22px; }
  .login-academy-name { font-size: 26px; }
  button.login-install { background: transparent; border-color: transparent; font-weight: 600; }
  body.page-login .site-footer { border-top: 0; padding-top: 4px; }
}
.settings-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0 0 14px; max-width: 440px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 52px; padding: 12px 16px;
  background: none; border: 0; border-radius: 0; color: var(--ink); font-weight: 600; text-align: left; font-size: 15px; }
.settings-item + .settings-item { border-top: 1px solid var(--line); }
.settings-item span { color: var(--soft); font-size: 20px; }
.settings-logout { max-width: 440px; margin-top: 8px; }
.settings-logout button { color: var(--danger); border-color: var(--line); background: #fff; }
.narrow-card .field > input { width: 100%; }

/* ══ 관리 화면 공통 (학생·단어장·구성원·설정·공유) ════════════════════ */
.notice-card { border-color: #E8C46A; background: #FFFAF0; }
.notice-text { margin: 6px 0; }
.fold-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  min-height: 40px; padding-right: 26px; position: relative; }
.fold-card > summary::-webkit-details-marker { display: none; }
.fold-card > summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft); transform: rotate(45deg); transition: transform .2s; }
.fold-card[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.fold-card[open] > summary { margin-bottom: 10px; }
.input-class { width: 120px; }
.class-add { gap: 6px; margin: 4px 0 10px; }
.inline-form { gap: 6px; flex-wrap: nowrap; align-items: center; }
.inline-form input { width: 130px; }
.class-table .td-main .muted { display: none; }
.th-sel { width: 36px; }
.th-act { width: 60px; }
.menu-danger > summary { list-style: none; cursor: pointer; }
.menu-danger > summary::-webkit-details-marker { display: none; }
.menu-danger[open] > summary { color: var(--soft); }
.crumbs { margin-bottom: 4px; }
.crumbs a { display: inline-block; padding: 4px 0; }
.ws-title { margin-top: 0; }
.chip-n { opacity: .7; font-weight: 600; }
.ws-link { display: inline-block; padding: 4px 0; }
/* 단어 목록 (고치기) */
.word-list { padding: 6px 12px; }
.word-row { display: grid; grid-template-columns: 44px 1fr 1fr auto; gap: 8px; align-items: center; padding: 7px 0;
  border-bottom: 1px solid var(--line); margin: 0; scroll-margin-top: 80px; }
.word-row:last-of-type { border-bottom: 0; }
.word-row input { width: 100%; min-width: 0; }
.word-head { color: var(--soft); font-size: 12px; font-weight: 700; border-bottom-width: 2px; }
.word-no { color: var(--soft); font-variant-numeric: tabular-nums; text-align: center; }
.word-acts { display: flex; gap: 6px; white-space: nowrap; }
.word-row:target { background: var(--accent-soft); border-radius: 8px; }
.word-none { margin: 10px 0; }
.word-add-fields { display: grid; grid-template-columns: 1fr 1fr 150px auto; gap: 8px 10px; align-items: end; }
.word-add-fields input { width: 100%; }
.word-add-fields.has-chapter { grid-template-columns: 1fr 1fr auto; }
.word-add-to { margin: 0 0 6px; }
.word-add { position: sticky; bottom: calc(var(--tabbar-h) + 8px); z-index: 20; box-shadow: 0 -4px 18px rgba(30, 48, 41, .07); }

@media (max-width: 760px) {
  .form-stack { flex-direction: column; align-items: stretch; }
  .form-stack > div, .form-stack > button, .form-stack > input { width: 100%; }
  .form-stack .input-class { width: 100%; }
  .fold-card > summary { min-height: 44px; }
  .w-full-phone { width: 100%; }
  table.table-cards td.td-desk, table.table-cards td.td-wide .inline-form + * { display: none; }
  .class-table .td-main .muted { display: inline; }
  table.class-table td.td-wide { grid-column: 1 / -1; margin-top: 6px; }
  .inline-form input { flex: 1; width: auto; }
  table.student-table td[data-label="단어장"] { grid-column: 1 / -1; margin-top: 4px; }
  table.student-table td[data-label="단어장"] { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  table.student-table td[data-label="단어장"] .chip { margin: 0; }
  button.chip { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  .page-toolbar .list-search { flex: 1; margin: 0; min-width: 0; }
  .select-toggle { min-width: 72px; }
  /* 단어 목록: 한 단어 = 한 카드 (영어·뜻 칸 + 저장·삭제) */
  .word-list { padding: 0; background: transparent; border: 0; }
  .word-head { display: none; }
  .word-row { grid-template-columns: 24px 1fr 1fr; grid-template-areas: "no en ko" "no acts acts"; gap: 6px 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; }
  .word-row:last-of-type { border-bottom: 1px solid var(--line); }
  .word-no { grid-area: no; align-self: start; padding-top: 11px; font-size: 13px; }
  .word-row input[name=english] { grid-area: en; font-weight: 700; }
  .word-row input[name=korean] { grid-area: ko; }
  .word-acts { grid-area: acts; justify-content: flex-end; }
  .word-acts button { min-width: 60px; }
  .word-add { bottom: var(--tabbar-h); margin: 8px -14px 0; border-radius: 16px 16px 0 0; padding: 8px 12px 10px;
    border-left: 0; border-right: 0; border-bottom: 0; }
  body.kb-open .word-add { bottom: 0; }
  .word-add-to { margin: 0 0 6px; font-size: 12.5px; }
  .word-add-fields { grid-template-columns: 1fr 1fr 48px; gap: 6px; }
  .word-add-fields label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .word-add-ch { grid-column: 1 / 3; grid-row: 2; }
  .word-add-btn { grid-column: 3; grid-row: 1; width: 48px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; }
  .word-add-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.word-add-plus { display: none; }
@media (max-width: 760px) { .word-add-plus { display: inline; } }
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.stat-chips > span { display: flex; flex-direction: column; padding: 8px 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; min-width: 0; }
.stat-chips small { color: var(--soft); font-size: 12px; font-weight: 700; }
.stat-chips em { font-style: normal; color: var(--soft); font-weight: 600; font-size: 13px; }
.team-invite { margin: 4px 0 8px; }
.danger-zone { border-color: #E5B4B4; }
.danger-zone > summary b { color: var(--danger); }
.input-num { width: 120px; }
.check-gap { margin-top: 6px; }
.register-card { max-width: 480px; margin: 32px auto; }
.register-card .field > input, .register-card .pw-wrap input { width: 100%; }
.agree-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.agree-box .check-line { align-items: flex-start; padding: 6px 0; font-size: 14px; }
.agree-box .check-line input { flex: none; margin-top: 2px; }
.register-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cred-card { max-width: 560px; margin: 24px auto; }
.cred-list { margin: 0 0 12px; }
.cred-list > div { margin-bottom: 10px; }
.cred-list dt { color: var(--soft); font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.cred-list dd { margin: 0; display: flex; gap: 8px; }
.cred-list input { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; }
.copy-row input.mono { font-size: 14px; }
/* 사용량: 막대 추이 + 첫 열 고정 표 */
.usage-spark { margin: 0 0 10px; }
.usage-spark figcaption { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.usage-spark figcaption span { color: var(--soft); font-weight: 700; }
.spark-bars { display: flex; align-items: flex-end; gap: 2px; height: 72px; }
.spark-bar { flex: 1; min-width: 0; height: max(var(--h), 3px); background: var(--accent-mid); border-radius: 3px 3px 0 0; }
.spark-bar.is-zero { background: #E3E8E4; height: 3px; }
.spark-bar.is-today { background: var(--accent); }
.spark-axis { display: flex; justify-content: space-between; color: var(--soft); font-size: 11.5px; margin-top: 4px; }
.usage-scroll-hint { display: none; }
.usage-table th:first-child, .usage-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card);
  white-space: nowrap; box-shadow: 1px 0 0 var(--line); }
.usage-table-wrap { -webkit-overflow-scrolling: touch; }
.usage-table-wrap:focus-visible { outline-offset: -3px; }
@media (max-width: 760px) {
  .input-num { width: 100%; }
  .register-card { margin: 8px auto; }
  .register-actions > * { flex: 1 1 100%; text-align: center; }
  .agree-box .check-line { min-height: 40px; }
  .usage-scroll-hint { display: block; margin: 0 0 6px; }
  .usage-table-wrap { padding: 0; }
  .usage-table { font-size: 13.5px; }
  .usage-table th, .usage-table td { padding: 10px 10px; }
  .usage-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .usage-summary .stat:last-child { grid-column: 1 / -1; }
  .stat b { font-size: 21px; }
  .copy-row button { flex: none; }
  .print-toolbar { flex-wrap: wrap; }
  .login-link-qr svg { width: 200px; height: 200px; }
  .error-page { margin: 16px auto; }
  .error-actions .btn { flex: 1 1 40%; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
}
.token-row { align-items: center; }
.token-code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; padding: 10px 12px; border-radius: 8px; user-select: all; -webkit-user-select: all; }

/* ══ 휴대폰 터치 대상 44px 마감 ════════════════════════════════════ */
@media (max-width: 760px) {
  .site-footer-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 6px; }
  .check-line { min-height: 44px; }
  details > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
  details.faq > summary, details.field > summary { padding: 8px 0; }
  button.small, .btn.small { min-width: 44px; }
  button.chip { min-height: 40px; }
  .onboarding-steps .step-body a, .onboarding-foot > a, .section-head .section-more, .crumbs a, .ws-link, .stat-link,
  .login-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }
  .copy-row input { font-size: 16px; }
  .study-toggle { min-height: 44px; }
}

/* ── 사용 방법(/help) — 목차: 휴대폰은 위에 붙는 칩 줄, 넓은 화면은 왼쪽 고정 목차 ───────────── */
.nav-help-q { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 11px; font-weight: 800; line-height: 1; margin-right: 2px; }
.help-head h1 { margin-bottom: 4px; }
nav.help-toc { position: sticky; top: 0; z-index: 4; display: block; padding: 8px 0; margin: 0 0 8px;
  background: var(--bg); border: 0; border-bottom: 1px solid var(--line); }
.help-toc ul { list-style: none; margin: 0; padding: 0 2px; display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.help-toc ul::-webkit-scrollbar { display: none; }
.help-toc li { flex: none; }
.help-toc a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 13px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.help-toc a:hover, .help-toc a:focus-visible { border-color: var(--accent); color: var(--accent); }
.help-sec { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 6px; margin: 0 0 12px;
  scroll-margin-top: 70px; line-height: 1.65; }
.help-sec h2 { margin: 0 0 8px; font-size: 18px; }
.help-sec h3 { margin: 14px 0 6px; font-size: 15.5px; scroll-margin-top: 70px; }
.help-sec p { margin: 0 0 10px; }
.help-sec ul ul, .help-sec ol ul { margin: 4px 0 2px; padding-left: 18px; }
.help-sec code { font-family: inherit; font-size: .95em; background: var(--bg); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.help-sec kbd { font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px; background: var(--bg); }
.help-checklist li.done > a b { color: var(--soft); }
.help-table-wrap { margin: 0 0 12px; }
.help-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.help-table th[scope=row] { width: 38%; font-weight: 400; }
.help-table th[scope=row] .pill { white-space: normal; font-size: 12.5px; }
.help-table tr:last-child > * { border-bottom: 0; }
@media (max-width: 760px) {
  nav.help-toc { top: calc(var(--appbar-h) + env(safe-area-inset-top)); margin: 0 -14px 10px; padding: 8px 14px; }
  .help-sec { scroll-margin-top: calc(var(--appbar-h) + env(safe-area-inset-top) + 64px); padding: 12px 14px 4px; }
  .help-sec h3 { scroll-margin-top: calc(var(--appbar-h) + env(safe-area-inset-top) + 64px); }
  .help-table th[scope=row] { width: 42%; }
}
@media (min-width: 1000px) {
  body.page-help main { max-width: 1120px; }
  .help { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .help-head { grid-column: 1 / -1; }
  nav.help-toc { top: 64px; border: 0; padding: 0; margin: 0; background: none; max-height: calc(100vh - 84px); overflow: auto; }
  .help-toc ul { flex-direction: column; overflow: visible; gap: 2px; }
  .help-toc a { display: flex; min-height: 34px; border: 0; background: none; border-radius: 8px; padding: 6px 10px; font-weight: 500; }
  .help-toc a:hover { background: var(--accent-soft); }
  .help-sec { scroll-margin-top: 64px; }
}
.help-toc a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 1000px) { .help-toc a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 700; } }
/* 사진을 고르기 전에는 빈 상태 줄·썸네일 자리가 여백만 만들지 않게 */
.up-status:empty, .up-thumbs:empty { display: none; }

/* Installation landing page: readable on phones and useful as a desktop QR handoff. */
.install-page { max-width: 760px; margin: 0 auto; padding: 16px 0 28px; }
.install-page .card { margin: 16px 0; padding: clamp(20px, 5vw, 32px); }
.install-back { display: inline-block; padding: 10px 0; }
.install-hero { text-align: center; }
.install-hero > img { border-radius: 20px; }
.install-hero h1 { margin: 12px 0; font-size: clamp(27px, 6vw, 38px); line-height: 1.3; letter-spacing: -.04em; }
.install-hero p { line-height: 1.7; }
.install-eyebrow { color: var(--accent, #2F6B4F); font-weight: 700; font-size: 14px; }
.install-status { color: #5E6862; font-size: 14px; min-height: 24px; }
.install-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.install-grid .card { margin: 0; }
.install-guide h2, .install-share h2 { font-size: 20px; margin: 0 0 12px; }
.install-guide ol { padding-left: 22px; line-height: 1.9; }
.install-guide p { line-height: 1.7; }
.install-guide summary { padding: 12px 0; cursor: pointer; }
.install-share { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.install-share input { width: 100%; min-width: 0; margin: 8px 0; }
.install-qr svg { display: block; max-width: 100%; }
@media (max-width: 540px) {
  .install-grid, .install-share { grid-template-columns: 1fr; }
  .install-qr { justify-self: center; }
}
