/* A1 German Trainer — stylesheet
   Light/dark via [data-theme] on <html>; palette from validated reference set. */

:root {
  --surface: #fcfcfb;
  --plane: #f4f4f1;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e3eefb;
  --known: #0ca30c;
  --known-bar: #1baf7a;
  --known-soft: #e2f5ec;
  --learning: #a36f00;
  --learning-bar: #eda100;
  --learning-soft: #fdf2d9;
  --new-bar: #d8d7d0;
  --wrong: #d03b3b;
  --wrong-soft: #fbe7e7;
  --de-flag-1: #000; --de-flag-2: #dd0000; --de-flag-3: #ffce00;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 4px 16px rgba(11,11,11,.05);
  --shadow-lg: 0 2px 6px rgba(11,11,11,.07), 0 12px 32px rgba(11,11,11,.10);
  --radius: 12px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --surface: #1a1a19;
  --plane: #111110;
  --card: #222220;
  --ink: #f2f1ec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-soft: #1c2f47;
  --known: #0ca30c;
  --known-bar: #199e70;
  --known-soft: #12312a;
  --learning: #e5b053;
  --learning-bar: #c98500;
  --learning-soft: #37290e;
  --new-bar: #3a3a37;
  --wrong: #e66767;
  --wrong-soft: #3a1d1d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--plane);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 58px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand .flag {
  width: 22px; height: 15px; border-radius: 3px; overflow: hidden; flex: none;
  background: linear-gradient(to bottom, var(--de-flag-1) 33.3%, var(--de-flag-2) 33.3% 66.6%, var(--de-flag-3) 66.6%);
  box-shadow: inset 0 0 0 1px var(--border);
}
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }

.nav { display: flex; gap: 2px; margin-left: 12px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 13px; border-radius: 8px; font-size: 14px; font-weight: 550;
  color: var(--ink-2); white-space: nowrap; text-decoration: none;
}
.nav a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; color: var(--ink-2); flex: none;
}
@media (hover: hover) { .iconbtn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); } }
.iconbtn { -webkit-tap-highlight-color: transparent; }
.iconbtn svg { width: 19px; height: 19px; }

.searchbtn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--hairline); background: var(--card);
  padding: 6px 12px; border-radius: 9px; color: var(--muted); font-size: 13.5px;
  min-width: 160px;
}
.searchbtn kbd {
  margin-left: auto; font-family: inherit; font-size: 11px; color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 4px; padding: 0 5px; background: var(--plane);
}
.searchbtn:hover { border-color: var(--muted); }
.searchbtn svg { width: 14px; height: 14px; flex: none; }

.layout { display: flex; max-width: 1280px; margin: 0 auto; min-height: calc(100vh - 58px); }
main { flex: 1; min-width: 0; padding: 28px 32px 80px; }
.page { max-width: 860px; margin: 0 auto; animation: fadeUp .25s ease both; }
.page.wide { max-width: 1020px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Sidebar (study) ---------- */
.sidebar {
  width: 272px; flex: none; padding: 24px 8px 40px 16px;
  border-right: 1px solid var(--hairline);
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
}
.sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 8px 6px; font-weight: 650; }
.tree-week > .wk {
  display: flex; align-items: center; gap: 4px; width: 100%;
  padding: 4px 10px 4px 2px; border-radius: 8px; font-size: 14px; font-weight: 650;
}
.tree-week > .wk:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.tree-week .chevbtn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 7px;
}
.tree-week .chevbtn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.tree-week .chev { transition: transform .18s; color: var(--muted); }
.tree-week.open .chev { transform: rotate(90deg); }
.tree-week .wklink { color: inherit; text-decoration: none; flex: 1; padding: 5px 0; min-width: 0; }
.tree-week .wklink:hover { color: var(--accent-ink); text-decoration: none; }
.tree-week .wkpct { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.guidelink {
  display: block; padding: 8px 10px; margin: 0 0 8px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft);
  text-decoration: none; border: 1px dashed transparent;
}
.guidelink:hover { text-decoration: none; border-color: var(--accent); }
.guidelink.active { border-color: var(--accent); border-style: solid; }
.weekhdr {
  font-size: 21px; letter-spacing: -.02em; padding-bottom: 8px; margin-bottom: 4px;
  border-bottom: 2px solid var(--accent);
}
.tree-items { display: none; padding: 2px 0 6px 14px; }
.tree-week.open .tree-items { display: block; }
.tree-items a {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2);
  text-decoration: none; border-left: 2px solid transparent;
}
.tree-items a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.tree-items a.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
.tree-items .done-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hairline); flex: none; }
.tree-items .done-dot.done { background: var(--known-bar); }
.tree-cat { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .07em; margin: 8px 10px 3px; }

