/* NOVAS app — the base layer: type, the frame (rail / top bar / tab bar), and
 * the components every screen shares. Colours come only from
 * /assets/gen/tokens.css (novas/design-v2/tokens.css, copied by the build), so
 * the app is drawn on exactly the website's paper and ink, in both themes.
 */

:root {
  /* The three study areas are told apart by their icons and names, drawn in
     ink: the hues already mean something else here — ochre Casual, indigo
     Polite (in the lessons), green done, red the brand and "now". */
  --sec-deck: var(--ink-mid);   --sec-deck-bg: var(--sunken);   --sec-deck-ln: var(--border);
  --sec-schema: var(--ink-mid); --sec-schema-bg: var(--sunken); --sec-schema-ln: var(--border);
  --sec-praxis: var(--ink-mid); --sec-praxis-bg: var(--sunken); --sec-praxis-ln: var(--border);

  --font: 'Inter', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --jp: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --rail-w: 268px;
  --top-h: 56px;
  --tab-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --r-card: 16px;
  --r-ctl: 12px;
  --shadow-1: 0 1px 2px rgba(22, 24, 26, .04);
  --shadow-2: 0 10px 30px -12px rgba(22, 24, 26, .28);
  --glass: rgba(244, 242, 237, .86);
  --glass-2: rgba(255, 255, 255, .9);
}
html[data-theme="dark"] {
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 12px 34px -12px rgba(0, 0, 0, .75);
  --glass: rgba(20, 19, 17, .86);
  --glass-2: rgba(36, 34, 31, .92);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
html.theme-shifting *, html.theme-shifting *::before, html.theme-shifting *::after { transition: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
.jp, ruby { font-family: var(--jp); }
rt { font-size: .5em; font-weight: 500; color: var(--ink-soft); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--red-mid); outline-offset: 2px; }
[hidden] { display: none !important; }

/* The NOVAS wordmark, drawn as a mask so it takes the ink colour of either theme. */
.mark {
  display: inline-block; width: 74px; height: 22px; background: var(--ink);
  -webkit-mask: url(/assets/gen/logo.svg) no-repeat center / contain;
          mask: url(/assets/gen/logo.svg) no-repeat center / contain;
}
/* ════════ the opening (index.html #boot) ════════
   ~1.3s, left to right: N and O slide in, the V is drawn down and its arrow
   shoots up — Japanese getting better — then A and S. main.js then fades it
   out over the first screen. */
.boot {
  position: fixed; inset: 0; z-index: 1000; background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .38s ease, visibility 0s linear .38s;
}
.boot-logo { width: min(44vw, 176px); height: auto; overflow: visible; transition: transform .38s cubic-bezier(.4, 0, .2, 1); }
.boot-logo path { fill: currentColor; }
.boot.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot.is-done .boot-logo { transform: scale(1.06); }

/* Each letter slides in from the left, one after another. */
.boot-l { opacity: 0; animation: bootIn .46s cubic-bezier(.2, .8, .2, 1) forwards; }
.boot-n { animation-delay: .08s; }
.boot-o { animation-delay: .2s; }
.boot-a { animation-delay: .76s; }
.boot-s { animation-delay: .88s; }
@keyframes bootIn { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }

/* The V, third: a thick white line in its mask draws it — down the left arm,
   then faster up the right one to the arrowhead. */
.boot-vline { fill: none !important; stroke: #fff; stroke-width: 80; stroke-linejoin: miter;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: bootDraw .56s cubic-bezier(.75, 0, .25, 1) .3s forwards; }
@keyframes bootDraw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .boot-vline { animation: none; stroke-dashoffset: 0; }
  .boot-l { animation: none; opacity: 1; }
}


/* ════════ the frame ════════ */

.main { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-b)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));
  /* The two sides take the same width (the wider one's), so the title sits in
     the true middle whatever is on either side; the title gives way first. */
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr); align-items: center; gap: 6px;
  background: var(--paper);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled, body.is-focus .topbar { border-bottom-color: var(--border); }
