/* 소누니혼고 · 토스 앱 느낌의 담백한 화이트
   모바일: 위 헤더 + 아래 탭 / PC(900px 이상): 왼쪽 사이드바
   - 글꼴: 한글·숫자는 Pretendard, 일본어(lang="ja")는 Noto Sans JP
   - 카드는 테두리 없이 회색 바탕 위 흰 면, 모서리는 크게
   - 누르면 살짝 줄어드는 반응, 페이지는 가볍게 페이드 */

:root {
  /* 회색 단계 (어두운 → 밝은) */
  --grey-900: #191F28;
  --grey-800: #333D4B;
  --grey-700: #4E5968;
  --grey-600: #6B7684;
  --grey-500: #8B95A1;
  --grey-400: #B0B8C1;
  --grey-300: #D1D6DB;
  --grey-200: #E5E8EB;
  --grey-100: #F2F4F6;
  --grey-50: #F9FAFB;

  --bg: var(--grey-100);
  --surface: #FFFFFF;
  --ink: var(--grey-900);
  --ink-2: var(--grey-700);
  --muted: var(--grey-600);
  --line: var(--grey-200);
  --line-strong: var(--grey-300);
  --hover: rgba(2, 32, 71, 0.05);
  --press: rgba(2, 32, 71, 0.09);

  --accent: #3182F6;
  --accent-ink: #1B64DA;
  --accent-soft: #E8F3FF;
  --good: #027A4B;
  --good-soft: #E5F7EF;
  --danger: #E42939;
  --danger-soft: #FFEEEE;
  --warn: #A64D00;
  --warn-soft: #FFF3E0;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --nav-h: 64px;
  --side-w: 248px;
  --shadow-float: 0 8px 28px rgba(0, 27, 55, 0.14);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-ko: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-ja: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Pretendard Variable", sans-serif;

  font-family: var(--font-ko);
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -0.01em;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* 일본어는 일본 글꼴로 (한국식 한자 모양이 섞이지 않게) */
:lang(ja) { font-family: var(--font-ja); letter-spacing: 0; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.55; font-size: 16px; }
h1, h2, h3 { margin: 0; line-height: 1.35; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(49, 130, 246, 0.2); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }
[hidden] { display: none !important; }

/* ---------- 누르는 느낌 (공통) ---------- */
.btn, .chip, .card-link, .nav-item, .icon-btn, .say-btn, .star-btn, .choice-btn, .day-row, .post-row,
.student-card, .link-card, .cal-day, .tab, .dict-tab, .segment span, .sheet-option, .picker-cell,
.select-btn, .stepper-btn, .back-link, .dict-fab, .row-link, .mini-list a, .card-head-link {
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:active, .chip:active, .card-link:active, .icon-btn:active, .say-btn:active, .star-btn:active,
.choice-btn:active, .student-card:active, .link-card:active, .select-btn:active, .stepper-btn:active,
.dict-fab:active, .picker-cell:active { transform: scale(0.96); }
.day-row:active, .post-row:active, .sheet-option:active, .nav-item:active, .cal-day:active { transform: scale(0.98); }
.card-link:active { transform: scale(0.98); }

/* ---------- 레이아웃 ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.main { padding: 8px 20px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 8px 0 20px; padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: rgba(242, 244, 246, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -0.03em; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: -0.04em;
  font-family: var(--font-ja);
}
.brand-mark-lg { width: 60px; height: 60px; border-radius: 18px; font-size: 22px; }

/* 모바일 하단 탭 */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--grey-100);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -2px 16px rgba(0, 27, 55, 0.05);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav .brand, .nav-footer { display: none; }
.nav-list { list-style: none; margin: 0; padding: 0 6px; display: flex; height: var(--nav-h); }
.nav-list li { flex: 1; display: flex; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 44px; font-size: 11px; font-weight: 500; color: var(--grey-400); text-decoration: none; position: relative;
}
.nav-item .icon { width: 24px; height: 24px; }
.nav-item:hover { color: var(--grey-600); }
.nav-item.is-active { color: var(--grey-900); font-weight: 700; }

.icon-btn {
  width: 44px; height: 44px; border: 0; background: none; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--grey-600); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

@media (min-width: 900px) {
  .app {
    display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
    background: linear-gradient(to right, var(--surface) var(--side-w), var(--bg) var(--side-w));
  }
  .topbar { display: none; }
  .main { padding: 40px 48px 64px; width: 100%; max-width: none; }
  .nav {
    position: sticky; top: 0; height: 100vh; border-top: 0; border-radius: 0; box-shadow: none;
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
    display: flex; flex-direction: column; padding: 28px 16px 20px;
  }
  .nav .brand { display: flex; padding: 0 10px 28px; }
  .nav-list { flex-direction: column; height: auto; gap: 2px; padding: 0; }
  .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    height: 48px; padding: 0 14px; border-radius: 12px; font-size: 16px; font-weight: 500; color: var(--grey-600);
  }
  .nav-item .icon { width: 22px; height: 22px; }
  .nav-item:hover { background: var(--grey-50); color: var(--ink); }
  .nav-item.is-active { background: var(--grey-100); color: var(--grey-900); font-weight: 700; }
  .nav-footer {
    display: flex; flex-direction: column; gap: 10px; margin-top: auto;
    padding: 16px 6px 0;
  }
  .nav-user { font-size: 15px; font-weight: 700; padding: 0 4px; }
  .nav-user small { font-weight: 500; color: var(--muted); margin-left: 4px; font-size: 13px; }
}