.hamburger { display: none; }
.scrim { display: none; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .hamburger { display: inline-flex; }
  .nav { display: none; }               /* top nav moves to the bottom tab bar */
  .brand { flex: 1; min-width: 0; }
  .brand small { display: none; }
  .brand > span:not(.flag) { overflow: hidden; text-overflow: ellipsis; }
  .searchbtn { min-width: 0; padding: 8px; border: none; background: none; }
  .searchbtn span, .searchbtn kbd { display: none; }
  .searchbtn svg { width: 19px; height: 19px; }
  .sidebar {
    position: fixed; left: 0; top: 58px; z-index: 60; background: var(--surface);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
    height: calc(100vh - 58px); padding-bottom: 90px;
  }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 58px 0 0; z-index: 55; background: rgba(0,0,0,.35); }
  main { padding: 20px 16px 96px; }     /* room for the tab bar */

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--hairline);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; border-radius: 9px; text-decoration: none;
    color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .01em;
    min-width: 0;
  }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--accent-ink); background: var(--accent-soft); }
  .fc-kbd { display: none; }            /* keyboard hints are meaningless on touch */
}

/* ---------- Typography & cards ---------- */
h1.pagetitle { font-size: 26px; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 4px; }
.pagesub { color: var(--ink-2); font-size: 14.5px; margin-bottom: 26px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent-ink); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { font-size: 17px; letter-spacing: -.01em; margin-bottom: 10px; }
.card h2 .num { color: var(--muted); font-weight: 600; margin-right: 6px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650;
  padding: 2px 9px; border-radius: 99px; letter-spacing: .02em;
}
.tag.grammar { background: var(--accent-soft); color: var(--accent-ink); }
.tag.vocab { background: var(--known-soft); color: var(--known); }
.tag.practice { background: var(--learning-soft); color: var(--learning); }

/* content tables */
.ctable { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.ctable th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 6px 10px; border-bottom: 1.5px solid var(--hairline);
}
.ctable td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.ctable tr:last-child td { border-bottom: none; }
.ctable td:first-child { font-weight: 600; white-space: nowrap; }
.ctable .ex { color: var(--ink-2); }
.tablewrap { overflow-x: auto; }

.notebox {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 11px 14px; border-radius: 0 9px 9px 0; font-size: 13.8px; color: var(--ink); margin: 12px 0;
}
.notebox b.lbl { color: var(--accent-ink); }
.exbox { font-size: 13.8px; color: var(--ink-2); font-style: italic; margin-top: 10px; }
.exbox::before { content: "→ "; color: var(--accent); font-style: normal; font-weight: 700; }
.bonusbox {
  border: 1px dashed var(--hairline); border-radius: 9px; padding: 11px 14px;
  font-size: 13.8px; margin: 12px 0; background: color-mix(in srgb, var(--plane) 55%, transparent);
}
.bonusbox b { color: var(--learning); }
ul.points { margin: 10px 0 4px 20px; font-size: 14.3px; }
ul.points li { margin-bottom: 5px; }
.gintro { font-size: 14.3px; color: var(--ink-2); white-space: pre-line; margin-bottom: 4px; }

/* review-check row */
.reviewrow {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 13px;
  border-top: 1px solid var(--hairline);
}
.checkbtn {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 9px; border: 1.5px solid var(--hairline); color: var(--ink-2);
  transition: all .15s;
}
@media (hover: hover) { .checkbtn:hover { border-color: var(--muted); } }
.checkbtn.on { background: var(--known-soft); border-color: var(--known-bar); color: var(--known); }
.checkbtn svg { width: 15px; height: 15px; }

