@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;600&family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── DARK THEME (default) ── */
:root {
  --bg:      #100e18;
  --surface: #160e22;
  --card:    #1c1428;
  --border:  #2a2040;
  --border2: #382a50;
  --text:    #f0ecff;
  --muted:   #7060a0;
  --faint:   #281e3c;

  --primary:  #c87af0;
  --primary2: #dca8ff;
  --accent1:  #f07840;
  --accent2:  #f0508c;
  --accent3:  #a855f7;

  --green: #4ade80;
  --red:   #f87171;
  --gold:  var(--accent1);
  --gold2: #ffaa70;

  --nav-h: 56px;
  --r: 8px;
  --mono:  'IBM Plex Mono', monospace;
  --sans:  'DM Sans', sans-serif;
  --serif: 'Cormorant Garamond', serif;
  --jp:    'Noto Serif JP', serif;
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg:      #fdf8ff;
  --surface: #f8f0ff;
  --card:    #ffffff;
  --border:  #e8d8f8;
  --border2: #d8c0f0;
  --text:    #1a0830;
  --muted:   #9070b0;
  --faint:   #f0e4ff;

  --primary:  #7828d0;
  --primary2: #9040e8;
  --accent1:  #d4580a;
  --accent2:  #c02860;
  --accent3:  #5010a0;

  --green: #16a34a;
  --red:   #dc2626;
  --gold:  var(--accent1);
  --gold2: #e07030;
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--sans); }
input, select { font-family: var(--sans); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── NAV ── */
#nl-nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
  background: rgba(16,14,24,0.93);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: stretch;
  padding: 0 1.5rem;
  transition: background 0.25s, border-color 0.25s;
}
[data-theme="light"] #nl-nav { background: rgba(253,248,255,0.93); }

.nl-brand { display: flex; align-items: center; gap: 8px; margin-right: 1.5rem; flex-shrink: 0; }
.nl-brand-jp   { font-family: var(--jp); font-size: 0.95rem; color: var(--primary); }
.nl-brand-name { font-family: var(--serif); font-size: 1.15rem; color: var(--text); }
.nl-links { display: flex; align-items: stretch; flex: 1; overflow-x: auto; }
.nl-links::-webkit-scrollbar { display: none; }
.nl-link {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 0 0.9rem; white-space: nowrap; gap: 2px;
  font-size: 0.67rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid transparent; transition: color 0.15s;
}
.nl-link:hover { color: var(--text); }
.nl-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.nl-link .nl-sub { font-size: 0.57rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.nl-link.active .nl-sub { color: var(--primary); opacity: 0.7; }
.nl-right { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-left: 1rem; flex-shrink: 0; }

/* ── Dropdown trigger button inside nav ── */
.nl-dropdown-trigger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: row; align-items: center; gap: 4px;
  white-space: nowrap;
}
.nl-dropdown-arrow { font-size: 0.5rem; }
.nl-theme-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted); font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0; cursor: pointer;
}
.nl-theme-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Dropdown panel (body-level, not clipped by nav) ── */
.nl-dropdown { display: none; } /* old, not used */
.nl-drop-panel {
  display: none;
  position: fixed;
  top: 60px; left: 0;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 0.5rem;
  min-width: 220px;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
[data-theme="light"] .nl-drop-panel { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.nl-drop-panel.open { display: block; }
.nl-dropdown-group { padding: 0.3rem 0; }
.nl-dropdown-group + .nl-dropdown-group { border-top: 1px solid var(--border); }
.nl-dropdown-label {
  font-size: 0.58rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--primary);
  padding: 0.4rem 0.7rem 0.35rem;
}
.nl-dropdown-item {
  display: block; padding: 0.45rem 0.7rem;
  font-size: 0.82rem; color: var(--text);
  border-radius: 6px; transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.nl-dropdown-item:hover { background: rgba(200,122,240,0.1); color: var(--primary); }
[data-theme="light"] .nl-dropdown-item:hover { background: rgba(120,40,208,0.07); }
.nl-dropdown-item.active { color: var(--primary); font-weight: 500; }
.nl-dropdown-item.soon { color: var(--muted); cursor: default; pointer-events: none; }
.soon-tag {
  font-size: 0.55rem; padding: 1px 5px; border-radius: 2rem;
  border: 1px solid var(--border2); color: var(--muted);
  margin-left: 5px; vertical-align: middle;
}

/* ── Hamburger button ── */
.nl-hamburger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; background: none; border: none; padding: 4px;
  width: 32px; height: 32px; cursor: pointer;
}
.nl-hamburger span {
  display: block; height: 2px; width: 22px;
  background: var(--muted); border-radius: 2px;
  transition: all 0.25s; transform-origin: center;
}
.nl-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nl-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nl-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile overlay ── */
.nl-mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 600;
  backdrop-filter: blur(2px);
}
.nl-mobile-overlay.open { display: block; }