/* ---------- 공통 요소 ---------- */
.page-head { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 24px; }
.page-head-row { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 24px 20px; }
.panel > h2:first-child { margin-bottom: 2px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-narrow { max-width: none; }
.row-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .row-2 { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius); border: 0;
  font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-dark { background: var(--grey-800); color: #fff; }
.btn-dark:hover { background: var(--grey-900); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #FFDCDC; color: var(--danger); }
.btn-ghost { background: var(--grey-100); color: var(--grey-700); }
.btn-ghost:hover { background: var(--grey-200); color: var(--grey-800); }
.panel .btn-ghost, .card .btn-ghost { background: var(--grey-100); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--grey-200); color: var(--grey-400); cursor: default; transform: none; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--grey-600); }
.field input, .field select, .field textarea, .search input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border: 0; border-radius: var(--radius); background: var(--grey-100); font-size: 16px; color: var(--ink);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.field input::placeholder, .field textarea::placeholder, .search input::placeholder { color: var(--grey-400); }
.panel .field input, .panel .field select, .panel .field textarea { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-200); }
.field input:hover, .field textarea:hover { box-shadow: inset 0 0 0 1px var(--grey-300); }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus {
  outline: none; background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent);
}
.field select {
  padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238B95A1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field-help { font-size: 13px; color: var(--muted); line-height: 1.6; }
.field-error { font-size: 13px; color: var(--danger); font-weight: 500; }
.has-error input, .has-error select, .has-error textarea, .has-error .select-btn { box-shadow: inset 0 0 0 2px var(--danger) !important; }

.alert { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 14px 16px; font-size: 15px; font-weight: 500; }

/* 알림: 아래(PC 는 위)에서 떠올랐다 사라지는 토스트 */
.messages {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translateX(-50%); width: min(440px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.message {
  pointer-events: auto; padding: 14px 18px; border-radius: 16px; font-size: 15px; font-weight: 500;
  background: rgba(51, 61, 75, 0.96); color: #fff; box-shadow: var(--shadow-float);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.42s var(--ease-out) both;
}
.message::before { content: ""; flex: none; width: 20px; height: 20px; border-radius: 10px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8v5M12 16.5v.5'/%3E%3C/svg%3E") center no-repeat; }
.message-success::before { background: #19C47A url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center no-repeat; }
.message-error::before { background-color: #F04452; }
.message.is-leaving { animation: toast-out 0.3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(0.96); } }
@media (min-width: 900px) {
  .messages { bottom: auto; top: 24px; left: calc(50% + var(--side-w) / 2); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(0.96); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-12px) scale(0.96); } }
}

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--grey-100); color: var(--grey-700); }
.badge-good { background: var(--good-soft); color: var(--good); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border-radius: 19px;
  border: 0; background: var(--surface); color: var(--grey-700); font-size: 14px; font-weight: 500; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--grey-200); cursor: pointer;
}
.panel .chip, .card .chip { background: var(--grey-100); box-shadow: none; }
.chip:hover { color: var(--ink); background: var(--grey-50); }
.panel .chip:hover { background: var(--grey-200); }
.chip.is-active, .panel .chip.is-active { background: var(--grey-800); color: #fff; font-weight: 600; box-shadow: none; }

.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 10px; color: var(--grey-600); text-decoration: none; font-size: 15px; font-weight: 500; margin: 0 0 4px -8px; border-radius: 10px; }
.back-link:hover { color: var(--ink); }
.back-link:active { transform: translateX(-2px); }

/* ---------- 홈 ---------- */
.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 24px 22px; border-radius: 24px;
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.card-link:hover { color: var(--ink); box-shadow: 0 6px 20px rgba(0, 27, 55, 0.06); }
.card-number { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.card-number small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: -0.01em; }
.card-hint { font-size: 15px; color: var(--muted); line-height: 1.55; }
.card-head { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.card-head-link:hover { color: var(--ink); }
.card-icon, .title-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.card-icon { width: 44px; height: 44px; border-radius: 14px; }
.card-icon svg { width: 24px; height: 24px; }
.card-status { font-size: 15px; font-weight: 600; color: var(--accent); margin-top: 2px; }
.card-status::after { content: " ›"; }
div.card .card-status::after { content: none; }

/* 페이지 제목: 아이콘 + 제목 + 한 줄 설명 */
.title-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.title-icon { width: 48px; height: 48px; border-radius: 16px; background: var(--surface); }
.title-icon svg { width: 26px; height: 26px; }
.title-text h1 { font-size: 24px; }
.page-sub { font-size: 15px; color: var(--muted); margin-top: 2px; }

/* ---------- 학생 관리 ---------- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.search { position: relative; display: flex; align-items: center; width: 280px; max-width: 100%; color: var(--grey-500); }
.search .icon { position: absolute; left: 14px; width: 20px; height: 20px; pointer-events: none; }
.search input { padding-left: 44px; min-height: 46px; font-size: 16px; background: var(--surface); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
@media (max-width: 599px) { .search { width: 100%; } }

.table-box { background: var(--surface); border-radius: var(--radius-lg); overflow-x: auto; padding: 4px 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--grey-500); padding: 14px 14px 10px; }
.table td { padding: 14px; border-top: 1px solid var(--grey-100); }
.table tbody tr { transition: background-color 0.15s; }
.table tbody tr:hover { background: var(--grey-50); }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--accent); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius-lg); font-size: 15px; line-height: 1.7; }

.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile > div { flex: 1; min-width: 0; }
.avatar {
  flex: none; width: 56px; height: 56px; border-radius: 28px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
}
.detail-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--grey-100); font-size: 15px; }
.history li:last-child { border-bottom: 0; }
.history-range { font-weight: 600; }

/* ---------- 로그인 ---------- */
.page-login { background: var(--surface); }
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); padding: 32px 4px; display: flex; flex-direction: column; gap: 28px; }
@media (min-width: 600px) {
  .page-login { background: var(--bg); }
  .login-card { border-radius: 28px; padding: 44px 32px; box-shadow: 0 12px 40px rgba(0, 27, 55, 0.06); }
}
.login-head { display: flex; flex-direction: column; gap: 8px; }
.login-head h1 { font-size: 28px; margin-top: 12px; }
.login-note { font-size: 14px; text-align: center; line-height: 1.6; }
.login-card .btn-primary { min-height: 56px; font-size: 17px; border-radius: 16px; }

/* ---------- 공통 추가 ---------- */
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--grey-100); color: var(--grey-600); vertical-align: middle; }
.section-title { margin: 32px 0 12px; font-size: 18px; }
.chip-lg { min-height: 44px; min-width: 56px; justify-content: center; font-weight: 600; font-size: 15px; border-radius: 14px; }
.field-inline select { min-height: 44px; font-size: 15px; padding: 0 40px 0 14px; }
.actions-split { justify-content: space-between; margin-top: 24px; }
.pager { display: flex; justify-content: space-between; margin-top: 24px; }
code { font-size: 0.9em; background: var(--grey-100); padding: 2px 6px; border-radius: 6px; }

progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--grey-100); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--grey-100); border-radius: 3px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 3px; transition: width 0.6s var(--ease-out); }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

/* ---------- 탭 (페이지 이동형) ---------- */
.tabs { display: flex; gap: 24px; margin: 8px 0 20px; box-shadow: inset 0 -1px 0 var(--grey-200); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 48px; flex: none;
  color: var(--grey-500); text-decoration: none; font-size: 17px; font-weight: 600;
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; /* <button class="tab"> 용 */
}
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 1px;
  background: var(--grey-900); transform: scaleX(0); transition: transform 0.28s var(--ease-out);
}
.tab:hover { color: var(--grey-700); }
.tab.is-active { color: var(--grey-900); font-weight: 700; }
.tab.is-active::after { transform: scaleX(1); }
.tab small { font-size: 14px; color: var(--grey-400); font-weight: 500; }

