/* ============================================================================
 * style.css — Nihongo Dojo design system
 * ----------------------------------------------------------------------------
 * Tailwind-style utility classes (self-contained — no CDN, fully offline),
 * glassmorphism, light/dark themes, responsive layout, animations.
 * ==========================================================================*/

/* ------------------------------ fonts ------------------------------------ */
@font-face {
  font-family: 'Noto Sans JP';
  src: url('assets/fonts/noto-sans-jp-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Noto Sans JP';
  src: url('assets/fonts/noto-sans-jp-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Noto Sans Myanmar';
  src: url('assets/fonts/noto-sans-myanmar-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Noto Sans Myanmar';
  src: url('assets/fonts/noto-sans-myanmar-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

/* ------------------------------ tokens ----------------------------------- */
:root {
  --bg: #f4f5fb;
  --bg2: #e9ecf7;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --card-border: rgba(99, 102, 241, 0.14);
  --text: #191c2e;
  --text-soft: #5b6079;
  --text-faint: #8a8fa8;
  --primary: #6366f1;
  --primary-2: #4f46e5;
  --accent: #ec4899;
  --danger: #ef4444;
  --ok: #10b981;
  --warn: #f59e0b;
  --shadow: 0 8px 30px rgba(30, 35, 90, 0.08);
  --shadow-lg: 0 20px 60px rgba(30, 35, 90, 0.16);
  --ring: rgba(99, 102, 241, 0.35);
  --wb-bg: #ffffff;
  --grid-line: rgba(100, 116, 139, 0.22);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 264px;
  --font-jp: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --font-mm: 'Noto Sans Myanmar', 'Padauk', 'Myanmar Text', system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg: #0b0e1a;
  --bg2: #10142a;
  --card: rgba(23, 27, 51, 0.66);
  --card-solid: #171b33;
  --card-border: rgba(129, 140, 248, 0.16);
  --text: #e9ebff;
  --text-soft: #a6abc8;
  --text-faint: #6d7292;
  --primary: #818cf8;
  --primary-2: #6366f1;
  --accent: #f472b6;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --ring: rgba(129, 140, 248, 0.4);
  --wb-bg: #131730;
  --grid-line: rgba(148, 163, 184, 0.18);
}

/* ------------------------------ base ------------------------------------- */
* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-mm), var(--font-jp), system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.3s ease;
}
.jp, .jp-big, .jp-hero, .jp-sub, .kanji-big, .kanji-hero, .kanji-ref, .kanji-inline, .kt-char {
  font-family: var(--font-jp);
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
ruby rt { font-size: 0.55em; color: var(--text-soft); }
svg.ic { width: 1.15em; height: 1.15em; flex: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(99, 102, 241, 0.3); }

/* display toggles from settings */
.no-kana .kana-dim, .no-kana rt { display: none !important; }
.no-romaji .romaji-dim { display: none !important; }
.no-furigana ruby rt { display: none !important; }
.no-enpron .en-pron { display: none !important; }
.no-mypron .mm-pron { display: none !important; }

/* ------------------------------ layout ----------------------------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--card);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column; z-index: 40;
}
.side-head { padding: 18px 18px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-logo { display: inline-flex; filter: drop-shadow(0 4px 10px rgba(99,102,241,.4)); }
.brand-text { font-size: 1.05rem; letter-spacing: .2px; }
.brand-text b { color: var(--primary); }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-group-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-faint); padding: 0 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px;
  color: var(--text-soft); font-weight: 500; font-size: .92rem; margin-bottom: 2px;
  transition: background .2s, color .2s, transform .15s;
}
.nav-link:hover { background: rgba(99, 102, 241, 0.1); color: var(--text); transform: translateX(2px); }
.nav-link.active { background: linear-gradient(120deg, rgba(99,102,241,.18), rgba(236,72,153,.12)); color: var(--primary); font-weight: 700; }
.nav-link .ic { opacity: .85; }
.side-foot { padding: 12px; border-top: 1px solid var(--card-border); }
.side-profile {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  color: var(--text); font-weight: 600; font-size: .9rem; transition: background .2s;
}
.side-profile:hover { background: rgba(99, 102, 241, 0.1); }
.side-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; box-shadow: var(--shadow); }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; background: var(--bg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--card-border);
}
.topbar-title { font-size: 1.05rem; margin: 0; }
.hamburger { display: none; }
.app { flex: 1; padding: 22px; max-width: 1180px; width: 100%; margin: 0 auto; }
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: #fff;
  padding: 10px 16px; border-radius: 10px; transition: top .25s; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* drawer (mobile) */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 30, 0.55); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .3s;
  backdrop-filter: blur(3px);
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); z-index: 70;
  background: var(--card-solid); border-right: 1px solid var(--card-border);
  transform: translateX(-105%); transition: transform .32s cubic-bezier(.2,.8,.25,1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--card-border); }
.drawer-foot { padding: 14px; border-top: 1px solid var(--card-border); }

/* mode switch */
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: rgba(99, 102, 241, 0.09); border-radius: 12px; margin: 6px 0 2px;
}
.mode-btn {
  text-align: center; padding: 8px 4px; border-radius: 9px; font-size: .8rem; font-weight: 700;
  color: var(--text-soft); transition: all .22s ease; border: none; background: transparent; cursor: pointer;
  text-decoration: none; display: block;
}
.mode-btn:hover { color: var(--primary); }
.mode-btn.active {
  background: linear-gradient(120deg, rgba(99,102,241,.14), rgba(236,72,153,.10));
  color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px);
}