/* vocab word rows */
.wordrow td:first-child { width: 34px; padding-right: 0; }
.wordcheck {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--hairline);
  display: inline-flex; align-items: center; justify-content: center; transition: all .12s;
  vertical-align: middle; padding: 0;
}
@media (hover: hover) { .wordcheck:hover { border-color: var(--known-bar); } }
.wordcheck.learning { background: var(--learning-soft); border-color: var(--learning-bar); }
.wordcheck.known { background: var(--known-bar); border-color: var(--known-bar); color: #fff; }
.wordcheck svg { width: 12px; height: 12px; }
.wordde { font-weight: 600; }
.legendrow { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legendrow .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* practice accordion */
.qa { border: 1px solid var(--hairline); border-radius: 10px; margin-bottom: 8px; overflow: hidden; background: var(--card); }
.qa summary {
  list-style: none; cursor: pointer; padding: 11px 14px; font-size: 14.3px; display: flex; gap: 10px; align-items: baseline;
}
.qa summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .qa summary:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); } }
.qa .qnum { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.qa .qmark { margin-left: auto; flex: none; font-size: 12px; }
.qa .answer {
  padding: 11px 14px 13px 38px; border-top: 1px dashed var(--hairline);
  font-size: 14.3px; background: color-mix(in srgb, var(--plane) 60%, transparent); white-space: pre-line;
}
.qa .selfmark { display: flex; gap: 8px; margin-top: 10px; }
.smbtn {
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px;
  border: 1.5px solid var(--hairline); color: var(--ink-2); transition: all .12s;
}
.smbtn.right.on { background: var(--known-soft); border-color: var(--known-bar); color: var(--known); }
.smbtn.wrong.on { background: var(--wrong-soft); border-color: var(--wrong); color: var(--wrong); }
.qa.marked-correct { border-color: color-mix(in srgb, var(--known-bar) 50%, var(--hairline)); }
.qa.marked-incorrect { border-color: color-mix(in srgb, var(--wrong) 50%, var(--hairline)); }

/* ---------- Dashboard ---------- */
.hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.hero .ring { flex: none; }
.hero .greet h1 { font-size: 24px; letter-spacing: -.02em; margin-bottom: 4px; }
.hero .greet p { color: var(--ink-2); font-size: 14.5px; max-width: 52ch; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 550; }

.weekcard {
  display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow); margin-bottom: 12px; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.weekcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.weekcard .row1 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 3px; }
