:root {
  --bg: #0c1020;
  --bg-elevated: #141a2e;
  --surface: rgba(22, 28, 48, 0.72);
  --surface-solid: #161c30;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f3ff;
  --text-soft: #b8c2dc;
  --muted: #7d8aad;
  --accent: #8b9cff;
  --accent-2: #f4a4b8;
  --accent-glow: rgba(139, 156, 255, 0.35);
  --sakura-glow: rgba(244, 164, 184, 0.2);
  --good: #4ade9a;
  --hard: #fbbf5a;
  --again: #ff7b8a;
  --easy: #67d4ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font: "Outfit", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  --font-jp: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, var(--sakura-glow), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(103, 212, 255, 0.08), transparent 60%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

/* ── Header ── */
.hero { margin-bottom: 20px; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-family: var(--font-jp);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(145deg, #2a3358, #1a2238);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-chip {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.stat-chip.accent {
  border-color: rgba(244, 164, 184, 0.25);
  background: linear-gradient(160deg, rgba(244, 164, 184, 0.12), var(--surface));
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.stat-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-left: 1px;
}

.sub {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  min-height: 1em;
}

/* ── Dock tabs ── */
.dock {
  display: flex;
  gap: 8px;
  padding: 5px;
  margin-bottom: 18px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.tab-icon { font-size: 1rem; line-height: 1; }

.tab.active {
  background: linear-gradient(135deg, var(--accent), #6b7fe8);
  color: #0c1020;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.panel { display: none; animation: fadeUp 0.35s ease; }
.panel.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Filters ── */
.filter-card,
.email-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.section-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-label:not(:first-child) { margin-top: 14px; }

.seg {
  display: flex;
  gap: 6px;
}

.seg.wrap { flex-wrap: wrap; }

.seg-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg.wrap .seg-btn { flex: 1 1 calc(50% - 6px); }

.seg-btn:hover { border-color: var(--border-strong); color: var(--text); }

.seg-btn.active {
  background: linear-gradient(135deg, rgba(139, 156, 255, 0.25), rgba(139, 156, 255, 0.1));
  border-color: rgba(139, 156, 255, 0.45);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(139, 156, 255, 0.15);
}

/* ── Buttons ── */
.btn {
  position: relative;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.primary {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), #6b7fe8);
  color: #0c1020;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn.primary.wide { width: 100%; }
.btn.ghost.wide { width: 100%; }

.dock .tab { font-size: 0.82rem; padding: 10px 8px; }
.dock .tab-icon { font-size: 0.95rem; }

.btn.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 11px 10px;
  font-size: 0.88rem;
  border-radius: 999px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
}

.btn.hira {
  background: rgba(244, 164, 184, 0.1);
  border: 1px solid rgba(244, 164, 184, 0.25);
  color: var(--text);
}

.btn.hira.on {
  background: linear-gradient(135deg, rgba(244, 164, 184, 0.35), rgba(139, 156, 255, 0.2));
  border-color: var(--accent-2);
  color: #fff;
  box-shadow: 0 4px 16px var(--sakura-glow);
}

.btn-icon {
  font-family: var(--font-jp);
  font-size: 0.95rem;
  opacity: 0.9;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Progress ── */
.progress-wrap { margin-bottom: 14px; }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 36px 20px 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.empty-state.hidden { display: none; }

.empty-art {
  font-size: 2.4rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px var(--sakura-glow));
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Flashcard ── */
.flashcard {
  margin-bottom: 14px;
  perspective: 1200px;
}

.flashcard.hidden,
.back.hidden,
.rating.hidden,
.grade.hidden,
.progress-wrap.hidden { display: none; }

.flashcard-shell {
  background: linear-gradient(165deg, #1c2440 0%, #141a2e 50%, #12182a 100%);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.flashcard-inner {
  position: relative;
  min-height: 220px;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-inner.flipped { transform: rotateY(180deg); }

.flashcard-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.back-face {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  overflow-y: auto;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(139, 156, 255, 0.12);
  border: 1px solid rgba(139, 156, 255, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.badge.new {
  color: var(--accent-2);
  background: rgba(244, 164, 184, 0.12);
  border-color: rgba(244, 164, 184, 0.25);
}

.jp-text { font-family: var(--font-jp); }

.front-face {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.back-front {
  font-size: clamp(1.05rem, 4vw, 1.25rem);
  line-height: 1.7;
  word-break: break-word;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--accent-2);
}

.back-front.hira-plain {
  text-align: left;
}

.back-front.with-ruby.ruby-long {
  text-align: left;
  justify-content: flex-start;
  line-height: 2.3;
  max-height: 140px;
  overflow-y: auto;
}

.example.hira-plain {
  line-height: 1.85;
  white-space: pre-wrap;
}

.example .hira-plain {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-2);
}

.front {
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  line-height: 1.55;
  word-break: break-word;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 4px 16px;
  width: 100%;
}

/* 단어: 가운데 정렬 유지 */
.front.with-ruby.vocab-ruby {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 2.4;
}

/* 문장·독해: 루비 시 왼쪽 정렬·스크롤 */
.front.with-ruby.ruby-long {
  display: block;
  text-align: left;
  align-self: stretch;
  line-height: 2.35;
  font-size: clamp(1rem, 3.8vw, 1.25rem);
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 2px 12px;
}

.front.with-ruby.ruby-long ruby {
  ruby-align: start;
}

.example.with-ruby {
  line-height: 2.35;
  text-align: left;
}

.example.with-ruby ruby {
  ruby-align: start;
}

.front.text-long {
  display: block;
  text-align: left;
  align-self: stretch;
  font-size: clamp(1rem, 3.8vw, 1.25rem);
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 2px 12px;
}

.front.with-ruby.vocab-ruby ruby {
  ruby-align: center;
}

rt {
  font-size: 0.5em;
  color: var(--accent-2);
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  flex-wrap: wrap;
}

.card-actions .btn {
  flex: 1 1 30%;
  min-width: 0;
  padding: 9px 6px;
  font-size: 0.82rem;
}

.meaning {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
}

.note {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.55;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.example-block {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.example-label {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.example {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.example .ex-ko {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.88rem;
}

/* ── Rating ── */
.rating { margin-top: 4px; }

.rating-label {
  margin: 0 0 10px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.r {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 14px;
  padding: 12px 6px 10px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.r:active { transform: scale(0.96); }

.r-emoji { font-size: 1.2rem; line-height: 1; }

.r-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.75);
}

.r.again { background: linear-gradient(160deg, #ff9aa5, var(--again)); box-shadow: 0 6px 16px rgba(255, 123, 138, 0.3); }
.r.hard { background: linear-gradient(160deg, #ffd080, var(--hard)); box-shadow: 0 6px 16px rgba(251, 191, 90, 0.25); }
.r.good { background: linear-gradient(160deg, #7ae8b8, var(--good)); box-shadow: 0 6px 16px rgba(74, 222, 154, 0.25); }
.r.easy { background: linear-gradient(160deg, #8ee4ff, var(--easy)); box-shadow: 0 6px 16px rgba(103, 212, 255, 0.25); }

/* ── Business sub-panels ── */
.biz-panel.hidden { display: none; }

.biz-soon {
  margin-top: 4px;
}
.email-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

.email-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  background: rgba(244, 164, 184, 0.12);
  border: 1px solid rgba(244, 164, 184, 0.2);
  padding: 5px 10px;
  border-radius: 999px;
}

.email-usage {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

select, textarea {
  width: 100%;
  background: #12182a;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}

select {
  appearance: none;
  background-color: #12182a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b8c2dc' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  color-scheme: dark;
}

select option {
  background: #161c30;
  color: var(--text);
}

.select-box {
  margin-bottom: 14px;
  min-height: 48px;
  font-weight: 600;
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.select-box:focus {
  border-color: rgba(139, 156, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 156, 255, 0.12);
}

select:focus, textarea:focus {
  outline: none;
  border-color: rgba(139, 156, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 156, 255, 0.12);
}

textarea {
  margin-top: 0;
  resize: vertical;
  min-height: 160px;
  font-family: var(--font-jp);
  line-height: 1.65;
}

.prompt {
  margin: 12px 0 16px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.grade {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  line-height: 1.6;
  animation: fadeUp 0.35s ease;
}

.grade h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.grade ul {
  margin: 8px 0;
  padding-left: 1.2em;
  color: var(--text-soft);
}

.grade pre {
  margin: 8px 0 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-jp);
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

/* ── Mail composer ── */
.mail-hint {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.mail-block-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.section-hint-btn {
  padding: 6px 12px !important;
  font-size: 0.78rem !important;
  background: rgba(251, 191, 90, 0.12) !important;
  border: 1px solid rgba(251, 191, 90, 0.3) !important;
  color: var(--hard) !important;
}

.section-hint-btn.on {
  background: rgba(251, 191, 90, 0.25) !important;
  border-color: var(--hard) !important;
  color: #fff !important;
}

.email-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.scenario-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.scenario-row .select-box {
  flex: 1;
  min-width: 0;
}

.scenario-row .btn {
  flex-shrink: 0;
  min-width: 44px;
  padding-left: 12px;
  padding-right: 12px;
}

.mail-composer { margin-bottom: 4px; }

.mail-sheet {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 0;
  overflow: hidden;
}

.mail-block {
  padding: 14px 16px 12px;
}

.mail-block.has-next {
  border-bottom: 1px solid var(--border);
}

.mail-guide {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 500;
}

.mail-input {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px dashed rgba(125, 138, 173, 0.35);
  border-radius: 10px;
  font-family: var(--font-jp);
  font-size: 0.95rem;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}

.mail-input::placeholder {
  color: rgba(125, 138, 173, 0.55);
  font-size: 0.82rem;
  font-family: var(--font);
}

.mail-input:focus {
  outline: none;
  border-style: solid;
  border-color: rgba(139, 156, 255, 0.45);
  background: rgba(139, 156, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 156, 255, 0.1);
}

.mail-input.filled {
  border-style: solid;
  border-color: rgba(139, 156, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.mail-hint-panel {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(251, 191, 90, 0.08);
  border: 1px solid rgba(251, 191, 90, 0.22);
  border-radius: 10px;
  animation: fadeUp 0.25s ease;
}

.mail-hint-panel.hidden { display: none; }

.mail-sheet-easy .mail-easy-head {
  padding: 12px 16px 4px;
}

.mail-easy-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.mail-easy-hint {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 2.1;
  color: var(--text);
}

.mail-easy-empty {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.mail-easy-ref .hint-note {
  margin-top: 6px;
}

.easy-insert-btn {
  margin-top: 4px;
  font-size: 0.78rem !important;
  padding: 6px 10px !important;
}

.mail-easy-draft {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.15);
}

.mail-easy-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mail-easy-toolbar .btn {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem !important;
}

.mail-easy-preview {
  margin: 0;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 200px;
  overflow-y: auto;
}

.mail-easy-preview-wrap {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-strong);
}

.easy-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 4px;
  line-height: 2.2;
  font-size: 1.02rem;
  margin: 4px 0 8px;
}

.easy-static {
  color: var(--text);
}

.easy-blank {
  display: inline;
  margin: 0 2px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(139, 156, 255, 0.55);
  background: rgba(139, 156, 255, 0.12);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  vertical-align: baseline;
  transition: border-color 0.15s, background 0.15s;
}

.easy-blank.pending {
  border-style: dashed;
  color: var(--hard);
  background: rgba(251, 191, 90, 0.1);
  border-color: rgba(251, 191, 90, 0.45);
  font-size: 0.88rem;
}

.easy-blank:not(.pending) {
  border-style: solid;
  color: var(--accent-2);
  background: rgba(244, 164, 184, 0.12);
}

.easy-blank:hover {
  border-color: var(--accent);
}

.slot-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.slot-sheet.hidden {
  display: none;
}

.slot-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 20, 0.72);
  backdrop-filter: blur(4px);
}

.slot-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
  margin: 12px;
  padding: 18px 16px 20px;
  background: linear-gradient(180deg, #1e2848 0%, #141a2e 100%);
  border: 1px solid var(--border-strong);
  border-radius: 18px 18px 22px 22px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  animation: slot-up 0.28s ease-out;
}

@keyframes slot-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.slot-sheet-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.slot-sheet-sub {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.slot-sheet-sub.hidden {
  display: none;
}

.slot-option-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.slot-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.slot-opt:hover {
  border-color: var(--accent);
  background: rgba(139, 156, 255, 0.1);
}

.slot-opt-jp {
  font-size: 1rem;
  line-height: 1.5;
}

.slot-opt-ko {
  font-size: 0.82rem;
  color: var(--muted);
}

body.slot-sheet-open {
  overflow: hidden;
}

.hint-jp {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 2.3;
}

.hint-note {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--hard);
  line-height: 1.45;
}

.hint-save-btn {
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px !important;
  font-size: 0.82rem !important;
}

/* ── Notebook ── */
.notebook-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.notebook-title {
  margin: 0;
  font-size: 1.2rem;
}

.notebook-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.notebook-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.notebook-list.hidden { display: none; }

.nb-day-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.nb-day-title {
  margin: 0;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nb-day-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
}

.nb-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nb-row {
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.3s ease;
}

.nb-row:last-child { border-bottom: 0; }

.nb-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 4px;
}

.nb-time {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.nb-details {
  padding: 0 16px 12px;
}

.nb-summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
  list-style: none;
  padding: 4px 0 8px;
}

.nb-summary::-webkit-details-marker { display: none; }

.nb-details[open] .nb-summary {
  color: var(--text-soft);
  margin-bottom: 4px;
}

.nb-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: fadeUp 0.3s ease;
}

.nb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.nb-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.nb-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.nb-badge.email { background: rgba(139, 156, 255, 0.15); color: var(--accent); }
.nb-badge.study { background: rgba(244, 164, 184, 0.15); color: var(--accent-2); }
.nb-badge.manual { background: rgba(125, 138, 173, 0.15); color: var(--muted); }

.nb-body { margin: 0 0 8px; padding-top: 4px; }

.nb-label {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.nb-ko, .nb-jp {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.nb-jp { font-family: var(--font-jp); color: var(--text-soft); }
.nb-jp.with-ruby { line-height: 2.3; }

.nb-note {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--hard);
  line-height: 1.45;
}

.nb-del {
  border: 0;
  background: transparent;
  color: var(--again);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0 0;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(22, 28, 48, 0.95);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden { display: block; }

/* ── Card enter animation ── */
.flashcard.enter .flashcard-inner {
  animation: cardIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 420px) {
  .front { font-size: 1.7rem; }
}