/* ------------------------------ utilities -------------------------------- */
.flex { display: flex; } .grid { display: grid; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; min-width: 0; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.ml-auto { margin-left: auto; } .mr-auto { margin-right: auto; }
.p-2 { padding: .5rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.min-w-0 { min-width: 0; } .min-w-40 { min-width: 10rem; }
.text-center { text-align: center; } .text-sm { font-size: .83rem; } .text-lg { font-size: 1.2rem; }
.text-muted { color: var(--text-soft); } .text-danger { color: var(--danger); }
.text-ok { color: var(--ok); } .text-bad { color: var(--danger); }
.hidden { display: none !important; }
.btn-block { width: 100%; }
.wrong { color: var(--danger); font-weight: 700; }

/* japanese typography */
.jp { font-size: 1.15rem; }
.jp-big { font-size: 1.5rem; font-weight: 700; }
.jp-hero { font-size: 2.6rem; font-weight: 700; line-height: 1.2; }
.jp-sub { font-size: .95rem; color: var(--text-soft); font-weight: 400; }
.jp-lg { font-size: 1.4rem; }
.kana-dim { color: var(--text-faint); font-family: var(--font-jp); }
.romaji-dim { color: var(--text-faint); font-size: .85em; letter-spacing: .3px; }
.my-meaning { font-weight: 700; color: var(--text); }
.en-meaning { color: var(--text-soft); font-size: .9rem; }
.example-line { font-family: var(--font-jp); font-size: 1rem; color: var(--text-soft); }
.kanji-big { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.kanji-hero { font-size: 4.5rem; font-weight: 700; line-height: 1; text-align: center; }
.kanji-ref { font-size: 2.4rem; font-weight: 700; font-family: var(--font-jp); }
.kanji-inline { font-size: 1.6rem; font-weight: 700; font-family: var(--font-jp); }
.my-hero { font-size: 1.15rem; margin-top: .3rem; }

/* ------------------------------ components ------------------------------- */
.card {
  background: var(--card);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }
a.card { color: var(--text); }
.glass { background: var(--card); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer; border-radius: 12px; padding: 10px 18px;
  font-weight: 700; font-size: .92rem; color: var(--text);
  background: rgba(99, 102, 241, 0.1); transition: all .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(120deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.35); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(99,102,241,.45); }
.btn-ghost { background: transparent; border: 1.5px solid var(--card-border); }
.btn-danger { background: linear-gradient(120deg, #f43f5e, #dc2626); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 10px; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; min-width: 38px; border-radius: 11px; border: none;
  background: rgba(99, 102, 241, 0.08); color: var(--text-soft); cursor: pointer;
  transition: all .2s; font-size: 1rem;
}
.icon-btn:hover { background: rgba(99, 102, 241, 0.18); color: var(--primary); }
.icon-btn.playing { color: var(--primary); animation: pulse .5s ease 2; }
.icon-btn.fav-on { color: var(--accent); background: rgba(236, 72, 153, 0.14); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
  padding: 7px 13px; border-radius: 999px; font-weight: 600; font-size: .82rem;
  background: rgba(99, 102, 241, 0.09); color: var(--text-soft); transition: all .2s;
}
.chip:hover { background: rgba(99, 102, 241, 0.18); }
.chip-sm { padding: 4px 10px; font-size: .76rem; }
.chip-toggle.on { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.35); }
.chip-flag { background: rgba(245, 158, 11, .2); color: var(--warn); }
.chip.danger { color: var(--danger); }
.chip-mastery { color: var(--ok); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.badge-lesson { background: rgba(99, 102, 241, 0.14); color: var(--primary); }
.badge-jlpt { background: rgba(236, 72, 153, 0.13); color: var(--accent); }
.badge-strokes { background: rgba(16, 185, 129, 0.13); color: var(--ok); }
.badge-reading { background: rgba(139, 92, 246, 0.13); color: #8b5cf6; }
.badge-due { background: rgba(245, 158, 11, 0.16); color: var(--warn); }
.badge-ok { background: rgba(16, 185, 129, 0.15); color: var(--ok); }
.badge-bad { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-status-new, .status-new { background: rgba(148, 163, 184, .16); color: var(--text-soft); }
.badge-status-learning, .status-learning { background: rgba(245, 158, 11, .16); color: var(--warn); }
.badge-status-familiar { background: rgba(99, 102, 241, .14); color: var(--primary); }
.badge-status-mastered, .status-mastered { background: rgba(16, 185, 129, .16); color: var(--ok); }

.input, .select {
  width: 100%; padding: 10px 14px; border-radius: 12px; font-size: .95rem;
  border: 1.5px solid var(--card-border); background: var(--card-solid); color: var(--text);
  transition: border .2s, box-shadow .2s; font-family: inherit;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field { display: block; font-weight: 600; font-size: .85rem; color: var(--text-soft); margin-bottom: 12px; }
.field .input, .field .select { margin-top: 6px; font-weight: 400; }
.field-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px; border-bottom: 1px dashed var(--card-border); font-weight: 600; font-size: .9rem;
}
.field-row:last-child { border-bottom: none; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(100, 116, 139, .35);
  transition: background .25s; cursor: pointer;
}
.switch i::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: transform .25s; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(20px); }

.seg { display: inline-flex; background: rgba(99,102,241,.08); border-radius: 12px; padding: 4px; gap: 4px; margin-top: 6px; }
.seg-btn { border: none; background: transparent; padding: 7px 16px; border-radius: 9px; font-weight: 700; font-size: .85rem; color: var(--text-soft); cursor: pointer; transition: all .2s; }
.seg-btn.active { background: var(--card-solid); color: var(--primary); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tab {
  border: none; background: rgba(99, 102, 241, 0.07); color: var(--text-soft);
  padding: 9px 16px; border-radius: 11px; font-weight: 700; font-size: .88rem; cursor: pointer;
  white-space: nowrap; transition: all .2s; display: inline-flex; align-items: center; gap: 6px;
}
.tab.active { background: linear-gradient(120deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 5px 14px rgba(99,102,241,.35); }
.tab-count { background: rgba(0,0,0,.16); border-radius: 999px; padding: 1px 7px; font-size: .72rem; }
.tab.active .tab-count { background: rgba(255,255,255,.22); }

.progress-bar { height: 8px; border-radius: 999px; background: rgba(100, 116, 139, .18); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .5s ease; }
.danger-fill { background: linear-gradient(90deg, #f59e0b, var(--danger)); }

/* page scaffolding */
.page { animation: fadeUp .35s ease both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-sub { color: var(--text-soft); margin: 4px 0 0; font-size: .9rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-soft); padding: 60px 0; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 14px; }
.filter-bar .input { flex: 1; min-width: 180px; }
.section-label {
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.1px;
  color: var(--text-faint); margin: 22px 0 12px;
}
.empty-state { text-align: center; padding: 46px 16px; color: var(--text-faint); }
.empty-state .ic { width: 44px; height: 44px; opacity: .5; }
.empty-state p { margin: 10px 0 0; font-size: .92rem; }
.empty-inline { color: var(--text-faint); font-size: .85rem; display: flex; gap: 8px; align-items: center; margin-top: 8px; }

/* grids */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 14px; }
.item-card { padding: 16px; cursor: pointer; }
.item-card:hover { transform: translateY(-3px); }
.kanji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.kanji-tile {
  border: 1.5px solid var(--card-border); border-radius: 14px; background: var(--card);
  padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text); transition: all .18s; box-shadow: var(--shadow);
  font-family: inherit;
}
.kanji-tile:hover { transform: translateY(-3px) scale(1.03); border-color: var(--primary); }
.kanji-tile.picked { border-color: var(--primary); background: rgba(99, 102, 241, 0.14); box-shadow: 0 0 0 3px var(--ring); }
.kt-char { font-size: 1.7rem; font-weight: 700; font-family: var(--font-jp); line-height: 1.2; }
.kt-read { font-size: .72rem; color: var(--text-soft); font-family: var(--font-jp); }
.kt-pron { font-size: .56rem; color: var(--text-faint); font-weight: 600; letter-spacing: .3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-pron.kt-mm { color: var(--text-soft); font-weight: 400; }
.kt-stroke { font-size: .66rem; color: var(--text-faint); display: inline-flex; align-items: center; gap: 3px; }
.kanji-grid .kanji-tile .kt-stroke .ic { width: .85em; height: .85em; }

/* lesson list */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 13px; }
.lesson-card { display: flex; gap: 13px; align-items: center; padding: 15px; }
.lesson-num {
  width: 46px; height: 46px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.lesson-title { font-weight: 800; }
.lesson-sub { font-size: .85rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-meta { font-size: .78rem; color: var(--text-faint); margin-top: 3px; }
.lesson-pct { font-weight: 800; color: var(--primary); }
.lesson-mini-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; }
.lesson-mini {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px;
  background: rgba(99, 102, 241, 0.06); color: var(--text-soft); font-size: .8rem; font-weight: 700;
}
.lesson-mini i { flex: 1; height: 6px; border-radius: 99px; background: rgba(100,116,139,.2); display: block; overflow: hidden; }
.lesson-mini i i { background: linear-gradient(90deg, var(--primary), var(--accent)); height: 100%; display: block; }
.lesson-mini em { font-style: normal; font-size: .72rem; }
.continue-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(99,102,241,.07); }
.jlpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.jlpt-card { padding: 20px; }
.jlpt-badge {
  font-size: 2rem; font-weight: 900; font-family: var(--font-jp);
  background: linear-gradient(120deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* dashboard */
.dash-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.dash-avatar {
  width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; box-shadow: var(--shadow-lg); flex: none;
}
.dash-greet { margin: 0 0 8px; }
.dash-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-goal { margin-left: auto; text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; }
.stat-card { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-card b { font-size: 1.5rem; }
.stat-card span { color: var(--text-soft); font-size: .78rem; }
.stat-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(99,102,241,.12); color: var(--primary); margin-bottom: 6px; }
.stat-row { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--text-soft); font-size: .75rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 11px; }
.quick {
  padding: 16px 10px; text-align: center; color: var(--text-soft); font-weight: 700; font-size: .82rem;
  display: flex; flex-direction: column; gap: 9px; align-items: center;
}
.qa-ic {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .16); transition: transform .2s ease;
}
.quick .ic { width: 21px; height: 21px; }
.quick:hover { transform: translateY(-3px); color: var(--primary); }
.quick:hover .qa-ic { transform: scale(1.1) rotate(-4deg); }
/* colored stat icons */
.stat-card:nth-child(1) .stat-ic { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.stat-card:nth-child(2) .stat-ic { background: linear-gradient(135deg, #ec4899, #f472b6); color: #fff; }
.stat-card:nth-child(3) .stat-ic { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; }
.stat-card:nth-child(4) .stat-ic { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.stat-card:nth-child(5) .stat-ic { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: #fff; }
.stat-card:nth-child(6) .stat-ic { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff; }
.mock-banner { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.mock-banner-ic { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; flex: none; }
.act-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: .88rem; border-bottom: 1px dashed var(--card-border); }
.act-item:last-child { border: none; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.act-quiz { background: var(--primary); } .act-flashcard { background: var(--accent); } .act-typing { background: var(--ok); }
.act-drawing { background: #8b5cf6; } .act-mocktest { background: var(--danger); } .act-matching { background: var(--warn); }
.act-speed { background: #f97316; } .act-study { background: #64748b; }

/* goal rings */
.goal-ring-wrap { text-align: center; position: relative; }
.goal-ring { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(100, 116, 139, 0.18); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-done { stroke: var(--ok); }
.goal-pct { position: absolute; top: 27px; left: 0; right: 0; font-weight: 900; font-size: 1.05rem; }
.goal-label { font-size: .75rem; color: var(--text-soft); font-weight: 700; margin-top: 2px; }
.goal-cur { font-size: .72rem; color: var(--text-faint); }
.goal-row { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 18px; }

/* heatmap */
.heatmap { display: grid; grid-template-columns: repeat(auto-fit, 12px); gap: 3px; justify-content: start; }
.hm { width: 11px; height: 11px; border-radius: 3px; background: rgba(100, 116, 139, 0.14); float: left; }
.hm-1 { background: rgba(99, 102, 241, 0.3); }
.hm-2 { background: rgba(99, 102, 241, 0.55); }
.hm-3 { background: rgba(99, 102, 241, 0.78); }
.hm-4 { background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 0 6px rgba(99,102,241,.5); }
.hm-blank { background: transparent; }

/* activity bars */
.act-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; font-size: .85rem; }
.act-label { width: 110px; color: var(--text-soft); font-weight: 600; }
.act-n { font-weight: 800; width: 34px; text-align: right; }

/* detail modals */
.detail-head { text-align: center; margin-bottom: 14px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 10px 0; }
.detail-table th { text-align: left; color: var(--text-faint); font-weight: 600; padding: 7px 10px 7px 0; white-space: nowrap; width: 42%; }
.detail-table td { padding: 7px 0; }
.detail-table tr { border-bottom: 1px dashed var(--card-border); }
.srs-line { font-size: .78rem; color: var(--text-faint); margin-top: 8px; }
.example-card { padding: 14px; margin-bottom: 10px; }
.stroke-demo { display: flex; justify-content: center; padding: 8px; }
.stroke-svg { width: min(200px, 60vw); height: auto; }
.stroke-path {
  fill: none; stroke: var(--text); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.stroke-path.ghost { stroke: rgba(99, 102, 241, 0.35); }

/* modals & toasts */
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 26, 0.6); backdrop-filter: blur(6px); animation: fadeIn .25s ease; }
.modal {
  position: relative; width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--card-solid); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 26px; animation: popIn .3s cubic-bezier(.2,.9,.3,1.2); border: 1px solid var(--card-border);
}
.modal-wide { width: min(720px, 100%); }
.modal-x { position: absolute; top: 14px; right: 14px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, 92vw); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px;
  background: var(--card-solid); box-shadow: var(--shadow-lg); border: 1px solid var(--card-border);
  font-weight: 600; font-size: .9rem; opacity: 0; transform: translateY(14px); transition: all .35s cubic-bezier(.2,.9,.3,1.1);
  pointer-events: auto; max-width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast-success .ic { color: var(--ok); } .toast-error .ic { color: var(--danger); } .toast-info .ic { color: var(--primary); }
.confirm-box { text-align: center; }
.confirm-icon { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(99,102,241,.13); color: var(--primary); }
.confirm-icon.danger { background: rgba(239,68,68,.13); color: var(--danger); }
.confirm-icon .ic { width: 28px; height: 28px; }

/* result screens */
.result-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 8px; }
.result-icon.pass { color: var(--ok); } .result-icon.fail { color: var(--danger); }
.compare-score { font-size: 3rem; font-weight: 900; color: var(--sc, var(--primary)); }
.compare-score span { font-size: 1.3rem; }
.compare-img { width: 100%; border-radius: 10px; background: #fff; }
.sug-list { display: flex; flex-direction: column; gap: 6px; }
.sug-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-soft); background: rgba(99,102,241,.07); padding: 8px 12px; border-radius: 10px; text-align: left; }

/* flashcard */
.fc-progress { margin-bottom: 14px; }
.fc-stage { max-width: 560px; margin: 0 auto; }
.flip-card { perspective: 1200px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 340px; transition: transform .55s cubic-bezier(.3,.8,.3,1); transform-style: preserve-3d; }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 22px; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/* v1.2 — minimalist card design */
.flip-front, .flip-back {
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  box-shadow: 0 14px 40px rgba(30, 35, 90, .10);
}
[data-theme="dark"] .flip-front, [data-theme="dark"] .flip-back { background: var(--card-solid); }
.flip-front { overflow: hidden; }
.flip-front::before {
  content: ''; position: absolute; top: 0; left: 16%; right: 16%; height: 3px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.flip-front .jp-hero { color: var(--text); text-shadow: none; }
.flip-front .fc-pron { color: var(--text-faint); font-weight: 600; letter-spacing: 1.5px; font-size: .85rem; }
.flip-front .fc-kana { color: var(--text-soft); font-family: var(--font-jp); }
.flip-front .fc-flip-hint { color: var(--text-faint); background: rgba(99, 102, 241, .06); }
.flip-back { transform: rotateY(180deg); }
.fc-front-label {
  font-size: .66rem; font-weight: 800; letter-spacing: 2.6px; text-transform: uppercase;
  color: var(--text-faint);
}
.fc-front-text { text-align: center; word-break: break-all; }
.fc-flip-hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: .75rem; color: var(--text-faint); display: flex; align-items: center; gap: 6px; background: rgba(99, 102, 241, .06); padding: 5px 14px; border-radius: 999px; white-space: nowrap; }
.fc-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
.fc-meaning { font-size: 1.15rem; text-align: center; }
/* v1.2 — flipped-state indicator */
.fc-side-ind {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 12px;
  font-size: .72rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-faint); background: rgba(99, 102, 241, .07);
  padding: 5px 14px; border-radius: 999px; transition: color .25s;
}
.fc-side-ind i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); transition: background .25s; }
.fc-side-ind.is-back { color: var(--accent); }
.fc-side-ind.is-back i { background: var(--accent); }
.fc-meta { margin-top: 6px; font-size: .78rem; color: var(--text-faint); text-align: right; }

/* typing */
.tp-prompt { font-size: 1.6rem; font-weight: 800; margin: 16px 0; word-break: break-word; }
.tp-live { min-height: 40px; font-size: 1.3rem; color: var(--primary); font-family: var(--font-jp); }
.tp-input { text-align: center; font-size: 1.3rem; max-width: 420px; margin: 8px auto; font-family: var(--font-jp); display: block; }
.tp-feedback { font-size: 1rem; font-weight: 700; }
.fb-correct { color: var(--ok); display: inline-flex; align-items: center; gap: 8px; }
.fb-wrong { color: var(--danger); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hint-chip { background: rgba(245,158,11,.15); color: var(--warn); padding: 6px 14px; border-radius: 999px; }

/* quiz */
.qz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.qz-score { color: var(--primary); display: flex; align-items: center; gap: 5px; font-weight: 800; }
.qz-prompt { font-size: 1.15rem; margin-bottom: 18px; text-align: center; min-height: 46px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qz-options { display: grid; gap: 10px; }
.qz-opt {
  border: 1.5px solid var(--card-border); background: var(--card-solid); color: var(--text);
  padding: 13px 16px; border-radius: 13px; font-size: .95rem; font-weight: 600; cursor: pointer;
  text-align: left; transition: all .18s; font-family: inherit;
}
.qz-opt:hover { border-color: var(--primary); transform: translateX(3px); }
.qz-opt.correct { border-color: var(--ok); background: rgba(16,185,129,.13); color: var(--ok); }
.qz-opt.wrong { border-color: var(--danger); background: rgba(239,68,68,.13); color: var(--danger); }
.qz-opt.selected { border-color: var(--primary); background: rgba(99,102,241,.12); box-shadow: 0 0 0 3px var(--ring); }
.qz-opt:disabled { cursor: default; transform: none; }
.qz-explain { margin-top: 10px; font-size: .9rem; color: var(--text-soft); background: rgba(99,102,241,.07); padding: 10px 14px; border-radius: 11px; }
.qz-review { display: grid; gap: 10px; text-align: left; max-height: 46vh; overflow-y: auto; }
.review-item { padding: 13px 15px; text-align: left; }
.rv-ok { border-left: 4px solid var(--ok); } .rv-bad { border-left: 4px solid var(--danger); }

/* matching */
.mg-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 14px; }
.mg-board { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin: 0 auto; }
.mg-col { display: flex; flex-direction: column; gap: 10px; }
.mg-card {
  border: 1.5px solid var(--card-border); background: var(--card); border-radius: 14px;
  padding: 13px 15px; font-weight: 700; cursor: grab; text-align: center; transition: all .2s;
  font-family: inherit; color: var(--text); box-shadow: var(--shadow);
}
.mg-card:hover { transform: translateY(-2px); }
.mg-jp { font-size: 1.15rem; font-family: var(--font-jp); display: flex; flex-direction: column; gap: 2px; align-items: center; }
.mg-jp .mg-word { font-size: 1.15rem; }
.mg-jp .en-pron, .mg-jp .mm-pron { font-size: .7rem; }
.mg-mm { font-size: .95rem; }
.mg-card.sel { border-color: var(--primary); background: rgba(99,102,241,.16); box-shadow: 0 0 0 3px var(--ring); }
.mg-card.matched { opacity: .25; transform: scale(.92); pointer-events: none; background: var(--ok); color: #fff; border-color: var(--ok); }
.mg-card.drag { opacity: .5; }
.shake { animation: shake .45s ease; }

/* speed round */
.sp-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 10px; }
.sp-time { color: var(--danger); display: flex; align-items: center; gap: 5px; }
.sp-combo { color: var(--warn); display: flex; align-items: center; gap: 5px; }
.sp-score { color: var(--primary); display: flex; align-items: center; gap: 5px; }
.lb-table { max-width: 380px; margin: 0 auto; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.lb-row:nth-child(odd) { background: rgba(99,102,241,.06); }
.lb-first { background: linear-gradient(90deg, rgba(245,158,11,.2), transparent) !important; color: var(--warn); }
.lb-rank { width: 24px; font-weight: 900; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.lb-score { font-weight: 900; }

/* mock test */
.mt-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mt-sec-label { font-weight: 800; }
.mt-timer { font-weight: 900; font-size: 1.05rem; color: var(--primary); display: flex; align-items: center; gap: 6px; }
.mt-timer-warn { color: var(--danger); animation: pulse 1s infinite; }
.mt-main { display: grid; grid-template-columns: 1fr 210px; gap: 14px; align-items: start; }
.mt-palette { position: sticky; top: 70px; }
.mt-palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mt-pcell {
  aspect-ratio: 1; border: 1.5px solid var(--card-border); border-radius: 9px; background: var(--card-solid);
  font-weight: 800; font-size: .8rem; cursor: pointer; color: var(--text-soft); transition: all .15s;
  font-family: inherit;
}
.mt-pcell.answered { background: rgba(16,185,129,.16); color: var(--ok); border-color: var(--ok); }
.mt-pcell.flagged { border-color: var(--warn); box-shadow: inset 0 0 0 2px rgba(245,158,11,.5); }
.mt-pcell.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.mt-legend { display: flex; gap: 12px; font-size: .7rem; color: var(--text-faint); flex-wrap: wrap; }
.mt-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-answered { background: var(--ok); } .lg-flagged { background: var(--warn); } .lg-current { background: var(--primary); }
.mt-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.mt-section-card { text-align: center; }
.mt-sec-name { font-weight: 800; } .mt-sec-meta { font-size: .8rem; color: var(--text-soft); margin-top: 4px; }
.mt-overall { font-size: 3.4rem; font-weight: 900; background: linear-gradient(120deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mt-section-scores { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; }
.mt-score-row { display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.mt-score-row .progress-bar { flex: 1; }
.mt-review { text-align: left; max-height: 55vh; overflow-y: auto; display: grid; gap: 16px; }
.mt-review-title { font-weight: 800; margin-bottom: 8px; }
.mt-review-sec .review-item { margin-bottom: 8px; }

/* writing / drawing */
.canvas-wrap { position: relative; width: 100%; max-width: 440px; margin: 0 auto; aspect-ratio: 1; }
.draw-canvas {
  width: 100%; height: 100%; display: block; border-radius: 16px; touch-action: none;
  background: var(--card-solid); border: 2px solid var(--card-border); box-shadow: var(--shadow);
}
.kanji-picker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.kanji-picker .kanji-tile { min-width: 68px; }
.wb-canvas-wrap { position: relative; height: 62vh; min-height: 340px; border-radius: 16px; overflow: hidden; background: var(--wb-bg); border: 2px solid var(--card-border); box-shadow: var(--shadow); }
.wb-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.wb-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); color: rgba(148,163,184,.7); font-size: .8rem; pointer-events: none; }
.wb-toolbar { gap: 6px; }
.wb-sep { width: 1px; height: 24px; background: var(--card-border); margin: 0 4px; }
.wb-colors { display: flex; gap: 5px; align-items: center; }
.wb-color { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid transparent; cursor: pointer; padding: 0; }
.wb-color.on { border-color: var(--text); transform: scale(1.12); }
.wb-size { width: 74px; padding: 6px 24px 6px 10px; }
.wb-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.wb-thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #fff; }
.wb-thumb-name { font-size: .8rem; font-weight: 700; margin: 6px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* word list */
.wl-row {
  display: grid; grid-template-columns: 1.4fr 1.4fr auto auto; gap: 10px; align-items: center;
  padding: 12px 16px; margin-bottom: 9px; cursor: pointer;
}
.wl-jp { font-weight: 800; font-family: var(--font-jp); overflow: hidden; text-overflow: ellipsis; }
.wl-mm { color: var(--text-soft); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.wl-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.jlpt-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* reading/listening lesson tabs */
.reading-list, .listening-list { display: grid; gap: 12px; }
.reading-card { position: relative; padding: 18px; }
.reading-idx { position: absolute; top: 12px; right: 14px; width: 26px; height: 26px; border-radius: 50%; background: rgba(99,102,241,.14); color: var(--primary); font-weight: 800; font-size: .78rem; display: flex; align-items: center; justify-content: center; }
.reading-trans { margin-top: 8px; padding: 10px 12px; border-radius: 11px; background: rgba(16,185,129,.08); }

/* settings / profile / subscription */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.profile-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pf-avatar { width: 72px; height: 72px; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 2.3rem; box-shadow: var(--shadow-lg); flex: none; }
.pf-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pf-badge {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 14px;
  background: rgba(99,102,241,.08); font-size: .76rem; font-weight: 700; text-align: center; color: var(--text-soft);
}
.pf-badge .ic { width: 26px; height: 26px; color: var(--primary); }
.pf-badge.locked { opacity: .45; filter: grayscale(.8); }
.avatar-grid { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 6px; }
.avatar-opt { font-size: 1.5rem; width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; background: rgba(99,102,241,.07); cursor: pointer; transition: all .15s; }
.avatar-opt.on { border-color: var(--primary); background: rgba(99,102,241,.16); transform: scale(1.08); }
.color-opt { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-opt.on { border-color: var(--text); transform: scale(1.12); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.plan-card { padding: 24px; text-align: center; position: relative; }
.plan-current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring), var(--shadow-lg); }
.plan-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); }
.plan-price { font-size: 2.2rem; font-weight: 900; margin: 10px 0; }
.plan-price span { font-size: .95rem; color: var(--text-soft); font-weight: 600; }
.plan-list { list-style: none; padding: 0; margin: 14px 0; text-align: left; display: grid; gap: 8px; }
.plan-list li { display: flex; gap: 8px; font-size: .88rem; color: var(--text-soft); align-items: flex-start; }
.plan-list li .ic { color: var(--ok); margin-top: 2px; }

/* v1.1 — ambient background orbs (glassmorphism depth) */
.orb { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; opacity: .55; }
.orb-1 { width: 430px; height: 430px; top: -140px; right: -110px; background: radial-gradient(circle, rgba(99, 102, 241, .30), transparent 65%); }
.orb-2 { width: 470px; height: 470px; bottom: -170px; left: -150px; background: radial-gradient(circle, rgba(236, 72, 153, .24), transparent 65%); }
[data-theme="dark"] .orb-1 { opacity: .28; }
[data-theme="dark"] .orb-2 { opacity: .22; }

/* v1.1 — skeleton loading */
.sk-wrap { padding: 6px 0; }
.sk-title { height: 26px; width: 42%; border-radius: 8px; margin-bottom: 18px; }
.sk-card { height: 128px; border-radius: var(--radius); margin-bottom: 14px; }
.sk-title, .sk-card {
  background: linear-gradient(90deg, rgba(99, 102, 241, .07) 25%, rgba(99, 102, 241, .16) 50%, rgba(99, 102, 241, .07) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* v1.2 — pronunciation lines (English with - syllables, Myanmar) */
.en-pron { font-size: .8rem; letter-spacing: .8px; color: var(--text-faint); font-weight: 600; }
.mm-pron { font-size: .8rem; color: var(--text-soft); margin-top: 1px; }
.wl-prons .en-pron, .wl-prons .mm-pron { font-size: .72rem; }
.tp-prons { min-height: 20px; }
.tp-prons .en-pron, .tp-prons .mm-pron { font-size: .85rem; }

/* v1.1 — gradient hover on kanji tiles */
.kanji-tile:hover {
  border-color: transparent;
  background:
    linear-gradient(var(--card-solid), var(--card-solid)) padding-box,
    linear-gradient(135deg, var(--primary), var(--accent)) border-box;
}

/* v1.1 — slim scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, .25); border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(99, 102, 241, .45); }
::-webkit-scrollbar-track { background: transparent; }

/* animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ------------------------------ responsive ------------------------------- */
@media (max-width: 1100px) {
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .mt-main { grid-template-columns: 1fr; }
  .mt-palette { position: static; }
}
@media (max-width: 760px) {
  .app { padding: 14px; }
  .topbar { padding: 8px 14px; }
  .page-head h1 { font-size: 1.3rem; }
  .wl-row { grid-template-columns: 1fr auto; }
  .wl-badges { grid-column: 1 / -1; }
  .dash-goal { margin-left: 0; }
  .flip-inner { height: 300px; }
  .modal { padding: 20px; }
  .mg-board { gap: 8px; }
  .jp-hero { font-size: 2.1rem; }
  .kanji-hero { font-size: 3.4rem; }
}
@media (max-width: 460px) {
  .grid-cards { grid-template-columns: 1fr; }
  .kanji-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