/* ---------- 단어장 ---------- */
.day-list, .post-list, .tag-manage-list { list-style: none; margin: 0; padding: 6px 0; background: var(--surface); border-radius: var(--radius-lg); }
.day-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; color: var(--ink); text-decoration: none; }
.day-row:hover { background: var(--grey-50); color: var(--ink); }
.day-badge { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--grey-100); color: var(--grey-600); display: flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-badge.is-done { background: var(--accent-soft); color: var(--accent); }
.day-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.day-title { font-weight: 600; font-size: 16px; }
.day-title small { font-weight: 500; margin-left: 4px; }
.day-score { font-size: 14px; font-weight: 600; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

.word-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.word-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 18px 16px 18px 20px; background: var(--surface); border-radius: var(--radius-lg); }
.word-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.word-expr { font-family: var(--font-ja); font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: 0; }
.word-reading { font-family: var(--font-ja); font-size: 14px; color: var(--muted); letter-spacing: 0; }
.word-meaning { font-size: 15px; margin-top: 6px; color: var(--grey-700); }
.word-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.bookmark-form { display: inline; }
.star-btn { width: 44px; height: 44px; border: 0; border-radius: 22px; background: none; color: var(--grey-300); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.star-btn:hover { background: var(--grey-100); color: var(--grey-400); }
.star-btn.is-on { color: #FFB800; }
.star-btn.is-on svg { fill: currentColor; animation: pop 0.36s var(--ease-out); }
@keyframes pop { 40% { transform: scale(1.3); } }
.quiz-start { margin-bottom: 16px; }

.quiz { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; }
.quiz-head h1 { font-size: 20px; }
.quiz-card { position: relative; min-height: 220px; padding: 32px 20px; background: var(--surface); border-radius: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.quiz-star { position: absolute; top: 8px; right: 8px; }
.quiz-word { font-family: var(--font-ja); font-size: 48px; font-weight: 700; line-height: 1.2; letter-spacing: 0; }
.choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choice { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-radius: 18px; border: 0; background: var(--surface); font-size: 17px; font-weight: 500; text-align: left; }
.choice-btn { width: 100%; cursor: pointer; }
.choice-btn:hover { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-200); }
.choice.is-answer { box-shadow: inset 0 0 0 2px #19C47A; background: var(--good-soft); color: var(--good); font-weight: 700; animation: pop-soft 0.4s var(--ease-out); }
.choice.is-wrong { box-shadow: inset 0 0 0 2px #F04452; background: var(--danger-soft); color: var(--danger); animation: shake 0.4s var(--ease); }
@keyframes pop-soft { 40% { transform: scale(1.02); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.choice-mark { font-size: 13px; font-weight: 700; flex: none; }
.quiz-feedback { padding: 16px 18px; border-radius: 16px; font-weight: 700; animation: rise 0.3s var(--ease-out); }
.quiz-feedback.is-good { background: var(--good-soft); color: var(--good); }
.quiz-feedback.is-bad { background: var(--danger-soft); color: var(--danger); }
.quiz-feedback .muted { font-weight: 500; }
.result-card { padding: 36px 24px; text-align: center; background: var(--surface); border-radius: 28px; display: flex; flex-direction: column; gap: 8px; }
.result-score { font-size: 56px; font-weight: 800; line-height: 1.1; letter-spacing: -0.04em; color: var(--accent); font-variant-numeric: tabular-nums; }
.result-score small { font-size: 24px; color: var(--grey-400); font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 일기장 ---------- */
.cal { max-width: none; padding: 20px 16px 24px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 6px; text-align: center; }
.cal-wd { font-size: 13px; font-weight: 500; color: var(--grey-500); padding: 6px 0; }
.cal-wd.is-sun { color: #F04452; }
.cal-wd.is-sat { color: var(--accent); }
.cal-day { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 14px; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
a.cal-day:hover { background: var(--grey-50); color: var(--ink); }
.cal-day.is-off { color: var(--grey-300); }
.cal-num { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 18px; font-size: 16px; font-weight: 500; }
.cal-day.is-today .cal-num { background: var(--accent); color: #fff; font-weight: 700; }
.cal-dot { width: 5px; height: 5px; border-radius: 3px; background: transparent; display: inline-block; }
.cal-dot.has-diary { background: var(--accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; padding: 0 6px; font-size: 13px; color: var(--muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }

.reading { display: flex; flex-direction: column; gap: 8px; }
.reading-all { align-self: flex-start; }
.reading-list { list-style: none; margin: 0; padding: 0; }
.reading-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grey-100); }
.reading-row:last-child { border-bottom: 0; }
.say-btn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.say-btn:hover { background: #D6E9FF; }
.say-btn.is-playing { background: var(--accent); color: #fff; animation: pulse 1.2s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(49, 130, 246, 0.4); } 100% { box-shadow: 0 0 0 12px rgba(49, 130, 246, 0); } }
.say-btn:disabled { opacity: 0.4; cursor: default; animation: none; }
.reading-text { font-family: var(--font-ja); font-size: 20px; line-height: 2.1; margin: 0; padding-top: 2px; letter-spacing: 0; }
.reading-text rt { font-size: 0.5em; color: var(--muted); }
.ko-block { background: var(--grey-50); border-radius: var(--radius); padding: 0 18px; }
.ko-block summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--grey-700); list-style: none; }
.ko-block summary::-webkit-details-marker, .format-help summary::-webkit-details-marker { display: none; }
.ko-block summary::after, .format-help summary::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--grey-500); border-bottom: 2px solid var(--grey-500);
  transform: rotate(45deg) translateY(-3px); transition: transform 0.25s var(--ease);
}
.ko-block[open] summary::after, .format-help[open] summary::after { transform: rotate(225deg) translate(-2px, 0); }
.ko-block p { padding-bottom: 16px; color: var(--grey-700); line-height: 1.75; }
.reading-tip { font-size: 14px; }

.field textarea { min-height: 140px; padding: 14px 16px; line-height: 1.75; resize: vertical; }
.field textarea[lang="ja"] { font-family: var(--font-ja); letter-spacing: 0; }
.preview-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 15px; }
.mini-list a { display: block; padding: 10px 0; color: var(--grey-800); text-decoration: none; border-top: 1px solid var(--grey-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list li:first-child a { border-top: 0; }
.mini-list a:hover { color: var(--accent); }

/* ---------- 상단 바 ---------- */
.topbar-actions { display: flex; align-items: center; gap: 2px; }

/* ---------- 수업자료 ---------- */
.tag-chips { margin-bottom: 16px; }
.post-row { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 44px 16px 20px; color: var(--ink); text-decoration: none; }
.post-row::after, .day-row::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid var(--grey-300); border-top: 2px solid var(--grey-300); transform: rotate(45deg);
}
.day-row { position: relative; padding-right: 44px; }
.post-row:hover { background: var(--grey-50); color: var(--ink); }
.post-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.post-title { font-weight: 600; font-size: 17px; }
.post-excerpt { font-size: 15px; color: var(--grey-600); }
.post-meta { font-size: 13px; color: var(--grey-500); }

.post { max-width: none; }
.post-date { font-size: 14px; }
.post-body { font-size: 17px; line-height: 1.85; color: var(--grey-800); overflow-wrap: anywhere; }
.post-body > * + * { margin-top: 16px; }
.post-body h2 { font-size: 21px; margin-top: 32px; color: var(--ink); }
.post-body h3 { font-size: 18px; margin-top: 24px; color: var(--ink); }
.post-body > :first-child { margin-top: 0; }
.post-body h2:first-child, .post-body h3:first-child { line-height: 1.4; }
.post-body ul, .post-body ol { padding-left: 22px; margin-bottom: 0; }
.post-body li + li { margin-top: 6px; }
.post-body blockquote { margin: 16px 0 0; padding: 14px 18px; background: var(--grey-50); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; font-family: var(--font-ja); letter-spacing: 0; }
.post-body hr { border: 0; border-top: 1px solid var(--grey-200); margin: 28px 0; }
.post-body rt { font-size: 0.55em; color: var(--muted); }
.post-images { display: grid; gap: 12px; margin-top: 24px; }
.post-images img { display: block; width: 100%; height: auto; border-radius: 16px; background: var(--grey-100); }

.link-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 16px; background: var(--grey-50); color: var(--ink); text-decoration: none; box-shadow: inset 0 0 0 1px var(--grey-200); }
.link-card:hover { background: var(--accent-soft); box-shadow: none; color: var(--ink); }
.link-card-site { font-size: 13px; font-weight: 700; color: var(--accent); }
.link-card-url { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.editor { display: flex; flex-direction: column; gap: 20px; }
.kind-field { border: 0; padding: 0; margin: 0; }

/* 세그먼트: 고른 칸 아래로 흰 판이 미끄러져 간다 (두 칸 기준) */
.segmented { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; background: var(--grey-100); border-radius: 14px; align-self: flex-start; isolation: isolate; }
.segmented::before {
  content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 10px; background: var(--surface); box-shadow: 0 1px 4px rgba(0, 27, 55, 0.1);
  transition: transform 0.32s var(--ease-out);
}
.segmented:has(.segment:nth-child(2) input:checked)::before { transform: translateX(100%); }
.segment { position: relative; display: flex; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment span { flex: 1; justify-content: center; min-height: 40px; padding: 0 22px; display: inline-flex; align-items: center; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--grey-500); }
.segment input:checked + span { color: var(--ink); }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 0; }
.segmented:has(.segment:nth-child(3))::before { display: none; }
.segmented:has(.segment:nth-child(3)) .segment input:checked + span { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 27, 55, 0.1); }

/* 체크박스 하나짜리 설정은 토글 스위치로 */
.check { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; font-size: 16px; font-weight: 500; cursor: pointer; }
.check input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0; cursor: pointer;
  width: 50px; height: 30px; border-radius: 15px; background: var(--grey-300);
  transition: background-color 0.25s var(--ease);
}
.check input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 27, 55, 0.2); transition: transform 0.3s var(--ease-out);
}
.check input:checked { background: var(--accent); }
.check input:checked::after { transform: translateX(20px); }
.check:active input::after { width: 28px; }
.check input:checked:active::after { transform: translateX(16px); }

.field textarea#id_body { min-height: 360px; }
.field input[type="file"] { padding: 14px 16px; min-height: 0; }
.field input[type="file"]::file-selector-button { border: 0; border-radius: 10px; padding: 8px 14px; margin-right: 12px; background: var(--grey-200); color: var(--grey-800); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.format-help { background: var(--grey-50); border-radius: var(--radius); padding: 0 18px; }
.format-help summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--grey-700); list-style: none; }
.format-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.format-table td { padding: 8px 0; border-top: 1px solid var(--grey-200); }
.format-table td:first-child { width: 55%; }
.thumb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.thumb { display: flex; flex-direction: column; gap: 6px; font-size: 13px; cursor: pointer; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }

/* ---------- 사전 패널 ---------- */
.dict-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(420px, 100%); display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(0, 27, 55, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.dict-grip { display: none; }
.dict-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 0 22px; min-height: 60px; }
.dict-head h2 { font-size: 20px; }
.dict-form { padding: 12px 20px 14px; }
.dict-form .search { width: 100%; }
.dict-form .search input { background: var(--grey-100); }
.dict-results { flex: 1; overflow-y: auto; padding: 4px 20px 28px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.dict-results .word-list { grid-template-columns: minmax(0, 1fr); }
.dict-results .word-card { background: var(--grey-50); }
.dict-lemma, .dict-empty { font-size: 15px; line-height: 1.7; }
.dict-words .word-expr { font-size: 22px; }

/* 번역/단어 탭: 두 칸 세그먼트, 고른 쪽으로 판이 미끄러진다 */
.dict-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 8px 20px 4px; padding: 4px; background: var(--grey-100); border-radius: 14px; isolation: isolate; }
.dict-tabs::before {
  content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 10px; background: var(--surface); box-shadow: 0 1px 4px rgba(0, 27, 55, 0.1);
  transition: transform 0.32s var(--ease-out);
}
.dict-tabs:has(.dict-tab:nth-child(2).is-active)::before { transform: translateX(100%); }
.dict-tab { min-height: 40px; padding: 0 14px; border: 0; background: none; cursor: pointer; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--grey-500); }
.dict-tab.is-active { color: var(--ink); }
.dict-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: fade-in 0.25s var(--ease); }
.dict-pane[data-dict-pane="translate"] { padding: 14px 20px 28px; gap: 12px; overflow-y: auto; }
@keyframes fade-in { from { opacity: 0; } }
.tr-dir { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tr-lang { flex: 1; font-size: 15px; font-weight: 700; text-align: center; }
.tr-lang:last-child { text-align: center; }
[data-tr-swap] .icon { transition: transform 0.35s var(--ease-out); }
[data-tr-swap].is-flipped .icon { transform: rotate(180deg); }
.tr-box { border-radius: 18px; background: var(--grey-100); transition: box-shadow 0.18s var(--ease), background-color 0.18s; }
.tr-box:focus-within { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.tr-box textarea { display: block; width: 100%; border: 0; background: none; resize: vertical; min-height: 120px; padding: 16px 18px 8px; line-height: 1.7; font-size: 17px; border-radius: 18px 18px 0 0; }
.tr-box textarea:focus, .tr-box textarea:focus-visible { outline: none; }
.tr-box textarea[lang="ja"] { font-family: var(--font-ja); letter-spacing: 0; }
.tr-tools { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px; }
.tr-count { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.tr-msg { font-size: 14px; min-height: 1em; margin: 0; }
.tr-msg.is-error { color: var(--danger); }
.tr-result { display: flex; align-items: flex-start; gap: 8px; padding: 18px; border-radius: 18px; background: var(--accent-soft); animation: rise 0.3s var(--ease-out); }
.tr-out { flex: 1; margin: 0; font-size: 19px; font-weight: 500; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--grey-900); }
.tr-out[lang="ja"] { font-family: var(--font-ja); letter-spacing: 0; }
.say-sm { width: 38px; height: 38px; border-radius: 19px; }
.say-sm .icon { width: 18px; height: 18px; }
.tr-result .say-btn { background: var(--surface); }
.dict-pane[data-dict-pane="word"] .dict-form { padding-top: 12px; }

/* 사전 열기·닫기 버튼: PC 는 오른쪽 아래 떠 있는 버튼, 모바일은 위쪽 바의 아이콘 */
.dict-fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 45; display: none; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 28px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 8px 24px rgba(49, 130, 246, 0.35);
}
.dict-fab:hover { background: var(--accent-ink); }
.dict-fab[aria-expanded="true"] { background: var(--grey-800); box-shadow: 0 8px 24px rgba(0, 27, 55, 0.25); }
.icon-btn[data-dict-open][aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 900px) { .dict-fab { display: inline-flex; } }

.w { cursor: pointer; border-radius: 4px; transition: background-color 0.15s; }
.w:hover { background: var(--accent-soft); }
.w.is-picked { background: var(--accent-soft); box-shadow: 0 2px 0 var(--accent); }

/* 모바일: 사전은 아래에서 올라오는 시트. 위쪽 글(누른 단어)이 계속 보이게 한다. */
@media (max-width: 899px) {
  .dict-panel {
    top: auto; height: 60vh; height: 60dvh; width: 100%; z-index: 50;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 27, 55, 0.16);
    animation: sheet-up 0.38s var(--ease-out);
  }
  /* 키보드가 올라오면 시트를 키보드 바로 위로(--kb, dict.js). 높이도 보이는 화면에 맞춰 줄여요. */
  .dict-panel { bottom: var(--kb, 0px); max-height: calc(var(--vvh, 100dvh) - 12px); overscroll-behavior: contain; }
  .dict-panel.has-keyboard { padding-bottom: 0; height: min(60dvh, calc(var(--vvh, 100dvh) - 56px)); }
  .dict-panel.is-full { height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top) - 8px); border-radius: 20px 20px 0 0; }
  .dict-panel:not(.is-dragging) { transition: height 0.28s var(--ease-out), bottom 0.2s var(--ease-out); }
  .dict-panel.is-flinging { transition: transform 0.2s var(--ease); }
  .dict-grip { position: absolute; top: 0; left: 0; right: 0; height: 28px; display: flex; justify-content: center; padding-top: 8px; touch-action: none; cursor: grab; z-index: 1; }
  .dict-grip span { width: 40px; height: 4px; border-radius: 2px; background: var(--grey-300); }
  .dict-head { touch-action: none; cursor: grab; }
  .is-dragging .dict-grip, .is-dragging .dict-head { cursor: grabbing; }
  .dict-panel.is-closing { animation: sheet-down 0.25s var(--ease) both; }
  .dict-head { min-height: 52px; padding-top: 16px; }
  .dict-is-open .main { padding-bottom: 64vh; }
  /* 서버가 PC 용으로 '열림'을 그린 화면: 모바일에서는 JS 가 닫기 전에도 시트를 보이지 않는다 */
  .dict-auto .dict-panel { display: none !important; }
  .dict-auto.dict-is-open .main { padding-bottom: calc(var(--nav-h) + 40px); }
  .w { scroll-margin-top: 80px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }

/* PC: 사전은 오른쪽에 붙어 있는 칸. 켜 두면 내용은 6~7할 폭으로 줄고, 끄면 다시 꽉 찬다. */
@media (min-width: 900px) {
  .dict-is-open .app {
    grid-template-columns: var(--side-w) minmax(0, 65fr) minmax(340px, 35fr);
  }
  .dict-panel {
    position: sticky; top: 0; z-index: auto; align-self: start;
    width: auto; height: 100vh; padding-bottom: 0;
    box-shadow: -1px 0 0 var(--grey-200);
  }
  .dict-panel.is-opening { animation: slide-in 0.32s var(--ease-out); }
}
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

.usage { margin-top: 32px; max-width: 420px; }
.usage .field-help { margin-bottom: 8px; }

/* 일기장: 연·월 고르기. 제목을 누르면 아래에서 시트가 올라온다 (JS 가 없으면 기기 기본 선택 화면) */
.month-picker { position: relative; display: inline-flex; align-items: center; }
.month-label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 12px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  transition: background-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.month-label::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--grey-500); border-bottom: 2px solid var(--grey-500); transform: rotate(45deg) translateY(-2px); }
.month-picker:hover .month-label { background: var(--grey-100); }
.month-picker:active .month-label { transform: scale(0.96); }
.month-picker input[type="month"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }

/* 태그 */
.chip-manage { box-shadow: inset 0 0 0 1px var(--grey-300); background: transparent; color: var(--grey-600); }
.tag-check { cursor: pointer; position: relative; }
.tag-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-check:has(input:checked) { background: var(--grey-800); color: #fff; box-shadow: none; }
.tag-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-add { justify-content: flex-start; flex-wrap: nowrap; }
.tag-add-field { flex: 1; max-width: 360px; }
.tag-add-field input { width: 100%; min-height: 48px; font-size: 16px; }
.tag-manage-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 20px; }
.tag-manage-row + .tag-manage-row { border-top: 1px solid var(--grey-100); }
.tag-rename { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
.tag-rename .field-inline { flex: 1; }
.tag-rename input { width: 100%; min-height: 44px; font-size: 16px; }
.tag-count { font-size: 14px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 8px; }
.tag-manage-row .btn-danger { margin-left: auto; }

/* 수업노트 필터 */
.note-filter-hint { font-size: 14px; }
.toolbar .chip { min-height: 46px; }
.course-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.course-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.course-form { display: flex; align-items: center; gap: 8px; }
.course-form input { width: 72px; min-height: 44px; font-size: 16px; text-align: center; }
.course-start { padding-top: 12px; border-top: 1px solid var(--grey-100); }

/* ---------- 선생님: 보고 있는 학생 ---------- */
.viewing-form { margin: 0; }
.viewing-form select {
  width: 100%; min-height: 44px; padding: 0 36px 0 14px; border: 0; border-radius: 12px;
  background: var(--grey-100); font-size: 15px; font-weight: 600; color: var(--ink);
}
.viewing-top select { max-width: 132px; min-height: 38px; font-size: 14px; }
@media (min-width: 900px) { .viewing-top { display: none; } }
.viewing-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 20px; padding: 12px 12px 12px 18px; border-radius: 16px;
  background: var(--warn-soft); color: var(--warn); font-size: 15px;
  animation: rise 0.3s var(--ease-out);
}
.viewing-bar form { margin: 0; }
.viewing-clear { border: 0; background: rgba(255, 255, 255, 0.7); color: inherit; font-weight: 700; cursor: pointer; min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; transition: transform 0.18s var(--ease), background-color 0.18s; }
.viewing-clear:hover { background: #fff; }
.viewing-clear:active { transform: scale(0.96); }
.filter-row { margin-bottom: 16px; }

/* 선생님 일기장: 학생 목록 */
.student-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.student-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border-radius: var(--radius-lg); color: inherit; text-decoration: none; }
.student-card:hover { box-shadow: 0 6px 20px rgba(0, 27, 55, 0.06); color: inherit; }
.student-card.is-inactive { opacity: 0.55; }
.student-card-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.student-card-main strong { font-size: 17px; }
.student-card .icon { color: var(--grey-400); }
.diary-edited { font-size: 14px; }
.reading-panel { margin-top: 12px; }