/* ── Mobile slide-in menu ── */
.nl-mobile-menu {
  position: fixed; top: 0; right: -100%; width: min(320px, 90vw); height: 100%;
  background: var(--card); border-left: 1px solid var(--border2);
  z-index: 700; overflow-y: auto;
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.nl-mobile-menu.open { right: 0; }
.nl-mobile-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nl-mobile-close {
  background: none; border: none; font-size: 1.1rem;
  color: var(--muted); cursor: pointer; padding: 4px;
  transition: color 0.15s; line-height: 1;
}
.nl-mobile-close:hover { color: var(--text); }
.nl-mobile-nav { flex: 1; padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 2px; }
.nl-mobile-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.8rem; border-radius: 8px;
  font-size: 0.9rem; color: var(--text);
  text-decoration: none; transition: background 0.12s, color 0.12s;
  position: relative;
}
.nl-mobile-link:hover { background: rgba(200,122,240,0.08); }
[data-theme="light"] .nl-mobile-link:hover { background: rgba(120,40,208,0.06); }
.nl-mobile-link.active { color: var(--primary); background: rgba(200,122,240,0.1); font-weight: 500; }
[data-theme="light"] .nl-mobile-link.active { background: rgba(120,40,208,0.08); }
.nl-mobile-link.nl-mobile-sub { padding-left: 1.6rem; font-size: 0.82rem; color: var(--muted); }
.nl-mobile-link.nl-mobile-sub.active { color: var(--primary); }
.nl-mobile-link.nl-mobile-soon { color: var(--faint); pointer-events: none; }
.nl-mobile-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nl-mobile-badge {
  font-size: 0.58rem; color: var(--muted); margin-left: auto;
  letter-spacing: 0.05em; white-space: nowrap;
}
.nl-mobile-section-label {
  font-size: 0.58rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--primary);
  padding: 0.8rem 0.8rem 0.3rem;
}
.nl-mobile-footer {
  padding: 1rem 1.2rem; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.nl-mobile-theme {
  width: 100%; justify-content: center; gap: 0.5rem;
  font-size: 0.78rem; padding: 0.6rem; border-radius: 8px;
  font-family: var(--sans);
}

/* ── Level filter pill (in toolbars, not nav) ── */
.level-filter-group { display: flex; gap: 4px; }
.level-pill {
  font-size: 0.65rem; font-weight: 600; padding: 3px 10px;
  border-radius: 2rem; border: 1px solid var(--border2);
  background: transparent; color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.level-pill:hover { border-color: var(--primary); color: var(--primary); }
.level-pill.active { background: rgba(200,122,240,0.14); color: var(--primary); border-color: rgba(200,122,240,0.4); }
[data-theme="light"] .level-pill.active { background: rgba(120,40,208,0.1); border-color: rgba(120,40,208,0.35); }
.level-pill.soon { opacity: 0.3; cursor: not-allowed; }
.level-pill.soon:hover { border-color: var(--border2); color: var(--muted); }

/* ── PAGE HEADER ── */
.page-hero { padding: 2rem 2rem 0; border-bottom: 1px solid var(--border); }
.page-hero h1 { font-family: var(--serif); font-size: 2rem; font-weight: 300; margin-bottom: 4px; }
.page-hero p  { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.2rem; }
.page-hero-stats { display: flex; gap: 1.2rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.hero-stat { font-size: 0.7rem; color: var(--muted); }
.hero-stat strong { color: var(--text); font-weight: 500; }

/* ── TOOLBAR ── */
.toolbar {
  padding: 0.85rem 2rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: var(--nav-h); z-index: 100;
}
.view-tabs { display: flex; border: 1px solid var(--border2); border-radius: var(--r); overflow: hidden; }
.view-tab {
  font-size: 0.7rem; font-weight: 500; padding: 5px 13px;
  background: transparent; border: none; color: var(--muted);
  border-right: 1px solid var(--border2); transition: all 0.15s;
}
.view-tab:last-child { border-right: none; }
.view-tab.active { background: var(--card); color: var(--text); }
.filter-pill {
  font-size: 0.68rem; padding: 4px 11px; border-radius: 2rem;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted); transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--text); color: var(--text); }
.filter-pill.active { background: rgba(200,122,240,0.12); color: var(--primary); border-color: rgba(200,122,240,0.38); }
[data-theme="light"] .filter-pill.active { background: rgba(120,40,208,0.08); border-color: rgba(120,40,208,0.32); }
.tb-spacer { flex: 1; }
.tb-search {
  font-size: 0.75rem; padding: 5px 11px;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); outline: none; width: 180px;
  transition: border-color 0.15s;
}
.tb-search::placeholder { color: var(--muted); }
.tb-search:focus { border-color: var(--primary); }
.tb-count { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

/* ── GRID ── */
.content-area { padding: 1.5rem 2rem; }
.nl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

/* ── CARDS ── */
.nl-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem; position: relative;
  overflow: hidden; transition: transform 0.15s, border-color 0.15s;
}
.nl-card:hover { transform: translateY(-1px); border-color: var(--border2); }
.nl-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--card-accent, var(--border2));
}
.card-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 2rem;
  border: 1px solid var(--card-accent, var(--border2));
  color: var(--card-accent, var(--muted)); margin-bottom: 0.7rem;
}
.card-jp  { font-family: var(--jp); font-size: 1.5rem; font-weight: 600; line-height: 1.2; margin-bottom: 2px; }
.card-rom { font-size: 0.72rem; color: var(--muted); font-style: italic; font-family: var(--mono); margin-bottom: 2px; }
.card-en  { font-size: 0.8rem; font-weight: 500; margin-bottom: 0.85rem; }
.card-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.card-form { background: var(--surface); padding: 0.4rem 0.55rem; border-radius: 4px; }
.card-form-lbl { font-size: 0.52rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 1px; }
.card-form-jp  { font-family: var(--jp); font-size: 0.88rem; display: block; }
.card-know {
  position: absolute; top: 0.7rem; right: 0.7rem;
  font-size: 0.6rem; padding: 2px 7px; border-radius: 2rem;
  border: 1px solid var(--border2); color: var(--muted); background: transparent; transition: all 0.15s;
}
.card-know.known    { border-color: var(--green);   color: var(--green);   background: rgba(74,222,128,0.08); }
.card-know.learning { border-color: var(--accent1); color: var(--accent1); background: rgba(240,120,64,0.08); }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
.nl-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.nl-table th {
  padding: 8px 12px; text-align: left;
  font-size: 0.65rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: var(--surface);
  border-bottom: 1px solid var(--border2);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.nl-table th:hover { color: var(--text); }
.nl-table th.sorted { color: var(--primary); }
.nl-table th .sort-icon { margin-left: 3px; font-size: 0.6rem; }
.nl-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.nl-table tr:hover td { background: rgba(200,122,240,0.04); }
.nl-table tr:last-child td { border-bottom: none; }
.tbl-jp   { font-family: var(--jp); font-size: 1.1rem; }
.tbl-rom  { font-size: 0.65rem; color: var(--muted); font-style: italic; margin-top: 1px; }
.tbl-form { font-family: var(--jp); font-size: 0.82rem; }
.tbl-expand { font-size: 0.6rem; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--border2); color: var(--muted); background: transparent; transition: all 0.15s; }
.tbl-expand:hover { border-color: var(--primary); color: var(--primary); }
.tbl-expand-row td { background: var(--surface); }
.tbl-expand-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.4rem; padding: 0.3rem 0; }
.tbl-expand-item { background: var(--card); padding: 0.35rem 0.5rem; border-radius: 4px; }