.top-left, .top-right { display: flex; align-items: center; gap: 2px; min-width: 44px; }
.top-right { justify-content: flex-end; }
.top-title { min-width: 0; text-align: center; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.tt-main { font-weight: 700; font-size: 1rem; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-sub { font-size: .72rem; color: var(--ink-soft); font-weight: 600; letter-spacing: .02em; }
.top-brand { display: inline-flex; align-items: center; padding: 0 6px; height: 44px; }
.top-brand .mark { width: 62px; height: 18px; }
.top-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
.top-progress i { display: block; height: 100%; background: var(--red); transform: scaleX(0); transform-origin: 0 50%; transition: transform .12s linear; }

.icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--ink);
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  transition: background .15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--sunken); }
.icon-btn:active { background: var(--border); }
.icon-btn.is-on { color: var(--red); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  background: var(--glass-2);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-soft); font-size: 11px; font-weight: 650; letter-spacing: .01em;
  -webkit-user-select: none; user-select: none;
}
.tab-icon svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--red); }
.tab.is-active .tab-icon svg { stroke-width: 2.1; }
body.is-focus .tabbar, body.is-bare .tabbar, body.is-bare .topbar { display: none; }
body.is-focus .main, body.is-bare .main { padding-bottom: 0; }

.status-pill {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--safe-b) + 10px);
  max-width: calc(100% - 32px); padding: 6px 14px; border-radius: 999px; font-size: .78rem; font-weight: 650;
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); pointer-events: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
body.is-focus .status-pill { bottom: calc(var(--safe-b) + 14px); }
@media (min-width: 900px) { .status-pill { bottom: 18px; left: calc(50% + var(--rail-w) / 2); } }
.status-pill.is-off { background: var(--slate); color: #fff; }

/* The rail: desktop only. */
.rail { display: none; }

@media (min-width: 900px) {
  .main { margin-left: var(--rail-w); padding-bottom: 0; }
  body.is-focus .main { padding-bottom: 0; }
  .tabbar { display: none; }
  .top-brand { display: none; }
  .topbar { grid-template-columns: minmax(44px, auto) 1fr minmax(44px, auto); padding-left: 16px; padding-right: 16px; }
  .top-title { align-items: flex-start; text-align: left; }
  .rail {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-w); z-index: 35;
    background: var(--surface); border-right: 1px solid var(--border);
  }
  html[data-theme="dark"] .rail { background: var(--sunken); }
  body.is-bare .rail { display: none; }
  body.is-bare .main { margin-left: 0; }
}
.rail-head { height: 64px; padding: 0 20px; display: flex; align-items: center; flex: none; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand .mark { width: 78px; height: 23px; }
.brand:hover .mark { background: var(--red); }
.rail-nav { padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: none; }
.rail-cat { padding: 14px 12px 6px; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.rail-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px;
  text-decoration: none; color: var(--ink); transition: background .15s;
}
.rail-link:hover { background: var(--sunken); }
html[data-theme="dark"] .rail-link:hover { background: var(--surface); }
.rail-link.is-active { background: var(--red-bg); }
.rl-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); background: var(--sunken); border: 1px solid var(--border);
}
.rl-icon svg { width: 18px; height: 18px; }
.rl-deck .rl-icon { color: var(--sec-deck); background: var(--sec-deck-bg); border-color: var(--sec-deck-ln); }
.rl-schema .rl-icon { color: var(--sec-schema); background: var(--sec-schema-bg); border-color: var(--sec-schema-ln); }
.rl-praxis .rl-icon { color: var(--sec-praxis); background: var(--sec-praxis-bg); border-color: var(--sec-praxis-ln); }
.rail-link.is-active .rl-icon { color: var(--red); background: var(--surface); border-color: var(--red-ln); }
.rl-text { display: flex; flex-direction: column; min-width: 0; }
.rl-title { font-size: .92rem; font-weight: 700; line-height: 1.25; }
.rl-sub { font-size: .74rem; color: var(--ink-soft); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-sub { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--border); padding: 6px 10px 12px; }
.rail-sub:empty { border-top-color: transparent; }
.rail-foot {
  flex: none; height: 56px; padding: 0 12px; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--border);
}
.rail-foot-btn {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-mid); text-decoration: none;
}
.rail-foot-btn svg { width: 18px; height: 18px; }
.rail-foot-btn:hover, .rail-foot-btn.is-active { color: var(--red); border-color: var(--red-ln); }
.rail-foot-who { flex: 1; min-width: 0; font-size: .75rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-btn .i-moon { display: none; }
html[data-theme="dark"] .theme-btn .i-sun { display: none; }
html[data-theme="dark"] .theme-btn .i-moon { display: inline; }

/* A list inside the rail (Schema's lessons, Praxis's dialogues). */
.rs-group { margin-top: 10px; }
.rs-head { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 10px 4px; }
.rs-name { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.rs-count { font-size: .7rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rs-row {
  display: grid; grid-template-columns: 2.6rem 1fr 1.2rem; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 9px; text-decoration: none; color: var(--ink-mid); font-size: .86rem;
}
.rs-row:hover { background: var(--sunken); color: var(--ink); }
html[data-theme="dark"] .rs-row:hover { background: var(--surface); }
.rs-row.is-active { background: var(--red-bg); color: var(--red); font-weight: 700; }
.rs-num { font-size: .7rem; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; }
.rs-num svg { width: 15px; height: 15px; }
.rs-row.is-active .rs-num { color: var(--red); }
.rs-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-state { display: inline-flex; justify-content: flex-end; color: var(--green); }
.rs-state svg { width: 15px; height: 15px; }
.rs-row.is-locked { color: var(--ink-soft); opacity: .62; }
.rs-row.is-next { color: var(--red); font-weight: 700; }
.rs-row.is-next .rs-num { color: var(--red); }
.rs-row.is-locked .rs-state { color: var(--ink-soft); }

/* ════════ the page ════════ */

.view { display: block; width: 100%; max-width: 1080px; margin: 0 auto; padding: 16px calc(16px + var(--safe-r)) 32px calc(16px + var(--safe-l)); outline: none; }
@media (min-width: 900px) { .view { padding: 24px 32px 48px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.page-title { font-family: var(--display); font-weight: var(--display-weight); font-size: clamp(1.7rem, 5vw, 2.2rem); letter-spacing: -.025em; line-height: 1.15; color: var(--ink); }
.page-sub { color: var(--ink-soft); font-size: .95rem; margin-top: 4px; }
.label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft);
  margin: 26px 2px 10px;
}
.label:first-child { margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px; }
@media (min-width: 600px) { .card-pad { padding: 22px; } }

/* Buttons */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--r-ctl);
  min-height: 46px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--red); color: var(--on-red); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-soft); }
