/* ============================================================ fonts */
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url(../fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url(../fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Vazirmatn"; font-weight: 100 900; font-display: swap; src: url(../fonts/vazirmatn-arabic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

@font-face { font-family: "Literata"; font-weight: 200 900; font-style: normal; font-display: swap; src: url(../fonts/literata-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-weight: 200 900; font-style: normal; font-display: swap; src: url(../fonts/literata-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-weight: 200 900; font-style: italic; font-display: swap; src: url(../fonts/literata-latin-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-weight: 200 900; font-style: italic; font-display: swap; src: url(../fonts/literata-latin-ext-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-style: italic; font-display: swap; src: url(../fonts/source-serif-4-latin-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-style: italic; font-display: swap; src: url(../fonts/source-serif-4-latin-ext-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/atkinson-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/atkinson-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/atkinson-latin-400-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/atkinson-latin-ext-400-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/atkinson-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/atkinson-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: italic; font-display: swap; src: url(../fonts/atkinson-latin-700-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: italic; font-display: swap; src: url(../fonts/atkinson-latin-ext-700-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ============================================================ tokens */
:root {
  --font: "Inter", "Vazirmatn", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 8px; --r: 14px; --r-lg: 20px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --rail: 244px;
  --tabs: 60px;
  --mini: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --pim: #2bb58b;       /* Pimsleur accent */
  --lin: #7a86ff;       /* Lingoda accent */
  --book: #e0a458;      /* Library accent */
  --serif: "Literata", Georgia, "Times New Roman", serif;
}
[data-theme="dark"] {
  --bg: #0d0e12; --surface: #15171d; --surface-2: #1b1e26; --surface-3: #252934;
  --border: #252934; --text: #eceef3; --muted: #8b909e; --faint: #5d6270;
  --accent: #8b95ff; --accent-ink: #0d0e12; --accent-soft: rgba(139, 149, 255, .14);
  --ok: #3ccf9b; --danger: #ff6b7a;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  --pim: #3ccf9b; --lin: #8b95ff; --book: #f0b45f; --news: #ff8196; --course: #52c7ea;
  --w-new: rgba(122, 134, 255, .24); --w-1: rgba(255, 196, 40, .34);
  --page-filter: invert(.9) hue-rotate(180deg);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f6f9; --surface: #ffffff; --surface-2: #f0f1f6; --surface-3: #e4e6ee;
  --border: #e4e6ee; --text: #14151a; --muted: #686d7b; --faint: #a0a4b0;
  --accent: #4f5bd5; --accent-ink: #ffffff; --accent-soft: rgba(79, 91, 213, .09);
  --ok: #0f9d70; --danger: #d93a4e;
  --shadow: 0 12px 36px rgba(30, 36, 80, .14);
  --pim: #0f9d70; --lin: #4f5bd5; --book: #b9791f; --news: #d23d58; --course: #0a7fa8;
  --w-new: rgba(79, 91, 213, .15); --w-1: rgba(244, 166, 0, .40);
  --page-filter: none;
  color-scheme: light;
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); font-feature-settings: "cv11", "ss03"; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.03em; font-weight: 700; }
h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================================================ shell */
#shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
#col { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; position: relative; }
#view { flex: 1; outline: none; padding: 40px 40px calc(48px + var(--mini)); max-width: 1040px; width: 100%; margin: 0 auto; }
#topbar, #tabs { display: none; }

#rail { position: sticky; top: 0; height: 100dvh; padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--border); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.brand-mark { width: 28px; height: 28px; flex: none; border-radius: 8px; overflow: hidden; display: block; }
.brand-mark img { display: block; width: 100%; height: 100%; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail-gap { flex: 1; }
.profile-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; text-align: left; width: 100%; transition: background .15s; }
.profile-chip:hover { background: var(--surface-2); }
.profile-chip b { display: block; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip small { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.profile-chip > span:last-child { min-width: 0; flex: 1; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; color: #fff; background: var(--c, var(--accent)); font-size: 15px; text-transform: uppercase; }
.avatar.lg { width: 76px; height: 76px; font-size: 32px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }

.sync { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync[data-s="syncing"] { background: var(--accent); animation: pulse 1s infinite; }
.sync[data-s="offline"], .sync[data-s="error"] { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ============================================================ mobile shell */
@media (max-width: 859px) {
  :root { --rail: 0px; }
  #shell { display: block; }
  #rail { display: none; }
  #col { min-height: 100dvh; }
  #topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  #topbar .brand { padding: 0; }
  #view { padding: 12px 16px calc(var(--tabs) + var(--safe-b) + var(--mini) + 28px); }
  #tabs { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabs) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
  #tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: -.01em; }
  #tabs a[aria-current="page"] { color: var(--accent); }
  #tabs .avatar { width: 24px; height: 24px; font-size: 11px; }
  h1 { font-size: 24px; }
  body.immersive #tabs, body.immersive #topbar { display: none; }
  body.immersive #view { padding: 0; max-width: none; }
}
body.has-mini { --mini: 72px; }
@media (max-width: 859px) { body.has-mini { --mini: 76px; } }

/* ============================================================ primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); transition: background .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--muted); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, #e5a50a 16%, transparent); color: #d9a00a; }
.chip .ico { width: 13px; height: 13px; stroke-width: 2.4; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { height: 34px; padding: 0 16px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.seg button:disabled { opacity: .4; }

.bar { display: block; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c, var(--accent)); transition: width .4s var(--ease); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
a.card, button.card { display: block; text-align: left; width: 100%; transition: border-color .15s, transform .15s var(--ease), background .15s; }
a.card:hover, button.card:hover { border-color: color-mix(in srgb, var(--c, var(--accent)) 50%, var(--border)); transform: translateY(-1px); }

.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 26px; }
.page-head p { color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 550; margin: 0 0 10px -6px; padding: 4px 8px 4px 2px; border-radius: 8px; }
.back:hover { color: var(--text); }
.back .ico { width: 18px; height: 18px; }
section + section, .continue + section { margin-top: 34px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-head small { color: var(--muted); font-size: 13px; }

/* ============================================================ login / profiles */
.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.panel { width: min(440px, 100%); display: grid; gap: 22px; }
.panel .brand { padding: 0; justify-content: center; font-size: 18px; }
.panel h1 { text-align: center; }
.panel > p { text-align: center; color: var(--muted); margin-top: -12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); width: 100%; transition: border-color .15s; }
.input:focus { outline: none; border-color: var(--accent); }
.error-text { color: var(--danger); font-size: 14px; min-height: 1.4em; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 160px)); justify-content: center; gap: 12px; }
.profile-card { display: grid; justify-items: center; gap: 12px; padding: 22px 12px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); font-weight: 600; text-align: center; transition: border-color .15s, transform .15s var(--ease); position: relative; word-break: break-word; }
.profile-card:hover { border-color: var(--c); transform: translateY(-2px); }
.profile-card.add { border-style: dashed; color: var(--muted); align-content: center; }
.profile-card.add .circle { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.swatch[aria-pressed="true"] { border-color: var(--surface); box-shadow: 0 0 0 2px var(--c); }

/* ============================================================ home */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.hello p { color: var(--muted); margin-top: 4px; }
.continue { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.cont { padding: 18px; display: grid; gap: 14px; align-content: space-between; min-height: 156px; --c: var(--accent); }
.cont .kicker { display: flex; align-items: center; gap: 8px; color: var(--c); font-size: 13px; font-weight: 650; }
.cont .kicker .ico { width: 18px; height: 18px; }
.cont h3 { font-size: 19px; letter-spacing: -.02em; line-height: 1.25; margin-top: 4px; }
.cont .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cont .row { display: flex; align-items: center; gap: 12px; }
.cont .row .bar { flex: 1; }
.cont .go { width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.cont .go .ico { width: 18px; height: 18px; }
.cont.pim { --c: var(--pim); } .cont.lin { --c: var(--lin); } .cont.bkc { --c: var(--book); } .cont.news { --c: var(--news); } .cont.crs { --c: var(--course); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { padding: 16px; display: grid; gap: 4px; }
.tile b { font-size: 26px; letter-spacing: -.03em; font-weight: 700; }
.tile span { color: var(--muted); font-size: 13px; }
.week { padding: 18px 18px 14px; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; }
.week-col { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 6px; height: 100%; }
.week-bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.week-bars i { width: min(14px, 30%); min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--c); opacity: .95; }
.week-bars i.zero { background: var(--surface-3); opacity: 1; }
.week-col small { color: var(--muted); font-size: 12px; }
.week-col.today small { color: var(--text); font-weight: 650; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 14px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 7px; }
.lvl-rows { display: grid; gap: 14px; padding: 18px; }
.lvl-row { display: grid; grid-template-columns: 78px 1fr auto; gap: 14px; align-items: center; }
.lvl-row b { font-weight: 600; } .lvl-row small { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .hello .avatar.lg { width: 52px; height: 52px; font-size: 22px; } .continue { grid-template-columns: 1fr; } .cont { min-height: 0; } }

/* ============================================================ levels / tiles */
.level-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.level-card { padding: 18px; display: grid; gap: 14px; --c: var(--pim); }
.level-card .top { display: flex; align-items: baseline; justify-content: space-between; }
.level-card h3 { font-size: 20px; letter-spacing: -.02em; }
.level-card .stats { display: flex; gap: 14px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.level-card .bar { --c: var(--pim); }
.lin .level-card, .level-card.lin { --c: var(--lin); }

.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.track { position: relative; display: grid; align-content: space-between; gap: 10px; min-height: 96px; padding: 12px 12px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color .15s, transform .15s var(--ease), background .15s; --c: var(--pim); overflow: hidden; }
.track:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); transform: translateY(-1px); }
.track .n { font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.track .n small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-bottom: 4px; text-transform: uppercase; }
.track .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.track .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }
.track .bar > i { background: var(--c); }
.track.reading { --c: #b98af0; }
[data-theme="light"] .track.reading { --c: #8a55d6; }
.track .n small .ico { width: 11px; height: 11px; vertical-align: -1px; margin-right: 4px; }
.track.done { background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.track.done .n { color: var(--c); }
.track.playing { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.track .tick { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: var(--accent-ink); display: grid; place-items: center; }
.track .tick .ico { width: 12px; height: 12px; stroke-width: 3; }
.track .eq { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.track .eq i { width: 3px; background: var(--c); border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.track .eq i:nth-child(2) { animation-delay: .2s; } .track .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.badge-fa { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); color: var(--muted); }
.badge-fa.on { background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.note-box { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.note-box .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
a.card.hero-cta, .hero-cta { padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; --c: var(--pim); }
.hero-cta b { display: block; font-size: 17px; letter-spacing: -.02em; }
.hero-cta small { color: var(--muted); }

/* ============================================================ mini player */
#mini { position: fixed; z-index: 25; left: calc(var(--rail) + 12px); right: 12px; bottom: 12px; display: none; pointer-events: none; }
body.has-mini #mini { display: block; }
body.has-mini.card-visible #mini { display: none; }
.mini { pointer-events: auto; margin: 0 auto; max-width: 1016px; height: 60px; border-radius: 16px; background: color-mix(in srgb, var(--surface-2) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; align-items: center; gap: 4px; padding: 0 8px 0 14px; position: relative; overflow: hidden; }
.mini .info { flex: 1; min-width: 0; text-align: left; padding: 8px 0; }
.mini .info b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .info small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mini .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }
.mini .bar > i { background: var(--pim); transition: none; }
.mini .play { width: 44px; height: 44px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; flex: none; }
.mini .play .ico { width: 20px; height: 20px; }
@media (max-width: 859px) { #mini { left: 8px; right: 8px; bottom: calc(var(--tabs) + var(--safe-b) + 8px); } body.immersive #mini { bottom: calc(var(--safe-b) + 8px); } }

/* ============================================================ player page */
.listen { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.listen.no-book { grid-template-columns: minmax(0, 520px); justify-content: center; }
.p-card { padding: 22px; display: grid; gap: 22px; position: sticky; top: 24px; --c: var(--pim); }
.p-title { display: grid; gap: 4px; }
.p-title .kick { color: var(--c); font-weight: 650; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.p-title h1 { font-size: 30px; }
.p-title p { color: var(--muted); }
.p-seg { display: flex; flex-direction: column; gap: 8px; }
.p-seg .seg { display: flex; } .p-seg .seg button { flex: 1; }
.p-seg small { color: var(--muted); font-size: 12.5px; }
.p-seg small:empty, .p-msg:empty { display: none; }
.scrub { display: grid; gap: 8px; }
.scrub-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
input[type=range].seek { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; touch-action: none; cursor: pointer; --p: 0%; --buf: 0%; }
input[type=range].seek::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--c) var(--p), color-mix(in srgb, var(--c) 28%, var(--surface-3)) var(--p) var(--buf), var(--surface-3) var(--buf)); }
input[type=range].seek::-moz-range-track { height: 6px; border-radius: 99px; background: var(--surface-3); }
input[type=range].seek::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--c); }
input[type=range].seek::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--c); margin-top: -7px; border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: transform .12s; }
input[type=range].seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); }
input[type=range].seek:active::-webkit-slider-thumb { transform: scale(1.2); }
.transport { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.transport .skip { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: background .15s, transform .1s; }
.transport .skip .ico { width: 32px; height: 32px; stroke-width: 1.6; }
.transport .skip:hover { background: var(--surface-2); }
.transport .skip:active { transform: scale(.92); }
.transport .step { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.transport .step:hover { background: var(--surface-2); color: var(--text); }
.transport .step:disabled { opacity: .3; pointer-events: none; }
.transport .step .ico { width: 24px; height: 24px; }
.playbtn { width: 76px; height: 76px; border-radius: 50%; background: var(--c); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 40%, transparent); transition: transform .12s, filter .15s; flex: none; position: relative; }
.playbtn:hover { filter: brightness(1.06); } .playbtn:active { transform: scale(.95); }
.playbtn .ico { width: 32px; height: 32px; }
.playbtn.loading::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--c); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.p-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.p-tools .btn { height: 38px; font-size: 14px; padding: 0 14px; }
.p-msg { font-size: 14px; color: var(--muted); text-align: center; }
.p-msg.err { color: var(--danger); }
.p-done { display: flex; gap: 10px; align-items: center; justify-content: center; }
.upnext { display: grid; gap: 8px; margin-top: 8px; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); text-align: left; width: 100%; }
.up-row:hover { border-color: var(--pim); }
.up-row b { font-weight: 600; } .up-row small { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
@media (max-width: 859px) {
  .listen { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .p-card { position: static; padding: 18px; gap: 18px; }
  .p-title h1 { font-size: 26px; }
  .playbtn { width: 72px; height: 72px; }
  .transport .skip { width: 52px; height: 52px; }
}

/* ============================================================ reading text */
.reading { display: grid; gap: 16px; min-width: 0; }
.rd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rd-head h2 { display: flex; align-items: center; gap: 8px; }
.seg-one { height: 34px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.seg-one[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.rd-title { font-size: 22px; letter-spacing: -.02em; }
.rd-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13.5px; }
.rd-note .ico { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.rd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rd-item { display: grid; grid-template-columns: 2.4em 1fr; gap: 6px; padding: 10px 12px; border-radius: 12px; align-items: baseline; }
.rd-item.has-en { cursor: pointer; }
.rd-item:hover { background: var(--surface-2); }
.rd-n { color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; text-align: right; padding-right: 4px; }
.rd-de { font-size: 21px; line-height: 1.4; letter-spacing: -.01em; font-weight: 520; }
.rd-en { display: none; color: var(--muted); font-size: 15px; margin-top: 3px; }
.show-en .rd-en, .rd-item.open .rd-en { display: block; }
.rd-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin-left: 8px; vertical-align: middle; }
.rd-head-item { padding: 18px 12px 4px 3.2em; font-weight: 700; font-size: 15px; color: var(--accent); }
.rd-block { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.rd-block h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rd-block ul { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }
.rd-gloss { margin: 0; display: grid; gap: 4px; }
.rd-gloss div { display: flex; gap: 12px; } .rd-gloss dt { font-weight: 600; } .rd-gloss dd { margin: 0; color: var(--muted); }
@media (max-width: 859px) { .rd-de { font-size: 20px; } .rd-item { grid-template-columns: 2em 1fr; padding: 10px 6px; } }

/* ============================================================ booklet (fallback page images) */
.booklet { display: grid; gap: 14px; min-width: 0; }
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
@media (max-width: 859px) { .bk-head { top: calc(52px + env(safe-area-inset-top, 0px)); } }
.bk-head h2 { display: flex; align-items: center; gap: 8px; }
.bk-note { color: var(--muted); font-size: 13.5px; }
.bk-pages { display: grid; gap: 14px; }
.bk-page { position: relative; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), var(--shadow); margin: 0; scroll-margin-top: 64px; }
.bk-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bk-page.target { outline: 3px solid var(--accent); outline-offset: 2px; }
.bk-page .pn { position: absolute; right: 8px; bottom: 8px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; background: rgba(0, 0, 0, .6); color: #fff; }
[data-theme="dark"] .booklet.invert .bk-page img { filter: var(--page-filter); }
[data-theme="dark"] .booklet.invert .bk-page { background: #16171c; }

/* ============================================================ lingoda */
.chapter { margin-top: 26px; }
.chapter h2 { margin-bottom: 8px; }
.lesson-list { display: grid; gap: 4px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; transition: background .12s; position: relative; min-height: 52px; }
.lrow:hover { background: var(--surface-2); }
.lrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--muted)); flex: none; }
.lrow .t { flex: 1; min-width: 0; }
.lrow .t b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .t small { color: var(--k, var(--muted)); font-size: 12px; font-weight: 600; }
.lrow .st { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.lrow .st .ico { width: 17px; height: 17px; color: var(--ok); stroke-width: 2.6; }
.lrow.done .t b { color: var(--muted); }
.lrow.current { background: var(--accent-soft); }
.k-grammar { --k: #5aa0f5; } .k-vocabulary { --k: #34c997; } .k-communication { --k: #f59a4d; } .k-reading { --k: #b78af0; }
.k-speaking { --k: #f06fae; } .k-open-discussion { --k: #2cc7b8; } .k-writing { --k: #e5b82e; } .k-chapter-check, .k-level-check { --k: #f0697a; } .k-orientation { --k: #94a3b8; }
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.searchbox .input { padding-left: 42px; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mod-card { padding: 16px; display: grid; gap: 12px; --c: var(--lin); }
.mod-card .top { display: flex; align-items: baseline; gap: 8px; }
.mod-card b { font-size: 19px; letter-spacing: -.02em; } .mod-card .top span { color: var(--muted); font-size: 14px; }
.mod-card small { color: var(--muted); }
.mod-card .bar { --c: var(--lin); }

/* lesson viewer */
.viewer { position: fixed; inset: 0 0 0 var(--rail); display: flex; flex-direction: column; background: var(--bg); z-index: 15; }
body.has-mini .viewer { bottom: var(--mini); }
.v-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; border-bottom: 1px solid var(--border); flex: none; }
.v-top .title { flex: 1; min-width: 0; }
.v-top .title b { display: block; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-top .title small { color: var(--k, var(--muted)); font-weight: 600; font-size: 12px; }
.v-top .done-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: transparent; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; padding: 18px 28px 8px; }
.slide-wrap { flex: 1; min-width: 0; min-height: 0; container-type: size; display: grid; place-items: center; }
.slide { position: relative; isolation: isolate; --ar: 1.3333; width: min(100cqw, calc(100cqh * var(--ar))); aspect-ratio: var(--ar); background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.slide canvas { display: block; width: 100%; height: 100%; }
.textLayer { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: clip; line-height: 1; --scale-factor: 1; --total-scale-factor: 1; --min-font-size: 1; --text-scale-factor: 1; text-size-adjust: none; forced-color-adjust: none; caret-color: CanvasText; z-index: 1; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0 0; }
.textLayer br::selection { background: transparent; }
.textLayer ::selection { background: rgba(80, 110, 255, .35); color: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
.textLayer .markedContent { top: 0; height: 0; }
.loading, .vwerror { z-index: 2; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.vwerror { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; background: var(--surface); color: var(--muted); }
.navbtn { position: absolute; top: 50%; translate: 0 -50%; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; z-index: 5; }
.navbtn.prev { left: 8px; } .navbtn.next { right: 8px; }
.stage:hover .navbtn:not(:disabled) { opacity: .92; }
@media (hover: none) { .navbtn { display: none; } }
.controls { display: flex; align-items: center; gap: 6px; padding: 6px 16px calc(12px + var(--safe-b)); flex: none; }
.controls .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.vtrack { flex: 1; height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; position: relative; }
.vtrack::before { content: ""; position: absolute; left: 0; right: 0; height: 5px; border-radius: 99px; background: var(--surface-3); }
.vfill { position: relative; height: 5px; border-radius: 99px; background: var(--lin); width: 0; transition: width .18s var(--ease); }
.pagelabel { display: flex; align-items: center; gap: 4px; min-width: 80px; justify-content: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.pagelabel input { width: 3.4ch; text-align: right; background: var(--surface-2); border: 1px solid transparent; color: var(--text); font-weight: 600; padding: 4px; border-radius: 6px; -moz-appearance: textfield; appearance: textfield; }
.pagelabel input::-webkit-inner-spin-button, .pagelabel input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pagelabel input:focus { outline: none; border-color: var(--accent); }
.grid-overlay { position: absolute; inset: 0; z-index: 10; overflow: auto; padding: 20px 28px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-content: start; grid-auto-rows: max-content; background: color-mix(in srgb, var(--bg) 95%, transparent); backdrop-filter: blur(8px); }
.thumb { position: relative; display: block; width: 100%; aspect-ratio: var(--ar); border-radius: 8px; overflow: hidden; background: var(--surface-2); outline: 2px solid transparent; }
.thumb:hover { outline-color: var(--muted); } .thumb.current { outline-color: var(--accent); outline-width: 3px; }
.thumb canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: #fff; }
.thumb span { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; font-weight: 600; }
.viewer.is-fs .stage { padding: 0; } .viewer.is-fs .slide { border-radius: 0; box-shadow: none; }
.viewer.is-fs .v-top { display: none; }
.viewer.is-fs .controls { position: absolute; left: 0; right: 0; bottom: 0; padding-top: 30px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); opacity: 0; transition: opacity .25s; color: #fff; }
.viewer.is-fs.awake .controls, .viewer.is-fs .controls:hover { opacity: 1; }
.viewer.is-fs:not(.awake) { cursor: none; }
@media (max-width: 859px) {
  .viewer { inset: 0; }
  .stage { padding: 10px 8px 2px; }
  .controls { padding: 2px 8px calc(8px + var(--safe-b)); }
  .controls .hide-sm { display: none; }
  .v-top .done-btn span { display: none; }
  .v-top .done-btn { padding: 0 11px; }
  body.has-mini .viewer { bottom: calc(var(--mini) + 4px); }
}

/* ============================================================ settings */
.set-group { padding: 4px 18px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row b { display: block; font-weight: 600; } .set-row small { color: var(--muted); }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch[aria-checked="true"] { background: var(--accent); } .switch[aria-checked="true"]::after { transform: translateX(18px); }
.me-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.stack { display: grid; gap: 14px; }

/* ============================================================ dialog + toast */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; width: min(420px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h2 { font-size: 18px; text-transform: none; letter-spacing: -.01em; color: var(--text); }
dialog p { color: var(--muted); }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs) + var(--safe-b) + var(--mini) + 18px); translate: -50% 16px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 550; font-size: 14px; opacity: 0; pointer-events: none; transition: all .22s var(--ease); z-index: 100; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; translate: -50% 0; }
@media (min-width: 860px) { .toast { bottom: calc(var(--mini) + 24px); } }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ============================================================ library */
.row-head { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-head label.btn { cursor: pointer; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex: none; }
.spinner.sm { width: 13px; height: 13px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 50vh; }
.note-box.importing { align-items: center; margin-bottom: 18px; }
.note-box + .book-grid, .book-grid + .note-box { margin-top: 22px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; }
.book-card { display: grid; gap: 12px; align-content: start; }
.cover { position: relative; aspect-ratio: 2 / 3; border-radius: 8px 12px 12px 8px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .05) inset; transition: transform .2s var(--ease), box-shadow .2s; }
.cover::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: linear-gradient(90deg, rgba(0, 0, 0, .28), transparent); pointer-events: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.plain { display: grid; place-items: center; padding: 16px 14px 16px 20px; text-align: center; color: #fff; font: 600 15px/1.25 var(--serif);
  background: linear-gradient(150deg, hsl(var(--h) 42% 34%), hsl(calc(var(--h) + 38) 48% 20%)); }
.book-card:hover .cover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0, 0, 0, .34), 0 0 0 1px rgba(255, 255, 255, .05) inset; }
.book-card .info { display: grid; gap: 5px; }
.book-card .info b { font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .info > small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.book-card .info > small.num { display: flex; justify-content: space-between; gap: 8px; min-height: 0; }
.book-card .bar { --c: var(--book); margin-top: 3px; height: 4px; }
.empty-state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 64px 16px; color: var(--muted); }
.empty-state .ico { width: 40px; height: 40px; color: var(--faint); }
.empty-state h3 { color: var(--text); font-size: 19px; letter-spacing: -.02em; }
.empty-state .btn { margin-top: 10px; cursor: pointer; }
.dropping { outline: 2px dashed var(--accent); outline-offset: 10px; border-radius: 12px; }

.book-hero { display: grid; grid-template-columns: 170px 1fr; gap: 28px; align-items: end; margin-bottom: 34px; }
.cover.lg { box-shadow: 0 16px 40px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .05) inset; }
.book-info { display: grid; gap: 12px; align-content: end; min-width: 0; }
.book-info h1 { font-family: var(--serif); font-weight: 650; letter-spacing: -.02em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.read-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.book-info .bar { --c: var(--book); }
.vocab-card { padding: 22px; display: grid; gap: 18px; }
.cover-pct { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cover-pct b { font-size: 40px; letter-spacing: -.04em; line-height: 1; }
.cover-pct span { color: var(--muted); }
.vbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.vbar i { display: block; height: 100%; min-width: 0; }
.vbar i.k, .vlegend i.k { background: var(--ok); } .vbar i.l, .vlegend i.l { background: #f0b429; } .vbar i.n, .vlegend i.n { background: var(--accent); }
.vlegend { display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.vlegend span { display: inline-flex; align-items: center; gap: 8px; }
.vlegend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.vlegend b { color: var(--text); font-size: 17px; }
.toc-list { overflow: hidden; }
.toc-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); transition: background .15s; }
.toc-list a:last-child { border-bottom: 0; }
.toc-list a:hover { background: var(--surface-2); }
.toc-list a.cur { color: var(--book); font-weight: 650; }
.tick-sm { color: var(--ok); display: inline-flex; } .tick-sm .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.book-foot { margin-top: 36px; display: flex; justify-content: center; }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
@media (max-width: 640px) { .book-hero { grid-template-columns: 112px 1fr; gap: 16px; align-items: start; } .book-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 20px 14px; } .cover-pct b { font-size: 34px; } }

/* ============================================================ reader */
body.immersive #view { padding-top: 0; padding-bottom: 0; }
body.reading { overflow: hidden; }
.rd { --fs: 19px; position: relative; height: calc(100vh - var(--mini)); height: calc(100dvh - var(--mini)); display: flex; flex-direction: column; overflow: hidden; }
.rd-bar { flex: none; position: relative; z-index: 15; height: 56px; display: flex; align-items: center; gap: 4px; padding: 0 4px; padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box;
  background: var(--bg); border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.rd-title { flex: 1; min-width: 0; display: grid; justify-items: center; text-align: center; padding: 4px 8px; border-radius: 10px; }
.rd-title:hover { background: var(--surface-2); }
.rd-title b { font-weight: 650; font-size: 15px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rd-prog { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.rd-prog i { display: block; height: 100%; width: 0; background: var(--book); transition: width .25s; }
.rd-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.rd-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 8px; padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: content-box; color: var(--muted); font-size: 13px; }
.rd-foot .icon-btn { width: 48px; height: 44px; border-radius: 12px; }
.rd-pg { flex: 1; text-align: center; }
.rd-snack { position: absolute; left: 50%; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 16px; border-radius: 99px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 550; box-shadow: var(--shadow); white-space: nowrap; animation: sheet-in .2s var(--ease); }
.rd-snack button { height: 30px; padding: 0 12px; border-radius: 99px; background: color-mix(in srgb, var(--bg) 18%, transparent); font-weight: 650; }
.rd-snack[hidden] { display: none; }

/* pages: one CSS column per page; the reader sets width/height/left/top and slides the article sideways */
.rd-clip { position: absolute; overflow: hidden; }
.rd .bk { position: absolute; left: 0; top: 0; margin: 0; column-fill: auto; transition: transform .26s var(--ease); will-change: transform; }
.rd .bk.no-anim { transition: none; }
@media (prefers-reduced-motion: reduce) { .rd .bk { transition: none; } }
.rd .bk :where(h1, h2, h3, h4, h5, h6) { break-after: avoid; }
.rd .bk :where(img, figure, tr, blockquote) { break-inside: avoid; }
.rd .bk :where(img) { max-height: var(--ph, 80vh); object-fit: contain; }
.rd .bk :where(p) { orphans: 2; widows: 2; }
.rd .bk :where(h1:first-child, h2:first-child) { margin-top: 0; }

.bk { font-size: var(--fs); line-height: 1.72; color: var(--text); hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; font-family: var(--ff, var(--serif)); font-optical-sizing: auto; text-wrap: pretty;
  font-kerning: normal; font-variant-ligatures: common-ligatures; text-rendering: optimizeLegibility; }
.rd[data-ff="literata"], .ep[data-ff="literata"], .cs[data-ff="literata"] { --ff: "Literata", Georgia, serif; }
.rd[data-ff="source"], .ep[data-ff="source"], .cs[data-ff="source"] { --ff: "Source Serif 4", Georgia, serif; }
.rd[data-ff="atkinson"], .ep[data-ff="atkinson"], .cs[data-ff="atkinson"] { --ff: "Atkinson Hyperlegible", var(--font); }
.rd[data-ff="inter"], .ep[data-ff="inter"], .cs[data-ff="inter"] { --ff: var(--font); }
.rd[data-ff="atkinson"] .bk, .rd[data-ff="inter"] .bk { line-height: 1.68; }
.rd[data-ff="source"] .bk { font-size: calc(var(--fs) * 1.04); }
.bk :where(p) { margin: 0 0 .85em; }
.bk :where(h1) { font-size: 1.7em; line-height: 1.25; margin: 1.3em 0 .6em; text-wrap: balance; }
.bk :where(h2) { font-size: 1.4em; line-height: 1.25; margin: 1.2em 0 .5em; text-wrap: balance; }
.bk :where(h3, h4) { font-size: 1.15em; line-height: 1.3; margin: 1.1em 0 .4em; }
.bk :where(h1, h2, h3, h4, h5, h6) { font-weight: 650; }
.bk :where(img) { max-width: 100%; height: auto; }
.bk :where(blockquote) { margin: 1em 0 1em 1.2em; padding-left: 1em; border-left: 3px solid var(--border); }
.bk :where(ul, ol) { padding-left: 1.4em; }
.bk :where(table) { border-collapse: collapse; margin: 1em 0; max-width: 100%; display: block; overflow-x: auto; }
.bk :where(td, th) { padding: .3em .7em; border: 1px solid var(--border); }
.bk :where(hr) { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.bk :where(pre) { white-space: pre-wrap; font-size: .9em; }
.bk :where(a) { color: var(--accent); }
.bk .dropcap::first-letter { font-size: 3.1em; line-height: .82; float: left; padding: .05em .08em 0 0; font-weight: 600; color: var(--book); }
.bk a[data-ch] { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; cursor: pointer; }
.rd .bk a.c-footnote-anchor { float: none; margin: 0; width: auto; }

.bk w { background: var(--w-new); border-radius: 3px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background .12s; }
.bk w.k, .bk w.x { background: none; }
.bk w.l1 { background: var(--w-1); }
.bk w.sel { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
@media (hover: hover) { .bk w:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); } }
@media (pointer: coarse) { .bk { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.bk ::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }


.rd-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .42); }
.rd-sheet { position: fixed; left: var(--rail); right: 0; bottom: 0; z-index: 40; width: min(640px, 100%); margin: 0 auto; max-height: 72vh; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow); padding: 16px 18px calc(18px + var(--safe-b)); font-family: var(--font); animation: sheet-in .22s var(--ease); }
.rd-sheet[hidden] { display: none; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (max-width: 859px) { .rd-sheet { left: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sheet-head h3 { font-size: 17px; letter-spacing: -.02em; }

.lk-head { display: flex; align-items: center; gap: 4px; }
.lk-word { flex: 1; min-width: 0; display: grid; }
.lk-word b { font-size: 24px; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.lk-word small { color: var(--muted); font-size: 14px; }
.lk-meaning { display: flex; gap: 8px; margin: 10px 0 12px; }
.lk-meaning input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 17px; font-weight: 550; }
.lk-meaning input:focus { outline: none; border-color: var(--accent); }
.lk-meaning input.loading-in { animation: pulse 1s infinite; }
.lk-meaning input::placeholder { color: var(--muted); font-weight: 400; }
.lk-status { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 6px; }
.lk-ignore { margin: 8px 0 0 auto; display: block; padding: 4px 6px; background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.lk-ignore[aria-pressed="true"] { color: var(--text); }
.st { height: 44px; border-radius: 11px; border: 1.5px solid transparent; background: var(--surface-2); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: transform .1s, background .15s; }
.st:active { transform: scale(.96); }
.st .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.st-l1 { background: var(--w-1); }
.st-k { background: color-mix(in srgb, var(--ok) 16%, var(--surface-2)); color: var(--ok); }
.st[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bg) 70%, transparent) inset; }
.lk-sent { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; justify-items: start; }
.lk-sentence { font: 16px/1.55 var(--serif); color: var(--muted); }
.lk-trans { font-size: 16px; line-height: 1.55; font-weight: 500; }
.lk-trans[dir="rtl"], .lk-meaning input[dir="rtl"] { font-family: "Vazirmatn", var(--font); }

.toc-stats { color: var(--muted); font-size: 14px; margin-bottom: 8px; } .toc-stats b { color: var(--text); }
.toc-items { display: grid; margin: 0 -8px; }
.toc-items button { text-align: left; padding: 11px 10px; border-radius: 10px; }
.toc-items button:hover { background: var(--surface-2); }
.toc-items button.cur { color: var(--book); font-weight: 650; background: color-mix(in srgb, var(--book) 10%, transparent); }
.toc-details { display: block; margin-top: 10px; padding: 10px 2px 0; color: var(--accent); font-weight: 600; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.set-row > span { display: grid; font-weight: 550; flex: 1; min-width: 0; }
.set-row > :not(span) { flex: none; } .set-row small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.stepper button { width: 44px; height: 36px; border-radius: 9px; font-weight: 700; } .stepper button:hover { background: var(--surface-3); }
.stepper b { min-width: 32px; text-align: center; }
.input.sm { height: 38px; width: auto; max-width: 190px; }
.switch { width: 48px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch[aria-checked="true"] { background: var(--accent); } .switch[aria-checked="true"] i { transform: translateX(20px); }

.rd-sheet.lk { max-height: 56vh; }
.rd-sheet.lk.top { bottom: auto; top: calc(56px + env(safe-area-inset-top, 0px)); border-radius: 0 0 20px 20px; border: 1px solid var(--border); border-top: 0; animation-name: sheet-in-top; }
@keyframes sheet-in-top { from { transform: translateY(-24px); opacity: 0; } }
.font-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
.font-pick button { text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent; display: grid; gap: 2px; }
.font-pick button b { font-size: 16px; }
.font-pick button[data-font="literata"] b { font-family: "Literata", serif; } .font-pick button[data-font="source"] b { font-family: "Source Serif 4", serif; }
.font-pick button[data-font="atkinson"] b { font-family: "Atkinson Hyperlegible", sans-serif; } .font-pick button[data-font="inter"] b { font-family: var(--font); }
.font-pick button small { color: var(--muted); font-size: 12px; }
.font-pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.set-usage { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; } .set-usage b { color: var(--text); } .set-usage a { color: var(--accent); margin-left: 6px; font-weight: 600; }

/* AI usage (You page) */
.usage { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.usage-tot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.usage-tot > div { display: grid; gap: 2px; } .usage-tot b { font-size: clamp(16px, 4.6vw, 24px); letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .usage-tot span { color: var(--muted); font-size: 12.5px; }
.usage-chart { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; align-items: end; height: 64px; }
.usage-chart i { display: block; min-height: 2px; border-radius: 3px 3px 1px 1px; background: var(--book); } .usage-chart i.zero { background: var(--surface-3); }
.usage-list { display: grid; gap: 10px; font-size: 14px; } .usage-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.usage-list > div > span:first-child { min-width: 0; overflow-wrap: anywhere; display: grid; gap: 1px; } .usage-list > div > b { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.usage-list small { color: var(--muted); font-size: 12.5px; } .usage-list .usage-cur { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.usage-list .usage-cur > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.usage h4 { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }


/* ============================================================ podcasts & news */
.show-filter { margin: 4px 0 22px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; }
.show-filter::-webkit-scrollbar { display: none; }
.show-filter .seg-one { flex: none; white-space: nowrap; }
@media (min-width: 860px) { .show-filter { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } }
.ep-day { margin-bottom: 26px; }
.ep-list { overflow: hidden; }
.ep-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background .15s; }
.ep-row:last-child { border-bottom: 0; }
.ep-row:hover { background: var(--surface-2); }
.ep-art { position: relative; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--surface-3); flex: none; display: block; }
.ep-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-art i { position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px; border-radius: 6px; background: rgba(0, 0, 0, .62); color: #fff; display: grid; place-items: center; }
.ep-art i .ico { width: 12px; height: 12px; stroke-width: 2.2; }
.ep-main { display: grid; gap: 3px; min-width: 0; }
.ep-main b { font-weight: 620; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ep-main small { color: var(--muted); font-size: 12.5px; }
.ep-show { color: var(--news); font-weight: 600; }
.ep-main .bar { --c: var(--news); height: 4px; margin-top: 4px; }
.ep-end { display: flex; align-items: center; gap: 6px; }
.ep-end .chip .ico { width: 14px; height: 14px; }
a.card.ep-cont { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 24px; --c: var(--news); }
.ep-cont > .ico { width: 40px; height: 40px; padding: 11px; border-radius: 50%; background: var(--c); color: var(--accent-ink); }
.ep-cont-body { display: grid; gap: 2px; min-width: 0; }
.ep-cont-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-cont-body small { color: var(--muted); font-size: 12.5px; }
.ep-cont-body small:first-child { color: var(--c); font-weight: 650; }
.ep-foot { text-align: center; font-size: 13px; margin-top: 8px; }
@media (max-width: 520px) { .ep-row { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 12px; } .ep-art { width: 48px; height: 48px; border-radius: 10px; } .ep-end .chip:not(.ok) { display: none; } }

/* player */
.ep { --c: var(--news); --fs: 18px; position: relative; display: flex; flex-direction: column; height: calc(100vh - var(--mini)); height: calc(100dvh - var(--mini)); overflow: hidden; }
.ep-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px); gap: 24px; padding-top: 18px; }
.ep-player { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding-bottom: 20px; scrollbar-width: thin; }
.ep-stage { position: relative; flex: none; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 14px; overflow: hidden; }
.ep-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.ep-stage audio { display: none; }
.ep-cover { position: absolute; inset: 0; display: none; place-items: center; }
.ep-cover img { width: 112px; height: 112px; border-radius: 20px; object-fit: cover; box-shadow: var(--shadow); }
.ep[data-mode="audio"] .ep-stage { aspect-ratio: auto; height: 150px; background: var(--surface-2); }
.ep[data-mode="audio"] .ep-stage video { display: none; }
.ep[data-mode="audio"] .ep-cover { display: grid; }
.ep-cap { flex: none; min-height: 104px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; align-content: center; gap: 8px; text-align: center; font-family: var(--ff, var(--serif)); }
.cap-line { font-size: calc(var(--fs) * 1.15); line-height: 1.5; font-weight: 500; text-wrap: balance; font-kerning: normal; }
.cap-tr { color: var(--muted); font: calc(var(--fs) * .88)/1.45 var(--font); }
.cap-tr:empty::after { content: "…"; opacity: .5; }
.cap-hint { color: var(--faint); font: 14px/1.4 var(--font); }
.ep-ctrl { display: grid; gap: 10px; }
.ep-ctrl .seek { --c: var(--news); }
.ep-transport { justify-content: center; gap: 10px; }
.ep-transport .step { width: 50px; height: 50px; }
.ep-transport .step .ico { width: 26px; height: 26px; }
.ep-transport .step[aria-pressed="true"] { color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.ep-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ep-tools .btn { height: 36px; padding: 0 13px; font-size: 13.5px; gap: 6px; }
.ep-tools .btn .ico { width: 17px; height: 17px; }
.ep-tools .btn[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border-color: transparent; }
.ep-tools .btn[hidden] { display: none; }
.ep .playbtn { --c: var(--news); position: relative; width: 68px; height: 68px; }
.ep .playbtn .ico { width: 28px; height: 28px; }

.ep-script { position: relative; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.ep-stats { flex: none; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; padding: 2px 8px 10px 18px; color: var(--muted); font-size: 13px; min-height: 30px; }
.ep-stats b { color: var(--text); }
.ep-stats .btn { margin-left: auto; height: 28px; font-size: 12.5px; padding: 0 10px; flex: none; }
.ep-lines { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 45vh 10px; font-family: var(--ff, var(--serif)); font-kerning: normal; }
.cue { display: grid; grid-template-columns: 42px minmax(0, 1fr) 32px; gap: 4px; align-items: start; padding: 9px 4px 9px 2px; border-radius: 12px; cursor: pointer; color: color-mix(in srgb, var(--text) 80%, transparent); transition: background .15s; }
.cue:hover { background: var(--surface-2); }
.cue.on { background: color-mix(in srgb, var(--news) 11%, transparent); color: var(--text); }
.cue-t { font: 12px/1 var(--font); color: var(--faint); padding: 9px 0 0 6px; text-align: left; }
.cue.on .cue-t { color: var(--news); font-weight: 650; }
.cue-de { font-size: var(--fs); line-height: 1.6; }
.cue-tr { font: calc(var(--fs) * .85)/1.45 var(--font); color: var(--muted); margin-top: 4px; }
.cue-x { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); opacity: .55; }
.cue-x:hover, .cue.on .cue-x { opacity: 1; color: var(--text); background: var(--surface-3); }
.cue-x .ico { width: 16px; height: 16px; }
.ep-wait { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 48px 24px; color: var(--muted); font-family: var(--font); }
.ep-wait b { color: var(--text); }
.ep-wait small { max-width: 34ch; line-height: 1.5; }
.ep-follow { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; z-index: 5; background: var(--surface); box-shadow: var(--shadow); }
.ep w { background: var(--w-new); border-radius: 3px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background .12s; }
.ep w.k, .ep w.x { background: none; }
.ep w.l1 { background: var(--w-1); }
.ep w.sel { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
@media (hover: hover) { .ep w:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); } }
@media (pointer: coarse) { .ep-lines, .ep-cap { -webkit-touch-callout: none; } }

@media (max-width: 859px) {
  .ep-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; padding-top: 0; }
  .ep-player { flex: none; overflow: visible; gap: 10px; padding: 8px 12px 10px; }
  .ep-stage { aspect-ratio: auto; height: min(24dvh, 56.25vw); border-radius: 12px; }
  .ep[data-mode="audio"] .ep-stage { height: 64px; }
  .ep-cover img { width: 48px; height: 48px; border-radius: 12px; }
  .ep-cap { min-height: 78px; padding: 10px 12px; }
  .cap-line { font-size: calc(var(--fs) * 1.08); }
  .ep-transport { gap: 4px; }
  .ep .playbtn { width: 60px; height: 60px; }
  .ep-tools { gap: 6px; } .ep-tools .btn { height: 34px; padding: 0 11px; font-size: 13px; }
  .ep-tools .btn .lbl { display: none; }
  .ep-ctrl { gap: 4px; }
  .ep-stats { flex-wrap: nowrap; white-space: nowrap; padding: 0 10px 8px 16px; min-height: 0; }
  .ep-script { flex: 1; border-left: 0; border-top: 1px solid var(--border); padding-top: 8px; }
  .ep-lines { padding-bottom: 30vh; }
  .cue { grid-template-columns: 38px minmax(0, 1fr) 30px; }
}
@media (max-width: 859px) and (max-height: 700px) { .ep-stage { height: min(22dvh, 56.25vw); } .ep-cap { min-height: 66px; } }

/* ============================================================ VHS courses */
.crs-levels { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.crs-level { --c: var(--course); display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; }
.crs-badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; font-weight: 750; font-size: 17px; letter-spacing: -.02em; background: color-mix(in srgb, var(--course) 17%, transparent); color: var(--course); }
.crs-level-body { display: grid; gap: 5px; min-width: 0; }
.crs-level-body b { font-size: 17px; letter-spacing: -.01em; }
.crs-level-body small { color: var(--muted); font-size: 13px; }
.crs-level .bar, .crs-lesson .bar { --c: var(--course); height: 5px; }
a.card.ep-cont.crs-cont { --c: var(--course); grid-template-columns: 56px minmax(0, 1fr) auto; }
.crs-note { margin: -8px 0 16px; font-size: 14px; }
.crs-lessons { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.crs-lesson { --c: var(--course); display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; }
.crs-lesson-img { position: relative; width: 76px; height: 76px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--course) 14%, var(--surface-2)); }
.crs-lesson-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.crs-lesson-img b { position: relative; font-size: 24px; font-weight: 750; color: var(--course); letter-spacing: -.03em; }
.crs-lesson-img:has(img) b { color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .65); }
.crs-lesson-body { display: grid; gap: 4px; min-width: 0; }
.crs-lesson-body b { line-height: 1.25; overflow-wrap: anywhere; }
.crs-lesson-body > small:last-child { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.crs-tl { display: block; color: var(--muted); font-size: 13px; font-weight: 450; line-height: 1.35; }
.crs-save { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; margin-top: 28px; }
.crs-save > div { min-width: 0; flex: 1; }
.crs-save small { display: block; color: var(--muted); margin-top: 4px; max-width: 62ch; font-size: 13.5px; }
.crs-save .bar { --c: var(--course); margin-top: 10px; height: 5px; }

.crs-lhead { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.crs-lhead .kicker { color: var(--course); font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.crs-lprog { min-width: 190px; display: grid; gap: 6px; }
.crs-lprog b { font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.crs-lprog b span { font-size: 15px; font-weight: 500; color: var(--muted); }
.crs-lprog .bar { --c: var(--course); height: 6px; }
.crs-lbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: -8px 0 22px; }
.crs-goals { padding: 14px 18px; margin-bottom: 24px; }
.crs-goals summary { cursor: pointer; font-weight: 600; }
.crs-goal-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; margin-top: 12px; }
.crs-goal-cols ul { padding-inline-start: 18px; display: grid; gap: 6px; color: var(--muted); font-size: 14.5px; }
.crs-unit { margin-bottom: 24px; }
.crs-unit .sec-head h2 { text-transform: none; letter-spacing: -.01em; font-size: 16px; color: var(--text); font-weight: 650; }
.crs-unit .sec-head h2 .crs-tl { margin-top: 2px; }
.crs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: 10px; }
.crs-tile { position: relative; display: grid; gap: 3px; align-content: center; min-height: 74px; padding: 12px 34px 12px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s var(--ease); }
.crs-tile:hover { border-color: color-mix(in srgb, var(--course) 55%, var(--border)); transform: translateY(-1px); }
.crs-tile b { font-size: 14.5px; line-height: 1.25; }
.crs-tile small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.crs-tile.perfect { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); }
.crs-tile.done { background: color-mix(in srgb, var(--book) 9%, var(--surface)); }
.crs-tile.t-test { border-style: dashed; }
.crs-tile.t-diashow b, .crs-tile.t-film b { color: var(--course); }
.crs-state { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 4px; font-size: 11.5px; }
.crs-state .ico { width: 16px; height: 16px; color: var(--ok); }
.crs-tile.done .crs-state .ico { color: var(--book); }
.crs-state em { font-style: normal; font-weight: 650; color: var(--muted); }
.crs-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--course); }
.seg.sm button { height: 28px; padding: 0 12px; font-size: 13px; }
.crs-vocab { margin-bottom: 26px; }
.crs-voc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 13.5px; }
.crs-voc-actions > span { margin-right: auto; }
.crs-voc { max-height: 62vh; overflow: auto; padding: 4px 0; overscroll-behavior: contain; }
.crs-voc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.crs-voc-row:last-child { border-bottom: 0; }
.crs-voc-row > span:first-child { font-weight: 550; }
.crs-voc-row > span:last-child { color: var(--muted); }
.crs-voc w { border-radius: 3px; }
.crs-voc w.l1 { background: var(--w-1); }

/* the exercise player */
.cs { --c: var(--course); position: relative; display: flex; flex-direction: column; width: 100%; max-width: 980px; margin: 0 auto; height: calc(100vh - var(--mini)); height: calc(100dvh - var(--mini)); overflow: hidden; }
.cs-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px; padding: 6px 8px 2px; }
.cs-title { min-width: 0; display: grid; }
.cs-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-title small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-tools, .cs-nav { display: flex; align-items: center; }
.cs-bar .icon-btn[aria-pressed="true"] { color: var(--course); background: color-mix(in srgb, var(--course) 15%, transparent); }
.cs-bar .icon-btn[aria-disabled="true"] { opacity: .3; pointer-events: none; }
.cs-frame { position: relative; flex: 1; min-height: 0; margin: 6px 8px 8px; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.cs-frame.dk { background: #1b1b1b; }
.cs-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .2s; }
.cs-iframe.on { opacity: 1; }
.cs-frame.dk .cs-iframe { filter: var(--page-filter); }
.cs-loading { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; color: var(--muted); background: var(--surface); padding: 20px; }
.cs-loading small { display: block; margin-top: 6px; font-size: 13px; color: var(--faint); }
@media (max-width: 859px) {
  .cs { padding-top: env(safe-area-inset-top, 0px); }
  .cs-bar .icon-btn { width: 38px; height: 38px; }
  .cs-bar { padding: 4px 4px 0; gap: 0; }
  .cs-frame { margin: 4px 0 0; border-radius: 0; border-inline: 0; border-bottom: 0; }
}
.cs-pop { position: absolute; right: 10px; top: 54px; z-index: 30; width: min(370px, calc(100% - 20px)); display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.cs-pop[hidden], .cs-tutor[hidden] { display: none; }
.cs-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cs-pop-head b { display: flex; align-items: center; gap: 8px; }
.cs-pop-head .ico { width: 18px; height: 18px; color: var(--course); }
.cs-pop-head .icon-btn { width: 32px; height: 32px; margin: -4px -4px -4px 0; }
.cs-pop-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.cs-pop-stats b { display: block; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.cs-pop-stats .n b { color: var(--accent); } .cs-pop-stats .l b { color: var(--book); } .cs-pop-stats .k b { color: var(--ok); }
.cs-pop-new { font-size: 14px; line-height: 1.6; max-height: 96px; overflow: auto; color: var(--text); background: var(--w-new); padding: 8px 10px; border-radius: 10px; }
.cs-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.cs-tutor { position: absolute; z-index: 35; right: 0; top: 0; bottom: 0; width: min(410px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); }
.cs-tutor .cs-pop-head { padding: 14px 14px 8px; }
.cs-chat { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 10px; align-content: start; padding: 6px 14px 12px; }
.msg { padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; max-width: 94%; overflow-wrap: anywhere; }
.msg.me { justify-self: end; background: var(--accent-soft); }
.msg.ai { background: var(--surface-2); }
.msg p { margin: 0 0 .6em; } .msg p:last-child { margin: 0; }
.msg ul { margin: 0 0 .6em; padding-inline-start: 18px; display: grid; gap: 3px; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.cs-ask { display: flex; gap: 8px; padding: 8px 14px calc(14px + var(--safe-b)); }
.cs-ask .input { flex: 1; min-width: 0; }
@media (max-width: 859px) {
  .cs-tutor { top: auto; width: 100%; height: min(72dvh, 560px); border-left: 0; border-top: 1px solid var(--border); border-radius: 20px 20px 0 0; }
  .cs-pop { right: 8px; left: 8px; width: auto; top: calc(52px + env(safe-area-inset-top, 0px)); }
}

/* ============================================================ native exercise renderer (.xr) */
.cs-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); scrollbar-width: thin; }
.cs-frame.native { background: var(--bg); }
.xr { --xc: var(--course); font-family: var(--ff, var(--serif)); font-size: var(--fs, 18px); line-height: 1.62; color: var(--text); font-kerning: normal; hyphens: manual; overflow-wrap: break-word; }
.x-page { max-width: 780px; margin: 0 auto; padding: 22px 18px 40px; }
.xr :lang(fa), .xr :lang(ar), .xr :lang(ps), .xr :lang(ku) { font-family: "Vazirmatn", var(--font); }
.x-h1 { font: 720 clamp(24px, 4.2vw, 32px)/1.18 var(--font); letter-spacing: -.025em; margin: 4px 0 16px; text-wrap: balance; }
.x-h2 { font: 680 22px/1.25 var(--font); letter-spacing: -.02em; margin: 22px 0 10px; }
.x-p { margin: 0 0 15px; }
.x-p.ta-center { text-align: center; } .x-p.ta-right { text-align: right; }
.x-text b, .x-chip b { font-weight: 650; }
.x-list { list-style: none; margin: 0 0 16px; padding: 0; }
.x-list.tasks li { display: block; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--xc) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--xc) 22%, var(--border)); border-inline-start: 4px solid var(--xc); }
.x-list.bullets li { padding-inline-start: 1.2em; position: relative; } .x-list.bullets li::before { content: "•"; position: absolute; inset-inline-start: .3em; color: var(--xc); }
.x-h3 { font-family: var(--font); font-weight: 640; font-size: .94em; line-height: 1.5; }
.x-tr-wrap { display: block; }
.x-tr-wrap > .x-text, .x-tr-wrap > .x-h3 { display: block; }
.x-tr { display: block; margin-top: 3px; color: var(--muted); font: 450 .84em/1.55 var(--font); text-align: start; }
.x-tr > span { font: inherit; }
.x-box { display: block; max-width: var(--bw, 420px); margin: 8px 0 14px; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.x-marker { font-weight: 700; color: var(--xc); margin-inline-end: 8px; }
.x-line hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.x-clear { clear: both; }
.x-def { border-bottom: 1.5px dotted var(--xc); cursor: help; }
.x-tip { display: block; margin: 6px 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-3); font: 450 .88em/1.5 var(--font); }
.x-link, .x-extlink { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.x-icon { height: 1.2em; vertical-align: -.2em; }
.mark-yellow { background: rgba(255, 204, 51, .32); border-radius: 4px; padding: 0 3px; } .mark-green { background: rgba(60, 207, 155, .28); border-radius: 4px; padding: 0 3px; }
.mark-pink { background: rgba(255, 129, 150, .28); border-radius: 4px; padding: 0 3px; } .mark-blue { background: rgba(122, 134, 255, .26); border-radius: 4px; padding: 0 3px; }
.mark-red { color: var(--danger); } .mark-orange { color: var(--book); } .mark-bold { font-weight: 700; } .mark-italic { font-style: italic; } .mark-underlined { text-decoration: underline; } .mark-strikethrough { text-decoration: line-through; }

/* words (LingQ colours, as in the books) */
.xr w { border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.xr w.l1 { background: var(--w-1); }
.xr.show-new w:not([class]) { background: var(--w-new); }
.xr w.sel { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
@media (hover: hover) { .xr w:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); } }
.xr .x-chip w:hover, .xr .x-slot w:hover { box-shadow: none; }
.xr:not(.lookup-mode) .x-chip w, .xr:not(.lookup-mode) .x-opt-label w, .xr:not(.lookup-mode) .x-hlt w, .xr:not(.lookup-mode) .x-flash w { cursor: inherit; }

/* answers */
.x-input, .x-textarea { font: inherit; font-size: .96em; color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 1px 10px; height: 1.95em; min-width: 4.5ch; max-width: 100%; text-align: center; vertical-align: baseline; transition: border-color .15s, box-shadow .15s; }
.x-input:focus, .x-textarea:focus, .x-select select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.x-textarea-wrap { display: block; margin: 8px 0; }
.x-textarea { display: block; width: 100%; height: auto; min-height: 7.5em; text-align: start; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.x-select { position: relative; display: inline-block; vertical-align: baseline; }
.x-select select { appearance: none; -webkit-appearance: none; font: inherit; font-size: .96em; color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 1px 30px 1px 12px; height: 1.95em; max-width: 100%; cursor: pointer; }
.x-select-caret { position: absolute; inset-inline-end: 8px; top: 50%; translate: 0 -50%; pointer-events: none; color: var(--muted); display: grid; } .x-select-caret .ico { width: 15px; height: 15px; }
.x-opt { display: inline-flex; vertical-align: -.2em; margin-inline-end: 4px; }
.x-check { appearance: none; -webkit-appearance: none; width: 1.25em; height: 1.25em; margin: 0; border-radius: 7px; border: 2px solid color-mix(in srgb, var(--muted) 60%, var(--border)); background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; transition: background .12s, border-color .12s; flex: none; }
.x-check[type="radio"] { border-radius: 50%; }
.x-check::after { content: ""; width: .55em; height: .55em; border-radius: 3px; background: var(--accent-ink); transform: scale(0); transition: transform .12s; }
.x-check[type="radio"]::after { border-radius: 50%; }
.x-check:checked { background: var(--xc); border-color: var(--xc); } .x-check:checked::after { transform: scale(1); }
.x-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.x-opt-label { cursor: pointer; }
.x-hradios { display: inline-flex; gap: 14px; flex-wrap: wrap; } .x-hradio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.is-ok.x-input, .is-ok .x-select select, .is-ok.x-select, .is-ok.x-slot, .is-ok.x-textarea-wrap .x-textarea { border-color: var(--ok); }
.is-bad.x-input, .is-bad.x-select select, .is-bad.x-slot { border-color: var(--danger); }
.x-textarea-wrap.is-ok .x-textarea { border-color: var(--ok); } .x-textarea-wrap.is-bad .x-textarea { border-color: var(--danger); }
.x-opt.is-ok .x-check { border-color: var(--ok); } .x-opt.is-bad .x-check { border-color: var(--danger); }
.x-hlt.is-ok { outline: 2px solid var(--ok); outline-offset: 1px; } .x-hlt.is-bad { outline: 2px solid var(--danger); outline-offset: 1px; }
.x-mark { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; margin-inline: 5px; vertical-align: -.2em; color: #fff; flex: none; }
.x-mark .ico { width: .8em; height: .8em; stroke-width: 3; } .x-mark.ok { background: var(--ok); } .x-mark.bad { background: var(--danger); } .x-mark.neutral { background: var(--muted); }
.x-fb { display: inline-block; margin-inline: 2px 6px; padding: 1px 11px; border-radius: 10px; font: 520 .82em/1.5 var(--font); vertical-align: baseline; }
.x-fb.bad { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); } .x-fb.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.x-fb b { font-weight: 700; }
.x-blockfb { display: block; margin: 10px 0 2px; padding: 10px 14px; border-radius: 12px; font: 500 .9em/1.55 var(--font); }
.x-blockfb.is-ok { background: color-mix(in srgb, var(--ok) 13%, var(--surface)); } .x-blockfb.is-bad { background: color-mix(in srgb, var(--danger) 11%, var(--surface)); }
.x-pagefb { margin: 16px 0; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--xc) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--xc) 25%, var(--border)); font-family: var(--font); }
.x-fbscore { display: none; }

/* chips + slots */
.x-pool { display: flex; flex-wrap: wrap; gap: 9px; margin: 12px 0 18px; padding: 12px; border: 1.5px dashed var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); min-height: 58px; }
.x-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 14px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; line-height: 1.4; text-align: center; transition: border-color .12s, box-shadow .12s, transform .12s; }
.x-chip:hover { border-color: color-mix(in srgb, var(--xc) 55%, var(--border)); }
.x-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.x-chip.c-blue { background: color-mix(in srgb, #7a86ff 16%, var(--surface)); } .x-chip.c-green { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); }
.x-chip img { max-height: 4.4em; max-width: 100%; border-radius: 8px; }
.x-chip.is-selected { border-color: var(--xc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--xc) 30%, transparent); transform: translateY(-1px); }
.x-chip.is-dragging { opacity: .35; } .x-chip.is-fixed { cursor: default; background: var(--surface-2); box-shadow: none; }
.x-ghost { box-shadow: 0 14px 32px rgba(0, 0, 0, .35); transform-origin: center; opacity: .96; }
.x-slot { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; vertical-align: middle; box-sizing: border-box; min-width: var(--chip-w, 7ch); max-width: 100%; min-height: calc(var(--chip-h, 2em) + 8px); padding: 3px; border-radius: 13px; border: 2px dashed color-mix(in srgb, var(--muted) 45%, var(--border)); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.x-slot.is-filled { border-style: solid; border-color: transparent; padding: 0; background: none; }
.x-pool:empty { display: none; }
.x-slot.is-filled.is-ok, .x-slot.is-filled.is-bad { padding: 2px; }
.x-slot.is-filled.is-ok { border-color: var(--ok); } .x-slot.is-filled.is-bad { border-color: var(--danger); }
.x-slot.is-over { border-color: var(--xc); background: color-mix(in srgb, var(--xc) 12%, var(--surface)); }
.x-slot.is-ghost { opacity: 0; } .x-slot.is-readonly { cursor: default; }
.x-slot .x-chip { box-shadow: none; }
.x-slot.is-multi { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; width: min(100%, calc(var(--chip-w, 8ch) + 12px)); min-height: calc(var(--slots, 2) * (var(--chip-h, 2em) + 8px) + 8px); }
.x-slot.is-multi.l-horizontal { flex-direction: row; flex-wrap: wrap; width: min(100%, calc(var(--slots, 2) * (var(--chip-w, 8ch) * .7 + 8px) + 8px)); min-height: calc(var(--chip-h, 2em) + 12px); }
.xr.has-selection .x-slot:not(.is-readonly):not(.is-ghost) { border-color: var(--xc); animation: x-pulse 1.1s ease-in-out infinite; }
@keyframes x-pulse { 50% { background: color-mix(in srgb, var(--xc) 12%, var(--surface)); } }
.xr.is-locked .x-chip { cursor: default; } .xr.is-locked .x-slot { cursor: default; }

/* markers */
.x-hl { display: inline-flex; align-items: center; margin: 2px 4px 2px 0; padding: 3px 14px; border-radius: 999px; border: 2px solid transparent; font: 600 .86em/1.5 var(--font); color: #1b1b1b; cursor: pointer; user-select: none; }
.x-hl.hl-yellow { background: #ffd54d; } .x-hl.hl-green { background: #7fe0b8; } .x-hl.hl-pink { background: #ff9fb1; } .x-hl.hl-blue { background: #9aa4ff; }
.x-hl.hl-strikethrough { background: var(--surface-3); color: var(--text); text-decoration: line-through; }
.x-hl.is-active { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.x-hlt { border-radius: 4px; padding: 0 2px; transition: background .12s; }
.xr.is-marking .x-hlt { cursor: pointer; outline: 1px dotted color-mix(in srgb, var(--muted) 60%, transparent); outline-offset: 1px; }
.x-hlt.marked-yellow { background: rgba(255, 204, 51, .5); } .x-hlt.marked-green { background: rgba(60, 207, 155, .42); } .x-hlt.marked-pink { background: rgba(255, 129, 150, .45); } .x-hlt.marked-blue { background: rgba(122, 134, 255, .4); }
.x-hlt.marked-strikethrough { text-decoration: line-through; opacity: .7; }
.x-hlt.nudge { animation: x-nudge .4s; } @keyframes x-nudge { 25% { translate: -3px; } 75% { translate: 3px; } }

/* media, figures, tables, cards */
.x-fig { margin: 12px 0 16px; } .x-fig.align-right { text-align: end; } .x-fig.align-center { text-align: center; }
.x-fig-in { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.x-img, .x-fig video { display: block; max-width: 100%; max-height: min(52vh, 420px); width: auto; height: auto; border-radius: 14px; margin: 0 auto; }
.x-fig video { width: 100%; max-height: 60vh; background: #000; }
.x-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.x-hot { fill: transparent; stroke: var(--accent); stroke-width: 3; cursor: pointer; } .x-hot.is-hidden { stroke: none; } .x-hot:hover { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.x-area { fill: transparent; } .x-area.is-reveal { stroke: var(--ok); stroke-width: 5; fill: color-mix(in srgb, var(--ok) 18%, transparent); } .x-pin { fill: var(--danger); stroke: #fff; stroke-width: 3; }
.x-audio { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; background: color-mix(in srgb, var(--xc) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--xc) 28%, var(--border)); vertical-align: middle; font-family: var(--font); }
.x-audio-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--xc); color: var(--accent-ink); flex: none; }
.x-audio-btn .ico { width: 16px; height: 16px; } .x-audio-btn:disabled { opacity: .4; }
.x-audio-bar { width: 64px; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; } .x-audio-bar i { display: block; height: 100%; width: 0; background: var(--xc); }
.x-audio-t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 3ch; }
.x-audio.has-error { opacity: .5; }
.x-rec { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--font); }
.x-rec-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 14px; }
.x-rec-btn .ico { width: 16px; height: 16px; } .x-rec-btn.is-rec { background: var(--danger); color: #fff; border-color: transparent; animation: x-pulse2 1.2s infinite; }
@keyframes x-pulse2 { 50% { opacity: .75; } } .x-rec-hint { color: var(--muted); font-size: 13px; }
.x-table-wrap { overflow-x: auto; margin: 8px 0 16px; }
.x-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .96em; }
.x-table td { padding: 9px 12px; vertical-align: middle; border: 1px solid var(--border); text-align: start; }
.x-table.ta-center td, .x-table td.ta-center { text-align: center; } .x-table td.ta-right { text-align: right; }
.x-table.no-grid td { border-color: transparent; }
.x-table tr:first-child td:first-child { border-top-left-radius: 12px; } .x-table tr:first-child td:last-child { border-top-right-radius: 12px; }
.x-table tr:last-child td:first-child { border-bottom-left-radius: 12px; } .x-table tr:last-child td:last-child { border-bottom-right-radius: 12px; }
.x-flash { position: relative; margin: 14px 0; padding: 18px 18px 46px; border: 1.5px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); min-height: 110px; }
.x-flash[data-side="1"] { background: color-mix(in srgb, var(--xc) 8%, var(--surface)); }
.x-flip { position: absolute; inset-inline-end: 12px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 600 13px var(--font); }
.x-flip .ico { width: 15px; height: 15px; }
.x-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 10px; margin: 12px 0 18px; }
.x-pair { perspective: 700px; aspect-ratio: 4 / 3; padding: 0; background: none; cursor: pointer; }
.x-pair-in { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .38s var(--ease); }
.x-pair.is-open .x-pair-in, .x-pair.is-matched .x-pair-in { transform: rotateY(180deg); }
.x-pair-back, .x-pair-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; font-size: .92em; line-height: 1.35; }
.x-pair-back { background: color-mix(in srgb, var(--xc) 16%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--xc) 30%, var(--border)); color: var(--xc); } .x-pair-back .ico { width: 28px; height: 28px; }
.x-pair-face { background: var(--surface); border: 1.5px solid var(--border); transform: rotateY(180deg); overflow: auto; }
.x-pair.is-matched .x-pair-face { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.x-help { margin: 10px 0 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--font); }
.x-help summary { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-weight: 600; font-size: 14px; color: var(--muted); list-style: none; } .x-help summary::-webkit-details-marker { display: none; }
.x-help summary .ico { width: 17px; height: 17px; color: var(--book); } .x-help-body { padding: 4px 16px 14px; font-size: .92em; }
.x-overview { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.x-overview li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.x-overview li.lv1 { margin-inline-start: 14px; } .x-ov-score { color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--font); }
.x-empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* footer: check, score, next */
.x-foot { position: sticky; bottom: 0; z-index: 4; display: grid; gap: 10px; margin: 26px -18px 0; padding: 18px 18px calc(16px + var(--safe-b)); background: linear-gradient(to bottom, transparent, var(--bg) 26%); font-family: var(--font); }
.x-foot-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; } .x-foot-row .btn { height: 46px; padding: 0 22px; font-size: 15.5px; }
.x-foot-row .btn .ico { width: 18px; height: 18px; margin-inline-start: 6px; }
.x-score { flex: 1 1 160px; display: flex; align-items: center; gap: 12px; min-width: 150px; padding: 0 16px; height: 46px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.x-score b { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; } .x-score b small { font-size: 14px; font-weight: 500; color: var(--muted); }
.x-score-bar { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; } .x-score-bar i { display: block; height: 100%; border-radius: inherit; background: var(--danger); transition: width .5s var(--ease); }
.x-score-good .x-score-bar i { background: var(--book); } .x-score-perfect .x-score-bar i { background: var(--ok); } .x-score-perfect b { color: var(--ok); }
/* steps of a multi-page exercise */
.x-steps { display: flex; gap: 6px; padding: 14px 18px 0; max-width: 780px; margin: 0 auto; flex-wrap: wrap; font-family: var(--font); }
.x-step { min-width: 30px; height: 30px; padding: 0 9px; border-radius: 999px; display: inline-grid; place-items: center; font: 650 13px var(--font); background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.x-step.on { background: var(--xc, var(--course)); color: var(--accent-ink); border-color: transparent; } .x-step.done { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); border-color: transparent; }
@media (max-width: 859px) { .x-page { padding: 16px 14px 30px; } .x-foot { margin-inline: -14px; padding-inline: 14px; } .x-foot-row .btn { flex: 1; } }
.cs-opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.cs-opt-row .seg { flex-wrap: wrap; }
.cs-note { font-size: 12.5px; margin: 0; }

/* flashcards (word lists) */
.pr { --c: var(--course); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; min-height: calc(100dvh - var(--mini)); padding: 8px 14px calc(18px + var(--safe-b)); }
.pr-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; padding-top: env(safe-area-inset-top, 0px); }
.pr-bar .icon-btn[aria-pressed="true"] { color: var(--course); background: color-mix(in srgb, var(--course) 15%, transparent); }
.pr-title { display: grid; } .pr-title small { color: var(--muted); font-size: 12px; }
.pr-progress { display: flex; align-items: center; gap: 12px; margin: 14px 4px 4px; color: var(--muted); font-size: 12.5px; } .pr-progress .bar { --c: var(--course); flex: 1; height: 5px; }
.pr-stage { position: relative; flex: 1; display: grid; place-items: center; padding: 14px 0; min-height: 300px; }
.pr-card { width: 100%; min-height: 260px; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 28px 22px; border-radius: 24px; background: var(--surface); border: 1.5px solid var(--border); box-shadow: 0 10px 32px rgba(0, 0, 0, .12); text-align: center; cursor: pointer; transition: transform .2s var(--ease), background .2s; }
.pr-card.is-flipped { background: color-mix(in srgb, var(--course) 7%, var(--surface)); }
.pr-card:active { transform: scale(.992); }
.pr-face { font-size: clamp(24px, 6vw, 32px); line-height: 1.3; font-weight: 600; letter-spacing: -.01em; font-family: var(--ff, var(--serif)); text-wrap: balance; }
.pr-face .pr-tr { font-family: var(--font); font-weight: 560; }
.pr-back { font-size: clamp(22px, 5.5vw, 28px); font-weight: 520; }
.pr-sep { width: 56px; height: 3px; border-radius: 2px; background: var(--border); }
.pr-hint { color: var(--faint); font-size: 13px; }
.pr-face .sep { color: var(--muted); }
.art { font-weight: 650; border-radius: 6px; padding: 0 5px; margin-inline-end: 2px; }
.art-der { color: #5b8cff; background: rgba(91, 140, 255, .14); } .art-die { color: #ff6b8b; background: rgba(255, 107, 139, .14); } .art-das { color: #2fc58f; background: rgba(47, 197, 143, .14); }
.pr-say { position: absolute; inset-inline-end: 8px; top: 24px; background: var(--surface-2); }
.pr-rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; opacity: .45; transition: opacity .2s; } .pr-rate.on { opacity: 1; }
.pr-rate .btn { height: 52px; font-size: 16px; position: relative; } .pr-rate kbd { position: absolute; top: 5px; inset-inline-end: 8px; font: 600 10px var(--font); opacity: .5; }
.pr-done { flex: 1; display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; padding: 30px 0; }
.pr-done h2 { font-size: 26px; text-transform: none; letter-spacing: -.02em; color: var(--text); display: flex; align-items: center; gap: 10px; } .pr-done h2 .ico { color: var(--ok); width: 28px; height: 28px; }
.pr-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ============================================================ Anki */
/* in the lookup sheet */
.lk-anki { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; margin-top: 12px; }
.lk-anki-l { min-width: 0; flex: 1; display: flex; }
.lk-in { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-in .ico { width: 14px; height: 14px; stroke-width: 2.6; } .lk-in.dim { background: var(--surface-2); color: var(--muted); font-weight: 550; }
.lk-ph { grid-template-columns: 1fr 1fr; flex: 1 1 100%; order: 3; }

/* the sheet */
html.ak-open { overflow: hidden; }
.ak-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0); display: grid; align-items: end; justify-items: center; transition: background .2s; }
.ak-scrim.in { background: rgba(0, 0, 0, .55); }
.ak { width: min(560px, 100%); max-height: min(92dvh, 760px); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  transform: translateY(24px); opacity: 0; transition: transform .25s var(--ease), opacity .2s; outline: none; padding-bottom: env(safe-area-inset-bottom, 0px); }
.ak-scrim.in .ak { transform: none; opacity: 1; }
@media (min-width: 700px) { .ak-scrim { align-items: center; } .ak { border-bottom: 1px solid var(--border); border-radius: 20px; } }
.ak-head { display: flex; align-items: center; gap: 10px; padding: 14px 8px 6px 18px; }
.ak-head h3 { font-size: 18px; letter-spacing: -.01em; } .ak-head small { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ak-head .icon-btn { margin-left: auto; }
.ak-cats { display: flex; margin: 4px 18px 6px; } .ak-cats button { flex: 1; padding: 0 6px; }
.ak-body { padding: 8px 18px 14px; overflow: auto; overscroll-behavior: contain; display: grid; gap: 12px; align-content: start; min-height: 120px; }
.ak-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 18px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ak-foot:empty { display: none; }
.ak-foot .btn.primary { flex: 1 1 140px; max-width: 260px; }
.ak-load, .ak-empty, .ak-done { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 26px 8px; } .ak-load small { color: var(--muted); font-family: var(--serif); font-size: 17px; }
.ak-empty b, .ak-done b { font-size: 18px; } .ak-empty p, .ak-done p { color: var(--muted); max-width: 40ch; } .ak-done small { color: var(--muted); max-width: 42ch; }
.ak-done b { font-family: var(--serif); font-size: 24px; }
.ak-tick { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); } .ak-tick .ico { width: 26px; height: 26px; stroke-width: 2.6; }
.ak-card { display: grid; gap: 8px; }
.ak-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .ak-title b { font: 650 26px/1.2 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.ak-gram { color: var(--muted); font: 15px/1.5 var(--serif); }
.ak-lbl { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.ak-in { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 17px; font-weight: 550; min-width: 0; }
.ak-in:focus { outline: none; border-color: var(--accent); } .ak-in[dir="rtl"], .ak-exs [dir="rtl"] { font-family: "Vazirmatn", var(--font); }
.ak-lit { display: grid; gap: 2px; font: 16px/1.5 var(--serif); } .ak-lit small { font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ak-ctx { font: 16px/1.55 var(--serif); padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-inline-start: 3px solid var(--accent); } .ak-ctx b { color: var(--accent); font-weight: 700; }
.ak-ex-btn { display: inline-flex; align-items: center; gap: 6px; justify-self: start; color: var(--muted); font-weight: 600; font-size: 14px; padding: 4px 2px; } .ak-ex-btn .ico { width: 16px; height: 16px; transition: transform .2s; } .ak-ex-btn[aria-expanded="true"] .ico { transform: rotate(180deg); }
.ak-exs { display: grid; gap: 10px; } .ak-exs p { font: 16px/1.5 var(--serif); } .ak-exs span { display: block; color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.ak-dup { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, #e5a50a 12%, var(--surface)); border: 1px solid color-mix(in srgb, #e5a50a 35%, var(--border)); font-size: 14.5px; }
.ak-dup b { display: flex; align-items: center; gap: 6px; } .ak-dup b .ico { width: 16px; height: 16px; color: var(--ok); stroke-width: 2.6; } .ak-dup .btn { justify-self: start; height: auto; min-height: 34px; padding: 6px 12px; white-space: normal; text-align: left; }
.ak-warn, .ak-note { color: #d9a00a; font-size: 14px; }
.ak-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13.5px; } .ak-meta .ico { width: 16px; height: 16px; } .ak-meta b { color: var(--text); font-weight: 600; font-family: var(--serif); }
.ak-toks { display: grid; gap: 6px; } .ak-toks small { color: var(--muted); font-size: 12.5px; }
.ak-sent { font: 17px/2 var(--serif); }
.ak-tok { font: inherit; padding: 2px 4px; margin: 0 -1px; border-radius: 6px; background: none; color: inherit; border: 1px dashed transparent; }
.ak-tok:hover { background: var(--surface-2); } .ak-tok[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ak-toks .btn { justify-self: start; }
.ak-ask { font-weight: 600; } .ak-opts { display: grid; gap: 8px; }
.ak-opt { text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font: 16px/1.4 var(--serif); } .ak-opt:hover { border-color: var(--accent); }
.ak-other summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; padding: 4px 0; } .ak-other .ak-opts { margin-top: 8px; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }

/* settings */
.ak-login { display: grid; gap: 12px; padding: 4px 18px 18px; } .ak-login .btn { justify-self: start; min-width: 140px; }
.ak-set .row { display: flex; gap: 8px; align-items: center; }
.ak-guard { margin: 6px 0 12px; padding: 14px; border-radius: 12px; background: color-mix(in srgb, #e5a50a 12%, var(--surface)); border: 1px solid color-mix(in srgb, #e5a50a 35%, var(--border)); display: grid; gap: 8px; } .ak-guard p { color: var(--muted); font-size: 14px; }
.ak-set .ak-note { padding: 0 0 12px; }

/* the You page on a phone: a row's text takes the width that is left, controls wrap below it instead of pushing the page wider */
.set-group .set-row { flex-wrap: wrap; }
.set-group .set-row > div:first-child { flex: 1 1 140px; min-width: 0; }
.stack > * { min-width: 0; }
.set-colors { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; max-width: 100%; }
.set-colors .swatches { justify-content: flex-start; }

/* ============================================================ PDF books: the page as designed, words on top */
.cover-tag { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .66); color: #fff; font: 700 10px/1.5 var(--font); letter-spacing: .06em; font-style: normal; z-index: 1; }
.pdf-stage { overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; background: var(--surface-2); scrollbar-gutter: stable both-edges; outline: none; }
.pdf-pad { display: flex; width: max-content; min-width: 100%; min-height: 100%; box-sizing: border-box; }
.pdf-sheet { position: relative; flex: none; margin: auto; background: #fff; border-radius: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .18); isolation: isolate; line-height: 1; }
.pdf-sheet[hidden] { display: none; }
.pdf-sheet canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-sheet canvas.pdf-tile { inset: auto; }
.pdf-sheet.pdf-night { background: #15171c; }
.pdf-sheet.pdf-night canvas { filter: invert(.9) hue-rotate(180deg); }
/* the word layer: invisible text, so taps, selection and the tint all land exactly on the printed words */
.pdf-words { position: absolute; inset: 0; mix-blend-mode: multiply; }
.pdf-night .pdf-words { mix-blend-mode: normal; }
.pdf-words w { position: absolute; display: block; overflow: hidden; white-space: nowrap; color: transparent; line-height: 1.18; border-radius: .14em; cursor: pointer; background: var(--w-new); transition: background .12s; }
.pdf-words w:empty { cursor: pointer; }
.pdf-words w.k, .pdf-words w.x { background: none; }
.pdf-words w.l1 { background: var(--w-1); }
.nohl .pdf-words w:not(.l1) { background: none; }
.pdf-words w.ps { background: color-mix(in srgb, var(--accent) 34%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); }
.pdf-words w.sel { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
.pdf-words ::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); color: transparent; }
@media (hover: hover) { .pdf-words w:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); } }
@media (pointer: coarse) { .pdf-words { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.pdf-spin { position: absolute; left: 50%; top: 18px; margin-left: -11px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 3; }
.pdf-spin.on { opacity: 1; }
.pdf-err { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); text-align: center; padding: 24px; }
.pdf-err[hidden] { display: none; }
.pdf-zoom { flex: 1; display: flex; align-items: center; justify-content: center; gap: 2px; }
.pdf-zoom button { height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; color: var(--text); font-size: 20px; font-weight: 600; }
.pdf-zoom button:hover { background: var(--surface-2); }
.pdf-zoom .rd-pg { flex: 0 1 auto; min-width: 84px; font-size: 14px; font-weight: 600; color: var(--muted); }
.pdf-goto { display: flex; align-items: end; gap: 10px; margin: 6px 0 12px; }
.pdf-goto label { flex: 1; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.pdf-goto input { width: 100%; height: 44px; font-size: 16px; }
.toc-items button { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.toc-items button small { color: var(--muted); }
.rd.pdf { contain: inline-size; min-width: 0; }   /* a zoomed page scrolls inside the stage; it must never widen the app */
.font-pick.three { grid-template-columns: repeat(3, 1fr); } .font-pick.three small { font-size: 11px; line-height: 1.3; }

/* a selected phrase: a slim chip above the footer instead of the full sheet (nothing is translated until you ask) */
.rd-sheet.lk.compact { bottom: calc(64px + var(--safe-b)); border: 1px solid var(--border); border-radius: 16px; padding: 8px 10px; max-height: none; width: min(620px, calc(100% - 16px)); }
.lk-mini { display: flex; align-items: center; gap: 8px; }
.lk-mini-t { flex: 1; min-width: 0; font: 15px/1.35 var(--serif); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lk-mini .btn { flex: none; }
.lk-mini .btn .ico { width: 15px; height: 15px; }

/* Mark a whole level / module / chapter / lesson as done */
.mark-btn { color: var(--muted); }
.mark-btn.solid { color: var(--text); border-color: var(--border); background: var(--surface); }
.mark-row { display: flex; justify-content: flex-start; margin-top: 8px; }
.mark-row.top { margin: -4px 0 14px; }
.card-wrap { display: grid; gap: 2px; align-content: start; min-width: 0; }
.card-wrap > .mark-row { margin: 0; justify-content: flex-end; }
.sec-tools { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.chapter > .sec-head { margin-bottom: 8px; }
.chapter > .sec-head h2 { margin: 0; }

/* ============================================================ install bar (phones) */
#install-bar { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(var(--tabs) + var(--safe-b) + var(--mini) + 10px); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
#install-bar img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
#install-bar div { flex: 1; min-width: 0; display: grid; gap: 2px; }
#install-bar b { font-size: 14px; }
#install-bar small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
@media (min-width: 860px) { #install-bar { display: none; } }