/* ── BADGES ── */
.badge { display: inline-block; font-size: 0.58rem; font-weight: 500; padding: 2px 7px; border-radius: 2rem; border: 1px solid; white-space: nowrap; }
.badge-n5   { color: var(--primary);  border-color: rgba(200,122,240,0.4); background: rgba(200,122,240,0.1); }
.badge-n4   { color: var(--accent1);  border-color: rgba(240,120,64,0.4);  background: rgba(240,120,64,0.1); }
.badge-n3   { color: var(--accent2);  border-color: rgba(240,80,140,0.4);  background: rgba(240,80,140,0.1); }
.badge-g1   { color: var(--accent2);  border-color: rgba(240,80,140,0.4);  background: rgba(240,80,140,0.1); }
.badge-g2   { color: var(--green);    border-color: rgba(74,222,128,0.4);  background: rgba(74,222,128,0.1); }
.badge-g3   { color: var(--primary);  border-color: rgba(200,122,240,0.4); background: rgba(200,122,240,0.1); }
.badge-iadj { color: var(--accent1);  border-color: rgba(240,120,64,0.4);  background: rgba(240,120,64,0.1); }
.badge-nadj { color: var(--accent3);  border-color: rgba(168,85,247,0.4);  background: rgba(168,85,247,0.1); }