.weekcard .wl { font-size: 12px; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .06em; }
.weekcard .wt { font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; }
.weekcard .pct { margin-left: auto; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.weekcard .sum { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.meter { height: 7px; border-radius: 99px; background: var(--new-bar); overflow: hidden; display: flex; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.weekcard .subm { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.weekcard .subm b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.continue {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff;
  font-weight: 650; font-size: 14px; padding: 10px 18px; border-radius: 10px; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
.continue:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.continue svg { width: 15px; height: 15px; }

.sectionhead { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.sectionhead h2 { font-size: 18px; letter-spacing: -.015em; }
.sectionhead .more { margin-left: auto; font-size: 13px; font-weight: 600; }

/* ---------- Flashcards ---------- */
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.deck {
  text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; width: 100%;
}
.deck:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.deck .dt { font-weight: 650; font-size: 14.5px; margin-bottom: 2px; letter-spacing: -.01em; }
.deck .dw { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.deck.special { border-style: dashed; border-color: var(--accent); }

.fc-stage { max-width: 560px; margin: 0 auto; }
.fc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 13.5px; color: var(--ink-2); }
.fc-top .cnt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.fc-progress { height: 5px; border-radius: 99px; background: var(--new-bar); overflow: hidden; margin-bottom: 26px; }
.fc-progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s ease; }

.fc-card {
  perspective: 1200px; cursor: pointer; height: 300px; margin-bottom: 20px;
  -webkit-tap-highlight-color: transparent;
}
.fc-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2,.7,.3,1);
}
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 28px; gap: 12px;
}
.fc-face.back { transform: rotateY(180deg); }
.fc-face .lang { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.fc-face .word { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.fc-face.back .word { font-size: 24px; }
.fc-face .ex { font-size: 14.5px; color: var(--ink-2); font-style: italic; max-width: 40ch; }
.fc-face .hint { position: absolute; bottom: 14px; font-size: 11.5px; color: var(--muted); }

.fc-actions { display: flex; gap: 10px; justify-content: center; }
.fc-btn {
  flex: 1; max-width: 200px; padding: 12px 16px; border-radius: 12px; font-weight: 650; font-size: 14.5px;
  border: 1.5px solid var(--hairline); transition: all .13s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.fc-btn svg { width: 16px; height: 16px; }
.fc-btn.still { color: var(--learning); }
.fc-btn.know { color: var(--known); }
/* hover styles only on devices that truly hover — on touch, :hover sticks after a tap */
@media (hover: hover) {
  .fc-btn.still:hover { background: var(--learning-soft); border-color: var(--learning-bar); }
  .fc-btn.know:hover { background: var(--known-soft); border-color: var(--known-bar); }
}
.fc-btn:active { transform: scale(.97); }
.fc-kbd { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }
.fc-kbd kbd { border: 1px solid var(--hairline); border-radius: 4px; padding: 0 5px; font-family: inherit; font-size: 11px; background: var(--card); }

.fc-done { text-align: center; padding: 40px 20px; }
.fc-done .big { font-size: 44px; margin-bottom: 10px; }
.fc-done h2 { font-size: 20px; margin-bottom: 6px; }
.fc-done p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 20px; }
.fc-done .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Progress charts ---------- */
.chartcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.chartcard h2 { font-size: 15.5px; margin-bottom: 2px; letter-spacing: -.01em; }
.chartcard .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.chartcard svg text { font-family: inherit; }
.chartlegend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-top: 10px; flex-wrap: wrap; }
.chartlegend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.streakgrid { display: flex; gap: 4px; flex-wrap: wrap; }
.streakcell { width: 15px; height: 15px; border-radius: 4px; background: var(--new-bar); }
.streakcell.hit { background: var(--accent); }
.streakcell[title] { cursor: default; }

/* ---------- Search ---------- */
.searchwrap { max-width: 640px; margin: 0 auto; }
.searchinput {
  width: 100%; font: inherit; font-size: 16px; padding: 13px 16px; border-radius: 12px;
  border: 1.5px solid var(--hairline); background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.searchinput:focus { outline: none; border-color: var(--accent); }
.hit {
  display: block; padding: 12px 16px; border: 1px solid var(--border); background: var(--card);
  border-radius: 10px; margin-top: 8px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.hit:hover { border-color: var(--accent); text-decoration: none; }
.hit .h1 { font-weight: 650; font-size: 14.5px; }
.hit .h2 { font-size: 13px; color: var(--ink-2); }
.hit .where { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hit mark { background: var(--learning-soft); color: inherit; border-radius: 2px; }
.noresults { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* ---------- Reference / misc ---------- */
.reflist { counter-reset: r; }
.reflist .refitem {
  display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline); font-size: 14.3px;
}
.reflist .refitem:last-child { border-bottom: none; }
.reflist .refitem::before {
  counter-increment: r; content: counter(r);
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px;
}
.linkcard { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); margin-bottom: 10px; box-shadow: var(--shadow); }
.linkcard .ic { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.linkcard .ic svg { width: 17px; height: 17px; }
.linkcard .t { font-weight: 650; font-size: 14.5px; }
.linkcard .d { font-size: 13px; color: var(--ink-2); }

.tasklist .task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.tasklist .task:last-child { border-bottom: none; }
.tasklist .task .tx { font-size: 14.3px; }
.tasklist .task .tx a { font-weight: 600; }
.taskcheck {
  flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--hairline);
  display: inline-flex; align-items: center; justify-content: center; transition: all .12s; margin-top: 1px; padding: 0;
}
@media (hover: hover) { .taskcheck:hover { border-color: var(--known-bar); } }
.taskcheck.on { background: var(--known-bar); border-color: var(--known-bar); color: #fff; }
.taskcheck svg { width: 13px; height: 13px; }
.task.done .tx { color: var(--muted); text-decoration: line-through; }

.notecard {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px;
  font-size: 14.3px; white-space: pre-line; box-shadow: var(--shadow); font-style: italic; color: var(--ink-2); margin: 10px 0;
}
.script {
  border-left: 3px solid var(--known-bar); background: var(--known-soft); padding: 14px 18px;
  border-radius: 0 10px 10px 0; font-size: 15px; margin: 12px 0;
}
.script .en { font-size: 13px; color: var(--ink-2); font-style: italic; margin-top: 8px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.pillbtn {
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 99px;
  border: 1.5px solid var(--hairline); color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
@media (hover: hover) { .pillbtn:hover { border-color: var(--accent); color: var(--accent-ink); } }
.pillbtn:hover { text-decoration: none; }
.pillbtn svg { width: 14px; height: 14px; }

.headsup {
  border-left: 3px solid var(--learning-bar); background: var(--learning-soft);
  padding: 11px 14px; border-radius: 0 9px 9px 0; font-size: 13.5px; margin-bottom: 10px;
}
.headsup b { color: var(--learning); }

.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 30px 20px 10px; max-width: 68ch; margin: 0 auto; }

/* ---------- Sync ---------- */
.formrow { margin: 12px 0; max-width: 380px; }
.formrow label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.formrow .searchinput { margin-top: 5px; box-shadow: none; }
#syncbtn { position: relative; }
#syncbtn.sync-on::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--known-bar);
  box-shadow: 0 0 0 2px var(--surface);
}

@media print {
  .topbar, .sidebar, .reviewrow, .continue, .pill-row { display: none !important; }
  body { background: #fff; }
  .card, .chartcard { box-shadow: none; break-inside: avoid; }
}