/* ---------- 바텀시트 (고르기 · 연월 · 날짜) ---------- */
.select-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; }
.select-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  min-height: 52px; padding: 0 14px 0 16px; border: 0; border-radius: var(--radius); background: var(--grey-100);
  font-size: 16px; font-weight: 500; color: var(--ink); text-align: left; cursor: pointer;
}
.panel .select-btn { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-200); }
.select-btn:hover { background: var(--grey-200); }
.panel .select-btn:hover { box-shadow: inset 0 0 0 1px var(--grey-300); background: var(--grey-50); }
.select-btn::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: -4px 4px 0;
  border-right: 2px solid var(--grey-500); border-bottom: 2px solid var(--grey-500); transform: rotate(45deg);
}
.select-btn .select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn.is-placeholder .select-value { color: var(--grey-400); }
.field-inline .select-btn, .toolbar .select-btn { width: auto; min-height: 46px; padding: 0 12px 0 16px; font-size: 15px; font-weight: 600; background: var(--surface); }
.toolbar .select-btn:hover { background: var(--grey-50); }
.viewing-form .select-btn { min-height: 44px; font-size: 15px; font-weight: 700; border-radius: 12px; }
.viewing-top .select-btn { min-height: 38px; max-width: 140px; padding: 0 8px 0 12px; font-size: 14px; background: var(--surface); }
.date-btn::after { content: none; }
.date-btn .icon { color: var(--grey-500); }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 12, 30, 0.5);
  animation: fade-in 0.25s var(--ease);
}
.sheet-backdrop.is-closing { animation: fade-out 0.22s var(--ease) both; }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-height: 80vh; max-height: 80dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 28px 28px 0 0;
  padding: 10px 0 calc(16px + env(safe-area-inset-bottom));
  animation: sheet-up 0.42s var(--ease-out);
  box-shadow: 0 -8px 40px rgba(0, 27, 55, 0.16);
  touch-action: pan-y;
}
.sheet::before { content: ""; flex: none; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--grey-300); margin-bottom: 8px; }
.sheet.is-closing { animation: sheet-down 0.26s var(--ease) both; }
.sheet-title { padding: 14px 24px 12px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px; }
.sheet-options { list-style: none; margin: 0; padding: 0 0 4px; }
.sheet-option {
  width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px; border: 0; border-radius: 14px; background: none; font-size: 17px; font-weight: 500; color: var(--grey-800);
  text-align: left; cursor: pointer;
}
.sheet-option:hover, .sheet-option:focus-visible { background: var(--grey-50); outline: none; }
.sheet-option[aria-selected="true"] { color: var(--accent); font-weight: 700; }
.sheet-option[aria-selected="true"]::after {
  content: ""; flex: none; width: 18px; height: 10px; margin: -4px 4px 0 0;
  border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg);
}
.sheet-option:disabled { color: var(--grey-300); cursor: default; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 20px 0; }
.sheet-foot .btn { flex: 1; min-height: 56px; border-radius: 16px; font-size: 17px; }

@media (min-width: 900px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: 420px; max-height: 72vh;
    transform: translate(-50%, -50%); border-radius: 28px; padding: 16px 0 20px;
    animation: pop-in 0.3s var(--ease-out);
  }
  .sheet::before { display: none; }
  .sheet.is-closing { animation: pop-out 0.2s var(--ease) both; }
  @keyframes pop-in { from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); } }
  @keyframes pop-out { to { opacity: 0; transform: translate(-50%, -48%) scale(0.97); } }
}

/* 연·월, 날짜 고르기 */
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 8px; }
.picker-head strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 12px 8px; }
.picker-grid.is-days { grid-template-columns: repeat(7, 1fr); gap: 2px; }
.picker-wd { text-align: center; font-size: 13px; color: var(--grey-500); padding: 4px 0 8px; }
.picker-wd:first-child { color: #F04452; }
.picker-wd:last-child { color: var(--accent); }
.picker-cell {
  min-height: 52px; border: 0; border-radius: 14px; background: var(--grey-50); cursor: pointer;
  font-size: 16px; font-weight: 600; color: var(--grey-800); font-variant-numeric: tabular-nums;
}
.is-days .picker-cell { min-height: 44px; background: none; border-radius: 22px; font-weight: 500; }
.picker-cell:hover { background: var(--grey-100); }
.picker-cell.is-today { color: var(--accent); }
.picker-cell[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 700; }
.picker-cell:disabled { color: var(--grey-300); background: none; cursor: default; transform: none; }
.picker-slide { animation: slide-x 0.28s var(--ease-out); }
.picker-slide.is-back { animation-name: slide-x-back; }
@keyframes slide-x { from { opacity: 0; transform: translateX(16px); } }
@keyframes slide-x-back { from { opacity: 0; transform: translateX(-16px); } }

/* 숫자: −  8  + */
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; background: var(--grey-100); }
.panel .stepper { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-200); }
.stepper input { width: 52px !important; min-height: 40px !important; padding: 0 !important; text-align: center; background: none !important; box-shadow: none !important; font-size: 17px !important; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface); color: var(--grey-700); font-size: 22px; font-weight: 500; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 27, 55, 0.08); }
.stepper-btn:hover { color: var(--accent); }
.stepper-btn:disabled { color: var(--grey-300); box-shadow: none; background: transparent; cursor: default; transform: none; }
.stepper input.is-bump { animation: bump 0.25s var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.15); } }

