/* NCLC 7 course site. Mobile first; light and dark themes. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1c1d20;
  --muted: #5f636b;
  --faint: #868a92;
  --border: #e2dfd7;
  --border-strong: #cdc9bf;
  --accent: #2148c0;
  --accent-hover: #1a3a9e;
  --accent-ink: #ffffff;
  --accent-soft: #e7ecfa;
  --ok: #17784b;
  --ok-soft: #e1f2e8;
  --warn: #8f5405;
  --warn-soft: #fbefd8;
  --bad: #b93a2f;
  --bad-soft: #fbe6e2;
  --code-bg: #eceef3;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 14px rgba(20, 20, 30, .045);
  --radius: 14px;
  --radius-sm: 10px;
  --top-h: 56px;
  --tab-h: 62px;
  --maxw: 760px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141518;
    --surface: #1c1e22;
    --surface-2: #25282d;
    --text: #e9e9ec;
    --muted: #a6aab2;
    --faint: #80848c;
    --border: #2e3137;
    --border-strong: #42464e;
    --accent: #93adff;
    --accent-hover: #b4c6ff;
    --accent-ink: #0e1838;
    --accent-soft: #222b44;
    --ok: #62d097;
    --ok-soft: #1a3325;
    --warn: #f0b75c;
    --warn-soft: #3a2d15;
    --bad: #ff8c80;
    --bad-soft: #3e201c;
    --code-bg: #2a2d33;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141518;
  --surface: #1c1e22;
  --surface-2: #25282d;
  --text: #e9e9ec;
  --muted: #a6aab2;
  --faint: #80848c;
  --border: #2e3137;
  --border-strong: #42464e;
  --accent: #93adff;
  --accent-hover: #b4c6ff;
  --accent-ink: #0e1838;
  --accent-soft: #222b44;
  --ok: #62d097;
  --ok-soft: #1a3325;
  --warn: #f0b75c;
  --warn-soft: #3a2d15;
  --bad: #ff8c80;
  --bad-soft: #3e201c;
  --code-bg: #2a2d33;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--top-h) + 14px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 20px);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; letter-spacing: -0.012em; }
h1 { font-size: 1.65rem; margin-top: .2em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p, ul, ol { margin: .6em 0; }
ul, ol { padding-left: 1.35em; }
li { margin: .25em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
blockquote {
  margin: 1em 0;
  padding: .55em 1em;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
blockquote p { margin: .35em 0; }

code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--code-bg);
  padding: .1em .38em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
code.copyable { cursor: copy; box-shadow: inset 0 0 0 1px transparent; transition: background .15s, color .15s; }
code.copyable:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
code.copied { background: var(--ok-soft); color: var(--ok); }
@media (hover: none) { code.copyable { cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, .08); } }

.prebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 1em;
  padding: 6px 8px 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
pre {
  margin: 0 0 1em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
pre code { background: none; padding: 0; font-size: inherit; }

.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ---------- top bar and tab bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: #2148c0; color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px;
  box-shadow: inset 0 -3px 0 #ef4135;
}
.topnav { display: none; margin-left: 10px; gap: 2px; }
.topnav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .94rem; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tools { margin-left: auto; display: flex; gap: 2px; }
.iconbtn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted);
  border-radius: 12px; cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 22px; height: 22px; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 56px; }
}

/* ---------- layout ---------- */