.btn-ghost { background: transparent; color: var(--ink-mid); }
.btn-ghost:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--red-ln); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .85rem; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.link-btn { appearance: none; background: none; border: 0; padding: 0; color: var(--red); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 750; letter-spacing: .02em;
  border: 1px solid var(--border); background: var(--sunken); color: var(--ink-mid);
}
.chip.casual { color: var(--casual); background: var(--casual-bg); border-color: var(--casual-ln); }
.chip.polite { color: var(--polite); background: var(--polite-bg); border-color: var(--polite-ln); }
.chip.ok { color: var(--green); background: var(--green-bg); border-color: var(--green-ln); }
.chip.red { color: var(--red); background: var(--red-bg); border-color: var(--red-ln); }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border); }
.segmented button {
  appearance: none; border: 0; background: transparent; color: var(--ink-soft);
  min-height: 34px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: .85rem;
}
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
html[data-theme="dark"] .segmented button.is-on { background: var(--line-2); }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .82rem; font-weight: 700; color: var(--ink-mid); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 1rem;
}
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.input::placeholder { color: var(--ink-soft); opacity: .8; }
.hint { font-size: .8rem; color: var(--ink-soft); }
.error-text { color: var(--red); font-size: .88rem; font-weight: 600; }

/* Progress bars */
.bar { height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; position: relative; }
.card .bar { background: var(--sunken); }
html[data-theme="dark"] .card .bar { background: var(--paper); }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--red); }
.bar.ok > i { background: var(--green); }