/* ---------- 페이지 이동: 가벼운 페이드 + 살짝 위로 ---------- */
@view-transition { navigation: auto; }
.main { view-transition-name: main; }
::view-transition-group(root) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(main) { animation: vt-out 0.14s var(--ease) both; }
::view-transition-new(main) { animation: vt-in 0.3s var(--ease-out) both; }
::view-transition-group(main) { animation-duration: 0.3s; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* 처음 열 때 카드들이 차례로 떠오른다 (홈) */
.card-grid > * { animation: rise 0.42s var(--ease-out) both; }
.card-grid > *:nth-child(2) { animation-delay: 0.04s; }
.card-grid > *:nth-child(3) { animation-delay: 0.08s; }
.card-grid > *:nth-child(4) { animation-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  @view-transition { navigation: none; }
}

/* ---------- 문법 ---------- */
.stack-tight { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.rule-callout {
  margin: -8px 0 20px; padding: 18px 20px; border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 18px; font-weight: 700; line-height: 1.5;
}
.practice-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 12px; }
.practice-card { display: flex; flex-direction: column; gap: 8px; padding: 22px 20px; border-radius: 24px; background: var(--surface); color: var(--ink); text-decoration: none; margin: 0; }
.practice-link:hover { color: var(--ink); box-shadow: 0 6px 20px rgba(0, 27, 55, 0.06); }
.practice-link:active { transform: scale(0.98); }
.practice-link { transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.practice-title { font-size: 19px; font-weight: 700; }
.practice-hint { font-size: 15px; color: var(--muted); line-height: 1.55; }
.practice-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.practice-actions .field-inline { flex: 1; }
.practice-actions .select-btn { width: 100%; background: var(--grey-100); }
.practice-actions .btn { flex: none; min-width: 96px; }

.conj-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.conj-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 420px; }
.conj-table + .conj-table, .conj-scroll + .conj-scroll { margin-top: 16px; }
.conj-table th, .conj-table td { padding: 12px 10px; text-align: left; border-top: 1px solid var(--grey-100); vertical-align: top; }
.conj-table thead th { border-top: 0; font-size: 13px; font-weight: 600; color: var(--grey-500); white-space: nowrap; }
.conj-table tbody th { font-weight: 400; white-space: nowrap; }
.conj-form { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; }
.conj-read { display: block; font-size: 12px; color: var(--grey-500); white-space: nowrap; }

.example-text { flex: 1; min-width: 0; padding-top: 2px; }
.example-text .reading-text { font-size: 19px; line-height: 2; }
.example-ko { font-size: 15px; color: var(--grey-600); margin-top: 2px; }

.drill-target { margin-top: 8px; padding: 6px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 16px; font-weight: 700; }
.drill-input { min-height: 60px !important; font-size: 22px !important; font-weight: 600; text-align: center; border-radius: 18px !important; background: var(--surface) !important; }
.drill-answer { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 18px; }
.quiz-feedback { display: flex; flex-direction: column; gap: 4px; }
.quiz-feedback > .muted { font-size: 14px; }
.drill-exclude { display: flex; justify-content: center; }
.drill-wrong-answer { font-size: 18px; }

.deck-tip { font-size: 14px; }
.flash-list { display: flex; flex-direction: column; gap: 10px; }
.flash { background: var(--surface); border-radius: 24px; overflow: hidden; }
.flash-front { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 22px 22px; }
.flash-front::-webkit-details-marker { display: none; }
.flash-ko { font-size: 18px; font-weight: 600; line-height: 1.5; }
.flash-hint { font-size: 13px; color: var(--grey-400); }
.flash[open] .flash-hint { display: none; }
.flash-back { display: flex; align-items: center; gap: 12px; padding: 0 22px 22px; border-top: 1px solid var(--grey-100); padding-top: 16px; animation: rise 0.3s var(--ease-out); }
.flash-back .reading-text { flex: 1; }
.deck-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.deck-controls .btn { min-height: 56px; font-size: 17px; border-radius: 16px; }
.is-deck .flash { min-height: 220px; display: flex; flex-direction: column; justify-content: center; }
.is-deck .flash-front { align-items: center; text-align: center; padding: 36px 24px; }
.is-deck .flash-ko { font-size: 22px; }
.is-deck .flash.is-in { animation: card-in 0.35s var(--ease-out); }
@keyframes card-in { from { opacity: 0; transform: translateX(24px) scale(0.98); } }
.deck-controls .btn-ghost, .drill-exclude .btn-ghost { background: var(--surface); color: var(--grey-700); }
.deck-controls .btn:disabled { background: var(--grey-200); color: var(--grey-400); }
.page-head .btn-ghost { background: var(--surface); }
.page-head .btn-ghost:hover { background: var(--grey-50); }
.conj-block + .conj-block { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--grey-100); }
.conj-kind-title { font-size: 16px; font-weight: 700; color: var(--accent-ink); margin-bottom: 4px; }
.conj-table thead th:first-child, .conj-table tbody th { font-size: 14px; font-weight: 600; color: var(--grey-800); white-space: nowrap; }
.conj-rule { font-size: 13px; color: var(--grey-600); min-width: 120px; }
.conj-ko { font-size: 13px; color: var(--accent-ink); white-space: nowrap; }
.drill-rule { margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--grey-700); }
.drill-hint { background: var(--surface); border-radius: var(--radius); padding: 0 18px; }
.drill-hint summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--grey-600); list-style: none; }
.drill-hint summary::-webkit-details-marker { display: none; }
.drill-hint p { padding-bottom: 12px; font-size: 16px; }
.drill-hint p + p { margin-top: -8px; font-size: 14px; }

/* ---------------------------------------------------------------- 수업료 (가려 두고 누르면 보이기) */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.secret { display: inline-block; }
.fee-box { display: block; }
.secret summary, .fee-box summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-sm); background: var(--grey-100); color: var(--grey-700);
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; list-style: none; user-select: none;
  transition: transform 0.1s, background-color 0.15s;
}
.secret summary::-webkit-details-marker, .fee-box summary::-webkit-details-marker { display: none; }
.secret summary:hover, .fee-box summary:hover { background: var(--grey-200); }
.secret summary:active, .fee-box summary:active { transform: scale(0.97); }
.secret-mask { letter-spacing: 2px; color: var(--grey-400); }
.secret-show { color: var(--accent-ink); }
.secret-hide { display: none; color: var(--grey-600); }
.secret[open] .secret-mask, .fee-box[open] .secret-mask, .secret[open] .secret-show, .fee-box[open] .secret-show { display: none; }
.secret[open] .secret-hide, .fee-box[open] .secret-hide { display: inline; }
.secret-value { display: none; font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.secret[open] .secret-value { display: inline; }
.secret[open] summary { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-200); }
.fee-box { width: 100%; }
.fee-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding: 16px; border-radius: var(--radius-sm); background: var(--grey-50); }
.fee-now { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 17px; }
.fee-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fee-form input { font-size: 16px; }
.fee-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fee-actions .btn { min-height: 44px; }
.month-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; font-size: 17px; }
.month-nav .btn { min-width: 44px; min-height: 44px; font-size: 20px; }
.fee-summary { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.fee-stat { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.fee-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fee-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--grey-100); }
.fee-row:first-child { border-top: 0; }
.fee-who { flex: 1 1 180px; }
.fee-who a { color: inherit; text-decoration: none; }
@media (min-width: 720px) {
  .fee-summary { grid-template-columns: repeat(3, 1fr); }
  .fee-form { grid-template-columns: 1fr 1fr; }
  .fee-actions { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .secret summary, .fee-box summary { transition: none; }
  .secret summary:active, .fee-box summary:active { transform: none; }
}

/* ---------------------------------------------------------------- 문법: 한 눈에 보기 · 기초 문법 단계 */
.overview-sheet { position: relative; display: block; max-width: 760px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: transform 0.15s; }
.overview-sheet img { display: block; width: 100%; height: auto; }
.overview-sheet:active { transform: scale(0.99); }
.overview-hint { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--grey-900); color: var(--surface); font-size: 14px; font-weight: 600; }
.overview-hint svg { width: 16px; height: 16px; }
.grammar-group { padding: 20px; }
.grammar-group-title { margin: 0 0 8px; font-size: 15px; color: var(--grey-600); font-weight: 700; }
.step-list { list-style: none; margin: 0; padding: 0; }
.step-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; transition: background-color 0.15s, transform 0.1s; }
.step-row:hover { background: var(--grey-50); }
.step-row:active { transform: scale(0.98); }
.step-no { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 15px; }
.step-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title { font-size: 17px; font-weight: 600; color: var(--grey-900); }
.step-rule { font-size: 14px; color: var(--grey-600); }