.main { max-width: var(--maxw); margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
.eyebrow { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 1.1em 0 .2em; }
.eyebrow a { color: inherit; }
.lede { color: var(--muted); font-size: 1.02rem; }
.muted { color: var(--muted); }
.page-head { margin-bottom: 14px; }
.section-title { margin-top: 2em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 650; font-size: .94rem; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { min-height: 36px; padding: 0 13px; font-size: .87rem; }
.btn svg { width: 18px; height: 18px; flex: none; }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.linkbtn { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--bad); text-decoration: underline; cursor: pointer; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 6px; font-size: 1.05rem; border: 0; padding: 0; }
.callout { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.notice { background: var(--warn-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
  min-height: 42px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); font-weight: 650; }
.field input, .field textarea { font-weight: 400; }

/* ---------- day ---------- */

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 4px; min-height: 40px; }
.daynav .pn { color: var(--muted); text-decoration: none; font-weight: 650; font-size: .92rem; padding: 8px 2px; min-width: 72px; }
.daynav .pn:hover { color: var(--accent); }
.daynav .next { text-align: right; }
.daynav .mid { min-width: 0; margin: 0 auto; text-align: center; color: var(--accent); }
.daynav.bottom { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 8px; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 750; font-size: .8rem; }
.day h1 { font-size: 1.55rem; margin: .1em 0 .35em; }
.day .eyebrow { margin-top: .5em; }
.daymeta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: .92rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 750; text-decoration: none; line-height: 1.6; }
.badge.mock { background: var(--bad-soft); color: var(--bad); }
a.badge.mock:hover { color: var(--bad); text-decoration: underline; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.progress .bar { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width .3s ease; }
.progress.big { height: 8px; margin: 6px 0 10px; }
.progress-label { font-size: .85rem; margin: 0 0 12px; }

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 12px 14px;
  margin: 12px 0;
  box-shadow: var(--shadow);
  transition: background .2s;
}
.block-head { display: flex; align-items: center; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; font-weight: 750; font-size: 1.05rem; min-height: 40px; -webkit-tap-highlight-color: transparent; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.check .box {
  width: 26px; height: 26px; flex: none;
  border-radius: 8px; border: 2px solid var(--border-strong);
  display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check input:checked + .box { background: var(--ok); border-color: var(--ok); }
.check input:checked + .box::after {
  content: ""; width: 7px; height: 13px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: translateY(-1px) rotate(45deg);
}
.check input:focus-visible + .box { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.block-name .sub { font-weight: 500; color: var(--muted); font-size: .9rem; }
.prio { font-size: .72rem; font-weight: 800; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; cursor: help; }
.prio-a { background: var(--accent-soft); color: var(--accent); }
.prio-b { background: var(--warn-soft); color: var(--warn); }
.prio-c { background: var(--surface-2); color: var(--muted); }
.mins { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.block-body { margin-top: 4px; padding-left: 38px; overflow-wrap: break-word; }
.block-body > p:first-child { margin-top: 0; }
.block.done { background: var(--surface-2); box-shadow: none; }
.block.done .block-body { opacity: .62; }
.block.done .block-name { text-decoration: line-through; text-decoration-color: var(--faint); text-decoration-thickness: 1.5px; }
.block-body .btn { margin: 8px 0 2px; }
.hint { font-size: .86rem; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 440px) {
  .block-body { padding-left: 0; }
}

.why, .note-card { border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.why { background: var(--accent-soft); }
.note-card { background: var(--warn-soft); }
.why h2, .note-card h2 { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; color: var(--muted); border: 0; padding: 0; }
.why p, .note-card p { margin: 0; }
.sync-line { font-size: .85rem; margin-top: 14px; text-align: center; }

details.cards { margin-top: 10px; border-top: 1px dashed var(--border-strong); padding-top: 8px; }
details.cards > summary { cursor: pointer; font-weight: 650; font-size: .92rem; color: var(--accent); padding: 4px 0; }
details.cards > summary .muted { font-weight: 400; font-size: .85rem; }
.cardlist { list-style: none; padding: 0; margin: 8px 0 0; }
.cardlist > li { margin: 0; border-bottom: 1px solid var(--border); }
.cardlist > li:last-child { border-bottom: 0; }
.cardlist summary {
  list-style: none; cursor: pointer; padding: 8px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 14px;
}
.cardlist summary::-webkit-details-marker { display: none; }
.cardlist .fr { font-weight: 650; }
.cardlist .en { color: var(--muted); }
.cardlist .more { padding: 0 0 10px; font-size: .92rem; }
.cardlist .ex { margin: 2px 0 6px; }
.cardlist .note { color: var(--muted); font-size: .87rem; margin: 4px 0; }
.cardlist .meta { color: var(--faint); font-size: .76rem; margin: 4px 0 0; }
@media (max-width: 480px) {
  .cardlist summary { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- calendar ---------- */

.week { margin: 26px 0; scroll-margin-top: calc(var(--top-h) + 10px); }
.week h2 { margin: 0 0 2px; font-size: 1.15rem; }
.weekfocus { color: var(--muted); margin: 0 0 10px; font-size: .95rem; }
.daylist { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.daylist li { margin: 0; border-top: 1px solid var(--border); }
.daylist li:first-child { border-top: 0; }
.daylist a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--text); text-decoration: none; }
.daylist a:hover { background: var(--surface-2); color: var(--text); }
.dnum {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--surface-2); display: grid; place-items: center;
  font-weight: 750; font-variant-numeric: tabular-nums;
}
.dinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ddate { font-size: .8rem; color: var(--muted); }
.dtitle { font-weight: 560; line-height: 1.35; }
.dinfo .badge { align-self: flex-start; margin-top: 4px; }
.dprog { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.daylist a.today { background: var(--accent-soft); }
.daylist a.today .dnum { background: var(--accent); color: var(--accent-ink); }
.daylist a.complete .dnum { background: var(--ok); color: #fff; }
.daylist a.complete .dprog { color: var(--ok); font-weight: 750; }

/* ---------- guides ---------- */

.gsec { margin: 22px 0; scroll-margin-top: calc(var(--top-h) + 10px); }
.gsec h2 { margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: .78rem; }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.gcard {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.gcard:hover { border-color: var(--accent); color: var(--text); }
.gtitle { font-weight: 720; }
.gdesc { font-size: .87rem; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }

/* ---------- documents ---------- */

.doc h2 { padding-top: .9em; border-top: 1px solid var(--border); }
.doc h1 + .toc, .doc h1 + p { margin-top: .6em; }
h2:target, h3:target, h4:target { background: var(--warn-soft); border-radius: 6px; box-shadow: 0 0 0 6px var(--warn-soft); }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin: 14px 0 20px; box-shadow: var(--shadow); }
.toc summary { cursor: pointer; font-weight: 720; padding: 2px 0; }
.toc ol { padding-left: 1.1em; margin: 6px 0; font-size: .93rem; }
.toc ol ol { font-size: .9rem; margin: 2px 0 6px; }
.toc li { margin: .2em 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
a.idref { text-decoration-style: dotted; text-decoration-thickness: 1.5px; font-weight: 650; }

.tw {
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: .9rem; line-height: 1.45; }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-weight: 720; font-size: .8rem; }
tbody tr:last-child td { border-bottom: 0; }
tr:target td { background: var(--warn-soft); }
td code { font-size: .84em; }

@media (max-width: 640px) {
  .tw.stack { border: 0; background: transparent; overflow: visible; border-radius: 0; }
  .tw.stack table, .tw.stack tbody, .tw.stack tr, .tw.stack td { display: block; width: 100%; }
  .tw.stack thead { display: none; }
  .tw.stack tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin: 0 0 10px; padding: 6px 12px; box-shadow: var(--shadow);
    scroll-margin-top: calc(var(--top-h) + 14px);
  }
  .tw.stack tr:target { background: var(--warn-soft); }
  .tw.stack tr:target td { background: transparent; }
  .tw.stack td { border: 0; padding: 5px 0; }
  .tw.stack td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  }
  .tw.stack td:first-child { font-size: 1rem; }
  .tw.stack td:empty { display: none; }
}

/* ---------- tracker ---------- */

.tsummary .tw { margin-top: 0; }
.tsummary td, .tsummary th { white-space: nowrap; }
.mock {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin: 12px 0; box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--top-h) + 10px);
}
.mock > summary { cursor: pointer; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; list-style: none; }
.mock > summary::-webkit-details-marker { display: none; }
.mock > summary::before { content: "▸"; color: var(--muted); font-size: .9rem; width: 12px; }
.mock[open] > summary::before { content: "▾"; }
.mock .mtitle { font-weight: 750; }
.mock .mname { color: var(--muted); font-size: .9rem; }
.mock .mchips { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.mock .mbody { padding: 0 16px 14px; border-top: 1px solid var(--border); }
.mock .papers { font-size: .9rem; color: var(--muted); margin: 10px 0; }
.skill { margin: 14px 0; }
.skill h3 { font-size: .95rem; margin: 0 0 6px; }
.bands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .bands { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.bands input { text-align: center; padding: 8px 4px; }
.bands input.over { border-color: var(--bad); color: var(--bad); }
.result { font-weight: 650; margin: 8px 0 0; font-size: .95rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.lvl { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.lvl.ok { background: var(--ok-soft); color: var(--ok); }
.lvl.bad { background: var(--bad-soft); color: var(--bad); }
.lvl.none { background: var(--surface-2); color: var(--faint); }
.lowest { font-weight: 650; }

/* ---------- timer ---------- */

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.presets button {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; min-height: 40px;
  font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer;
}
.presets button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tcustom { display: flex; gap: 8px; align-items: end; margin: -6px 0 16px; max-width: 320px; }
.tface { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow); }
.tlabel { font-weight: 750; font-size: 1.1rem; margin: 0; min-height: 1.6em; }
.tclock { font-size: clamp(64px, 23vw, 128px); font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -0.035em; margin: 6px 0 10px; line-height: 1; }
.tface.ending .tclock { color: var(--warn); }
.tface.done .tclock { color: var(--ok); }
.tnext { margin: 0; min-height: 1.6em; }
.tctrl { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 10px; }
.tctrl .btn { min-width: 104px; }
.tsound { font-size: .9rem; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tsegs { list-style: none; padding: 0; margin: 16px 0; }
.tsegs li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; color: var(--muted); margin: 2px 0; }
.tsegs li .t { font-variant-numeric: tabular-nums; }
.tsegs li.cur { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tsegs li.past { text-decoration: line-through; color: var(--faint); }

/* ---------- words ---------- */

.wordtools input[type="search"] { font-size: 17px; padding: 12px 14px; min-height: 48px; }
.wfilters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
#wlist { margin-top: 4px; }

/* ---------- find ---------- */

dialog.find {
  width: min(640px, calc(100vw - 20px));
  max-height: min(78vh, 640px);
  margin: max(8vh, 10px) auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  overflow: hidden;
}
dialog.find::backdrop { background: rgba(10, 12, 20, .38); }
.find-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); align-items: center; }
.find-head input { flex: 1; }
.findres { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: calc(min(78vh, 640px) - 70px); }
.findres li { margin: 0; }
.findres a { display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--text); line-height: 1.4; }
.findres a:hover, .findres a.sel { background: var(--accent-soft); }
.findres .k { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 750; display: block; }
.findres .empty { padding: 12px; color: var(--muted); }

/* ---------- sync ---------- */

.code-big { font-family: var(--mono); font-size: 1.45rem; font-weight: 750; letter-spacing: .05em; margin: 2px 0 10px; }
.linkbox code { display: block; padding: 10px 12px; font-size: .85rem; }
.joinrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 14px; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { position: relative; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 650; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.seg label:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 16px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px;
  font-size: .9rem; font-weight: 650;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .tabbar, .toast, .daynav, .sync-line, .prebar button { display: none !important; }
  body { padding: 0; background: #fff; }
  .block, .panel, .toc { box-shadow: none; }
}