/* Rows / lists */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px;
  border-top: 1px solid var(--border); text-decoration: none; color: var(--ink);
}
.list-row:first-child { border-top: 0; }
a.list-row:hover, button.list-row:hover { background: var(--sunken); }
.list-row .lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 650; font-size: .95rem; }
.lr-sub { font-size: .8rem; color: var(--ink-soft); }
.lr-end { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.lr-end svg { width: 18px; height: 18px; }
button.list-row { appearance: none; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; text-align: left; }

/* Loading, empty */
.loading { display: flex; align-items: center; justify-content: center; min-height: 40vh; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--red);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { max-width: 420px; margin: 9vh auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 12px; }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); background: var(--sunken); border: 1px solid var(--border); }
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.empty-text { color: var(--ink-soft); line-height: 1.6; margin-bottom: 8px; }

/* Notices inside a screen */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-card);
  border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px;
}
.notice-icon { flex: none; color: var(--ink-soft); }
.notice-icon svg { width: 22px; height: 22px; }
.notice-body { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.55; color: var(--ink-mid); }
.notice-body b { color: var(--ink); }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.notice.is-warn { border-color: var(--casual-ln); background: var(--casual-bg); }
.notice.is-warn .notice-icon { color: var(--casual); }
.notice.is-red { border-color: var(--red-ln); background: var(--red-bg); }
.notice.is-red .notice-icon { color: var(--red); }
.notice.is-ok { border-color: var(--green-ln); background: var(--green-bg); }
.notice.is-ok .notice-icon { color: var(--green); }
.notice-x { margin: -8px -8px 0 0; width: 36px; height: 36px; }

/* Toasts */
#toasts {
  position: fixed; z-index: 100; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
body.is-focus #toasts, body.is-bare #toasts { bottom: calc(var(--safe-b) + 16px); }
@media (min-width: 900px) { #toasts { bottom: 24px; left: var(--rail-w); } }
/* While the status pill ("Offline · 2 changes saved") shows, toasts sit above it. */
body.has-status #toasts { bottom: calc(var(--tab-h) + var(--safe-b) + 52px); }
body.has-status.is-focus #toasts, body.has-status.is-bare #toasts { bottom: calc(var(--safe-b) + 56px); }
@media (min-width: 900px) { body.has-status #toasts { bottom: 60px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  max-width: 460px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--paper); font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow-2); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: var(--green); color: #fff; }
html[data-theme="dark"] .toast-ok { color: #0b1f18; }
.toast-error { background: var(--red); color: var(--on-red); }
.toast-action { appearance: none; border: 0; background: rgba(255, 255, 255, .18); color: inherit; font-weight: 800; padding: 6px 12px; border-radius: 9px; }

/* Sheets (bottom sheet on a phone, dialog on a desktop) */
.sheet-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 10, 10, .38);
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s;
}
.sheet-back.in { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 6px 18px calc(18px + var(--safe-b));
  transform: translateY(24px); transition: transform .22s var(--ease); box-shadow: var(--shadow-2);
}
.sheet-back.in .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 20px; padding-bottom: 20px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.sheet-title { font-weight: 800; font-size: 1.05rem; }
.sheet-text { color: var(--ink-mid); line-height: 1.6; margin-bottom: 18px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Shared: a play/speaker button */
.tts-btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--ink-mid);
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.tts-btn svg { width: 16px; height: 16px; }
.tts-btn:hover { color: var(--red); border-color: var(--red-ln); }

/* The access-ended screen in Deck / Schema / Praxis */
.locked-card { max-width: 480px; margin: 8vh auto; text-align: center; padding: 28px 22px; }
.locked-card .empty-icon { margin: 0 auto 14px; color: var(--red); background: var(--red-bg); border-color: var(--red-ln); }
.locked-card h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.locked-card p { color: var(--ink-soft); line-height: 1.6; margin-bottom: 18px; }

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