/* 크게 보기 (static/js/zoom.js) */
html.zoom-open { overflow: hidden; }
.zoom { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--grey-900); color: var(--surface); }
.zoom::backdrop { background: var(--grey-900); }
.zoom[open] { display: flex; flex-direction: column; }
.zoom-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 12px 8px 16px; }
.zoom-tip { font-size: 14px; color: var(--grey-300); }
.zoom-close { min-height: 44px; min-width: 64px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--grey-700); color: var(--surface); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.zoom-stage { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 0 8px max(8px, env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.zoom-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; margin: auto; cursor: zoom-in; background: var(--surface); border-radius: var(--radius-sm); }
.zoom-stage.is-big { display: block; }
.zoom-stage.is-big img { max-width: none; max-height: none; width: max(200%, 1400px); cursor: zoom-out; }
@media (min-width: 900px) { .zoom-stage.is-big img { width: 1800px; } }
@media (prefers-reduced-motion: reduce) {
  .dict-panel:not(.is-dragging), .dict-panel.is-flinging { transition: none; }
  .overview-sheet, .step-row { transition: none; }
  .overview-sheet:active, .step-row:active { transform: none; }
}

/* 문법 상세: 설명 · 변형표 · 예문 · 연습 사이 간격(연습 카드끼리와 같은 12px) */
.detail-stack { display: flex; flex-direction: column; gap: 12px; }
.detail-stack .practice-row { margin-bottom: 0; }

/* 글 서식 표 (core/markup.py: | 칸 | 칸 |, 칸 안 '일본어 // 뜻') */
.md-table-wrap { overflow-x: auto; margin: 12px -4px; -webkit-overflow-scrolling: touch; }
.md-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 15px; }
.md-table th, .md-table td { padding: 12px 10px; text-align: left; border-top: 1px solid var(--grey-100); vertical-align: top; }
.md-table thead th { border-top: 0; font-size: 13px; font-weight: 600; color: var(--grey-500); white-space: nowrap; }
.md-table thead th:first-child { width: 22%; }
@media (max-width: 599px) {
  .md-table { font-size: 14px; }
  .md-table th, .md-table td { padding: 10px 6px; }
  .md-table thead th:first-child { width: 19%; }
  .md-ko { font-size: 13px; }
}
.md-table tbody th { color: var(--grey-700); font-weight: 600; font-size: 14px; }
.md-ja { display: block; color: var(--grey-900); }
.md-ko { display: block; margin-top: 2px; color: var(--accent-ink); font-size: 14px; }

/* 문법 공식 상자 (templates/grammar/_formula.html) */
.formula { margin: -8px 0 20px; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.formula-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; font-size: 18px; }
.formula-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-sm); font-weight: 700; }
.formula-stem { background: var(--grey-100); color: var(--grey-900); }
.formula-drop { color: var(--grey-400); text-decoration-thickness: 2px; margin-left: 1px; }
.formula-end { background: var(--accent-soft); color: var(--accent-ink); }
.formula-op { color: var(--grey-500); font-weight: 700; padding: 0 2px; }
.formula-note { margin: 2px 0 0; font-size: 15px; color: var(--grey-700); }
.formula-ja { color: var(--accent-ink); font-weight: 700; }
.formula-rule { margin: 2px 0 0; padding-top: 10px; border-top: 1px solid var(--grey-100); font-size: 14px; color: var(--grey-600); line-height: 1.6; }
@media (max-width: 599px) {
  .formula-line { font-size: 16px; }
  .formula-chip { min-height: 36px; padding: 0 10px; }
}

/* 히라가나·가타카나 글자표·암기법·쓰기 연습 */
.kana-tip { margin: 0; }
.kana-table { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.kana-table th { font-size: 13px; font-weight: 600; color: var(--grey-500); text-align: center; padding: 2px; }
.kana-table td { padding: 0; }
.kana-cell {
  width: 100%; min-height: 56px; border: 0; border-radius: var(--radius-sm); background: var(--grey-100);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease); font: inherit; color: inherit;
}
.kana-cell:active { transform: scale(0.96); }
.kana-cell.is-playing { background: var(--accent-soft); }
.kana-char { font-size: 22px; line-height: 1.2; font-weight: 500; }
.kana-ko { font-size: 12px; color: var(--grey-500); }
.kana-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kana-notes li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.kana-notes li + li { border-top: 1px solid var(--grey-100); }
.kana-note-char {
  flex: none; width: 64px; min-height: 56px; border: 0; border-radius: var(--radius-sm); background: var(--grey-100);
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; font: inherit; color: inherit;
}
.kana-note-char span { font-size: 24px; line-height: 1.2; }
.kana-note-char small { font-size: 12px; color: var(--grey-500); }
.kana-note-char.is-playing { background: var(--accent-soft); }
.kana-note-text { flex: 1; min-width: 0; }
.kana-quiz { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.kana-prompt { display: flex; align-items: center; gap: 12px; margin: 0; }
.kana-prompt-ko { font-size: 32px; font-weight: 700; }
.kana-pad-wrap { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; background: #fff; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--grey-200); }
.kana-pad { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.kana-answer {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font-size: 230px; line-height: 1; color: var(--grey-900); opacity: 0.28;
}
.kana-answer[hidden] { display: none; }

/* 글자 북마크 · 쓰기 연습 (새 화면) */
.kana-cell.is-marked { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.kana-cell.is-marked .kana-ko { color: var(--accent); font-weight: 600; }
.kana-cell-static { cursor: default; }
.kana-count { font-weight: 700; color: var(--accent); }
.kana-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kana-start-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--grey-100); }
.kana-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; color: var(--grey-600); }
.kana-answer.is-help { opacity: 0.12; }
.kana-verdict { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.kana-verdict[hidden] { display: none; }
.kana-verdict strong { font-size: 20px; }
.kana-verdict .btn.is-chosen { background: var(--grey-800); color: #fff; }
.kana-score { font-size: 20px; margin: 0; }
.kana-score span { font-weight: 700; color: var(--accent); }
.kana-note-static { cursor: default; }

/* 쓰기 연습: 화면 한 장에 들어오게 — 안내·버튼은 아래에 붙여 둬요(스크롤 필요 없음) */
.kana-mode { color: var(--grey-900); margin-right: 6px; }
.kana-quiz { gap: 8px; }
.kana-prompt-ko { font-size: 28px; line-height: 1.2; }
.kana-pad-wrap { width: min(100%, 320px, calc(100vh - 500px)); width: min(100%, 320px, calc(100dvh - 500px)); min-width: 170px; }
@media (max-height: 760px) { .kana-dock .kana-verdict .muted { display: none; } .kana-pad-wrap { width: min(100%, 320px, calc(100vh - 450px)); width: min(100%, 320px, calc(100dvh - 450px)); } }
.kana-dock {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5;
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 0 4px; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 14px);
}
.kana-dock .kana-verdict { gap: 2px; }
.kana-dock .kana-verdict strong { font-size: 18px; }
.kana-dock .kana-verdict .muted { font-size: 14px; line-height: 1.4; }
.kana-dock .kana-verdict .actions { margin-top: 4px; }
@media (min-width: 900px) { .kana-dock { bottom: 8px; } .kana-pad-wrap { width: min(100%, 320px, calc(100dvh - 420px)); } }

.kana-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kana-sec-head h2 { margin: 0; }
.kana-bulk { margin-left: auto; gap: 8px; cursor: pointer; }
.kana-box { width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--grey-300); background: #fff; display: inline-block; position: relative; }
.kana-bulk.is-on .kana-box { background: var(--accent); box-shadow: none; }
.kana-bulk.is-on .kana-box::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

/* 학생 홈: 메뉴 4개를 2×2 카드로 — 한 화면에 다 보이게 작게 */
.card-grid-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }
.card-grid-after { margin-top: 12px; max-width: 640px; grid-template-columns: minmax(0, 1fr); }
.card-tile { padding: 16px; gap: 6px; min-height: 148px; }
.card-tile .card-icon { margin-bottom: 4px; }
.card-tile .card-title { font-size: 18px; }
.card-tile .card-hint, .card-tile .card-status { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