/* ── KANA CHART ── */
.kana-section-title {
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--primary); margin: 1.5rem 0 0.75rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.kana-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-bottom: 1.5rem; }
.kana-cell {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.55rem 0.4rem;
  text-align: center; cursor: pointer; transition: all 0.15s;
}
.kana-cell:hover { border-color: var(--primary); transform: translateY(-1px); }
.kana-cell.known-cell    { border-color: var(--green);   background: rgba(74,222,128,0.07); }
.kana-cell.learning-cell { border-color: var(--accent1); background: rgba(240,120,64,0.07); }
.kana-cell.special { border-left: 2px solid var(--accent2); }
.kana-char { font-family: var(--jp); font-size: 1.4rem; font-weight: 400; line-height: 1; display: block; color: var(--text); }
.kana-rom  { font-size: 0.62rem; color: var(--muted); font-family: var(--mono); margin-top: 3px; display: block; }
.kana-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.kana-cell.empty:hover { transform: none; border-color: transparent; }
.kana-row-label {
  background: rgba(200,122,240,0.1); border: 1px solid rgba(200,122,240,0.25);
  border-radius: var(--r); padding: 0.55rem 0.4rem;
  text-align: center; font-size: 0.65rem; font-weight: 600; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
[data-theme="light"] .kana-row-label { background: rgba(120,40,208,0.07); border-color: rgba(120,40,208,0.2); }

/* ── FLASHCARD ── */
.fc-wrap { display: flex; flex-direction: column; align-items: center; padding: 2rem; }
.fc-meta { font-size: 0.7rem; color: var(--muted); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.fc-bar  { width: 200px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.fc-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }
.fc-scene { width: 100%; max-width: 480px; cursor: pointer; margin-bottom: 1.5rem; }
.fc-inner { position: relative; width: 100%; }
.fc-face {
  width: 100%;
  background: var(--card); border: 1px solid var(--border2); border-radius: 10px;
  padding: 2rem; display: flex; flex-direction: column;
}
.fc-front { display: flex; }
.fc-back  { display: none; }
.fc-inner.flipped .fc-front { display: none; }
.fc-inner.flipped .fc-back  { display: flex; animation: fc-fade 0.18s ease; }
@keyframes fc-fade { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
.fc-front-inner { display: flex; flex-direction: column; justify-content: center; align-items: center; flex: 1; text-align: center; gap: 0.6rem; }
.fc-jp-big   { font-family: var(--jp); font-size: 3rem; font-weight: 600; }
.fc-kana-big { font-family: var(--jp); font-size: 5rem; font-weight: 400; line-height: 1; }
.fc-hint     { font-size: 0.6rem; color: var(--faint); letter-spacing: 0.15em; text-transform: uppercase; text-align: center; margin-top: auto; padding-top: 1rem; }
.fc-nav { display: flex; gap: 0.8rem; align-items: center; }
.fc-btn {
  font-size: 0.72rem; padding: 0.55rem 1.2rem;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted); border-radius: 4px; transition: all 0.15s;
}
.fc-btn:hover { color: var(--text); border-color: var(--text); }
.fc-btn:disabled { opacity: 0.25; pointer-events: none; }
.fc-cnt { font-size: 0.75rem; color: var(--muted); min-width: 70px; text-align: center; }
.fc-know-row { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1rem; }
.fc-know-btn {
  font-size: 0.65rem; padding: 4px 14px; border-radius: 2rem; border: 1px solid;
  background: transparent; transition: all 0.15s; cursor: pointer;
}
.fc-know-btn.know  { color: var(--green);   border-color: var(--green); }
.fc-know-btn.learn { color: var(--accent1); border-color: var(--accent1); }
.fc-know-btn.skip  { color: var(--muted);   border-color: var(--border2); }
.fc-know-btn:hover { opacity: 0.75; }

/* ── GRAMMAR EXTRAS ── */
.pat-structure { font-family: var(--serif); font-size: 1.2rem; color: var(--primary2); margin-bottom: 2px; }
.pat-name      { font-family: var(--jp); font-size: 0.95rem; color: var(--text); font-weight: 300; margin-bottom: 0.5rem; }
.pat-section   { font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0.7rem 0 0.35rem; }
.pat-meaning   { font-size: 0.72rem; line-height: 1.65; }
.pat-when      { font-size: 0.68rem; color: var(--muted); font-style: italic; line-height: 1.65; border-left: 2px solid var(--faint); padding-left: 0.7rem; }
.pat-examples  { display: flex; flex-direction: column; gap: 0.45rem; }
.pat-ex        { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem 0.7rem; }
.pat-ex-jp     { font-family: var(--jp); font-size: 0.9rem; line-height: 1.5; }
.pat-ex-rom    { font-size: 0.58rem; color: var(--muted); font-style: italic; }
.pat-ex-en     { font-size: 0.65rem; opacity: 0.7; }
.pat-note      { margin-top: 0.7rem; padding: 0.5rem 0.7rem; background: rgba(200,122,240,0.06); border: 1px solid rgba(200,122,240,0.2); border-radius: 4px; font-size: 0.65rem; color: var(--muted); line-height: 1.6; }
.pat-note strong { color: var(--primary); }
.highlight     { color: var(--primary2); font-weight: 500; }
.vocab-topic   { font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; }
.vocab-alt     { font-size: 0.7rem; color: var(--muted); margin-bottom: 0.5rem; font-style: italic; }
.vocab-example { font-size: 0.7rem; color: var(--muted); line-height: 1.6; border-left: 2px solid var(--faint); padding-left: 0.6rem; margin-top: 0.6rem; }
.vocab-example .ex-jp { font-family: var(--jp); font-size: 0.85rem; color: var(--text); display: block; }

/* ── QUIZ ── */
.quiz-setup { display: flex; flex-direction: column; align-items: center; padding: 2.5rem 2rem; gap: 1.5rem; width: 100%; box-sizing: border-box; }
.quiz-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; width: 100%; max-width: 700px; }
.quiz-type-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.1rem; text-align: center; cursor: pointer; transition: all 0.15s;
}
.quiz-type-card:hover { border-color: var(--border2); }
.quiz-type-card.selected { border-color: var(--primary); background: rgba(200,122,240,0.06); }
.quiz-type-icon { font-family: var(--jp); font-size: 1.4rem; display: block; margin-bottom: 0.4rem; color: var(--primary2); }
.quiz-type-name { font-size: 0.78rem; font-weight: 500; }
.quiz-type-desc { font-size: 0.65rem; color: var(--muted); margin-top: 0.25rem; line-height: 1.5; }
.quiz-check     { font-size: 0.6rem; color: var(--primary); margin-top: 0.4rem; }
.quiz-start {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 0.8rem 2.5rem; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; transition: all 0.15s;
}
.quiz-start:hover { background: var(--primary2); }
.quiz-arena  { display: flex; flex-direction: column; align-items: center; padding: 2rem; }
.quiz-prog-row { width: 100%; max-width: 600px; display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.quiz-prog-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.quiz-prog-fill  { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.4s; }
.quiz-prog-label { font-size: 0.65rem; color: var(--muted); white-space: nowrap; }
.quiz-card  { width: 100%; max-width: 600px; background: var(--card); border: 1px solid var(--border2); border-radius: 10px; padding: 1.8rem; }
.quiz-card.correct-state { border-color: var(--green); }
.quiz-card.wrong-state   { border-color: var(--red); }
.quiz-badge      { font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 8px; border-radius: 2rem; border: 1px solid var(--border2); color: var(--muted); display: inline-block; margin-bottom: 0.8rem; }
.quiz-prompt-lbl { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.quiz-prompt     { font-family: var(--jp); font-size: 2rem; font-weight: 600; margin-bottom: 0.25rem; }
.quiz-prompt-rom { font-size: 0.75rem; color: var(--muted); font-style: italic; margin-bottom: 0.2rem; font-family: var(--mono); }
.quiz-prompt-sub { font-size: 0.72rem; color: var(--muted); margin-bottom: 1.2rem; }
.quiz-ask   { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 0.5rem; border-top: 1px solid var(--border); margin-bottom: 0.9rem; }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.quiz-choice {
  font-family: var(--jp); font-size: 0.95rem;
  padding: 0.75rem 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px;
  text-align: center; color: var(--text); transition: all 0.15s; line-height: 1.4;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--primary); color: var(--primary2); }
.quiz-choice:disabled { cursor: default; }
.quiz-choice.correct { border-color: var(--green);  background: rgba(74,222,128,0.1);  color: var(--green); }
.quiz-choice.wrong   { border-color: var(--red);    background: rgba(248,113,113,0.1); color: var(--red); }
.quiz-choice.reveal  { border-color: var(--green);  background: rgba(74,222,128,0.06); color: var(--green); }
.quiz-feedback { margin-top: 0.9rem; padding: 0.7rem 0.9rem; border-radius: 6px; font-size: 0.72rem; line-height: 1.6; display: none; }
.quiz-feedback.vis     { display: block; }
.quiz-feedback.correct { background: rgba(74,222,128,0.08);  border: 1px solid rgba(74,222,128,0.25);  color: var(--green); }
.quiz-feedback.wrong   { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.25); color: var(--red); }
.quiz-feedback .fb-ans { font-family: var(--jp); font-size: 1rem; color: var(--text); margin-top: 0.3rem; display: block; }
.quiz-action-row { display: flex; gap: 0.7rem; align-items: center; margin-top: 0.8rem; flex-wrap: wrap; }
.quiz-submit { font-size: 0.72rem; padding: 0.6rem 1.4rem; background: var(--primary); color: #fff; border: none; border-radius: 4px; transition: all 0.15s; }
.quiz-submit:hover { background: var(--primary2); }
.quiz-next { font-size: 0.72rem; padding: 0.6rem 1.4rem; background: transparent; border: 1px solid var(--border2); color: var(--muted); border-radius: 4px; transition: all 0.15s; display: none; }
.quiz-next.vis { display: inline-block; }
.quiz-next:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.quiz-results { display: flex; flex-direction: column; align-items: center; padding: 3rem 2rem; gap: 1.5rem; text-align: center; }
.quiz-result-score { font-family: var(--serif); font-size: 4rem; font-weight: 300; color: var(--primary2); }
.quiz-result-lbl   { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.quiz-result-breakdown { display: flex; gap: 2rem; }
.quiz-result-stat .num { font-size: 1.8rem; font-weight: 500; }
.quiz-result-stat .lbl { font-size: 0.62rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.quiz-result-stat.c .num { color: var(--green); }
.quiz-result-stat.w .num { color: var(--red); }
.quiz-result-msg   { font-size: 0.85rem; max-width: 360px; line-height: 1.7; }
.quiz-missed-list  { width: 100%; max-width: 480px; text-align: left; }
.quiz-missed-title { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.quiz-missed-item  { background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: 0.55rem 0.85rem; margin-bottom: 0.45rem; }
.quiz-missed-item .mj { font-family: var(--jp); font-size: 0.95rem; }
.quiz-missed-item .ma { font-size: 0.65rem; color: var(--muted); margin-top: 1px; }
.quiz-replay { font-size: 0.78rem; font-weight: 600; padding: 0.7rem 2rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.quiz-replay:hover { background: var(--primary2); }
.quiz-score-pills  { display: flex; gap: 0.6rem; align-items: center; }
.quiz-score-pill   { font-size: 0.68rem; padding: 3px 10px; border-radius: 2rem; border: 1px solid var(--border2); color: var(--muted); }
.quiz-score-pill.c { border-color: var(--green); color: var(--green); }
.quiz-score-pill.w { border-color: var(--red);   color: var(--red); }

/* ── PROGRESS ── */
.progress-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.stat-card .s-val { font-family: var(--serif); font-size: 2.2rem; font-weight: 300; color: var(--primary2); line-height: 1; }
.stat-card .s-lbl { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 0.3rem; }
.stat-card .s-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 0.7rem; overflow: hidden; }
.stat-card .s-bar-fill { height: 100%; border-radius: 2px; background: var(--primary); }
.section-title { font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem; }
.weak-list { display: flex; flex-direction: column; gap: 0.45rem; }
.weak-item { background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: 0.6rem 0.85rem; display: flex; align-items: center; gap: 0.8rem; }
.weak-item .wi-jp  { font-family: var(--jp); font-size: 1rem; }
.weak-item .wi-en  { font-size: 0.7rem; color: var(--muted); flex: 1; }
.weak-item .wi-tag { font-size: 0.58rem; padding: 2px 6px; border-radius: 2rem; border: 1px solid var(--red); color: var(--red); }
.streak-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.streak-day { width: 28px; height: 28px; border-radius: 4px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: var(--muted); }
.streak-day.done  { background: rgba(200,122,240,0.14); border-color: rgba(200,122,240,0.4); color: var(--primary); }
.streak-day.today { background: var(--primary); border-color: var(--primary); color: #fff; }
.reset-btn { font-size: 0.68rem; padding: 5px 14px; border-radius: 4px; border: 1px solid var(--red); color: var(--red); background: transparent; transition: all 0.15s; cursor: pointer; }
.reset-btn:hover { background: rgba(248,113,113,0.1); }

/* ── LANDING ── */
.hero-section { padding: 5rem 2rem 3rem; text-align: center; }
.hero-jp    { font-family: var(--jp); font-size: 1rem; color: var(--primary); margin-bottom: 0.5rem; letter-spacing: 0.2em; }
.hero-title { font-family: var(--serif); font-size: 3.5rem; font-weight: 300; line-height: 1.1; margin-bottom: 0.7rem; }
.hero-sub   { font-size: 0.9rem; color: var(--muted); max-width: 480px; margin: 0 auto 2rem; line-height: 1.7; }
.hero-cta   { display: inline-flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.btn-primary { font-size: 0.82rem; font-weight: 600; padding: 0.75rem 1.8rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; transition: all 0.15s; cursor: pointer; }
.btn-primary:hover { background: var(--primary2); }
.btn-ghost   { font-size: 0.82rem; padding: 0.75rem 1.8rem; background: transparent; color: var(--text); border: 1px solid var(--border2); border-radius: 6px; transition: all 0.15s; cursor: pointer; display: inline-block; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; padding: 2rem; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 1.3rem; transition: border-color 0.15s, transform 0.15s; }
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon  { font-family: var(--jp); font-size: 1.5rem; color: var(--primary2); margin-bottom: 0.6rem; }
.feature-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; }
.feature-desc  { font-size: 0.72rem; color: var(--muted); line-height: 1.6; }
.level-section { padding: 2rem; border-top: 1px solid var(--border); }
.level-cards   { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; max-width: 500px; margin: 1rem auto 0; }
.level-card    { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; text-align: center; }
.level-card .lc-name  { font-size: 1.2rem; font-weight: 500; color: var(--primary2); margin-bottom: 0.3rem; }
.level-card .lc-desc  { font-size: 0.65rem; color: var(--muted); }
.level-card .lc-badge { font-size: 0.6rem; margin-top: 0.5rem; display: inline-block; padding: 2px 8px; border-radius: 2rem; }
.level-card.available .lc-badge { background: rgba(74,222,128,0.1); color: var(--green); border: 1px solid rgba(74,222,128,0.3); }
.level-card.soon { opacity: 0.5; }
.level-card.soon .lc-badge { background: var(--faint); color: var(--muted); border: 1px solid var(--border2); }

/* ── FOOTER ── */
#nl-footer {
  margin-top: 4rem; padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.footer-brand { font-family: var(--serif); font-size: 0.9rem; color: var(--muted); }
.footer-note  { font-size: 0.65rem; color: var(--faint); }
.footer-links { display: flex; gap: 1rem; }
.footer-link  { font-size: 0.68rem; color: var(--muted); transition: color 0.15s; }
.footer-link:hover { color: var(--primary); }

/* ── MISC ── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); font-size: 0.82rem; }
.empty-state .es-icon { font-family: var(--jp); font-size: 2rem; margin-bottom: 0.7rem; opacity: 0.4; }
.nl-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--card); border: 1px solid var(--border2); border-radius: 6px;
  padding: 0.6rem 1.2rem; font-size: 0.75rem; color: var(--text);
  transition: transform 0.3s; z-index: 999; white-space: nowrap;
}
.nl-toast.show { transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nl-links { display: none; }
  .nl-hamburger { display: flex; }
  .page-hero, .content-area, .toolbar, .quiz-setup, .quiz-arena, .quiz-results { padding-left: 1rem; padding-right: 1rem; }
  .nl-grid, .features-grid { grid-template-columns: 1fr; }
  .quiz-choices { grid-template-columns: 1fr; }
  .quiz-type-grid { grid-template-columns: 1fr 1fr; }
  .quiz-card { padding: 1.2rem; }
  .hero-title { font-size: 2.4rem; }
  .kana-chart { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)) !important; gap: 4px; }
  .kana-char { font-size: 1.2rem; }
  .kana-rom  { font-size: 0.55rem; }
  .kana-row-label { font-size: 0.58rem; }
  .toolbar { position: static; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fc-kana-big { font-size: 4rem; }
  .quiz-result-breakdown { gap: 1rem; }
  .progress-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .quiz-type-grid { grid-template-columns: 1fr; }
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .kana-chart { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)) !important; gap: 3px; }
  .level-cards { grid-template-columns: repeat(3,1fr); }
  .quiz-result-score { font-size: 3rem; }
}
