/* VocabCatcher web app: the extension's look, built for phones first. */
:root {
  --bg: #070b1f;
  --bg-2: #0d1433;
  --surface: #121b3d;
  --surface-2: #182552;
  --ink: #f5f7ff;
  --soft: #c4cae2;
  --muted: #8e9abf;
  --line: rgba(145, 164, 224, .16);
  --line-strong: rgba(103, 232, 249, .36);
  --cyan: #35d9f1;
  --cyan-hover: #62e6f8;
  --on-cyan: #04161f;
  --teal: #2de2b7;
  --violet: #8b5cf6;
  --warn: #ffc96b;
  --danger: #ff7a8a;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --arabic: "IBM Plex Sans Arabic", Tahoma, sans-serif;
  --nav-h: 64px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100dvh; color: var(--ink); font: 16px/1.5 var(--body);
  background: radial-gradient(900px 520px at 10% -12%, rgba(53, 217, 241, .13), transparent 60%), radial-gradient(800px 520px at 95% -6%, rgba(139, 92, 246, .17), transparent 60%), var(--bg); background-attachment: fixed; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
[dir="auto"], .tr { font-family: var(--body), var(--arabic); unicode-bidi: plaintext; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; text-decoration: none; transition: background .15s ease, border-color .15s ease; }
.btn-primary { background: var(--cyan); color: var(--on-cyan); }
.btn { white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary:hover { background: var(--cyan-hover); }
.btn-ghost { background: rgba(255, 255, 255, .04); border-color: rgba(145, 164, 224, .28); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(53, 217, 241, .08); }
.btn-danger { background: rgba(255, 122, 138, .12); border-color: rgba(255, 122, 138, .4); color: #ffb3bd; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--soft); }
.icon-btn:hover { background: rgba(145, 164, 224, .12); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.on { color: var(--warn); }

/* Sign-in and empty states */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); padding: 36px 28px 28px; border-radius: 22px; background: rgba(18, 27, 61, .78); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); text-align: center; backdrop-filter: blur(12px); }
.gate-card img { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px; display: block; }
.gate-card h1 { margin: 0 0 8px; font: 800 28px/1.15 var(--display); letter-spacing: -0.02em; }
.gate-card p { margin: 0 0 22px; color: var(--soft); }
.gate-card .fine { margin: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.gate-card .fine a { color: var(--cyan); }
.google-btn { width: 100%; min-height: 50px; gap: 12px; background: #fff; color: #1f1f1f; border-radius: 12px; border: 0; font-weight: 600; font-size: 16px; }
.google-btn:hover { background: #f1f3f8; }
.google-btn svg { width: 20px; height: 20px; }
.steps-list { text-align: start; margin: 0 0 22px; padding-inline-start: 20px; color: var(--soft); }
.steps-list li + li { margin-top: 6px; }
.error-note { margin: 14px 0 0; color: #ffb3bd; font-size: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(145, 164, 224, .2); border-top-color: var(--cyan); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* App shell */
.app { width: min(820px, 100%); margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; margin: 0 -16px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(7, 11, 31, .78); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand b { font: 700 18px/1 var(--display); }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.topbar .spacer { flex: 1; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font-weight: 700; overflow: hidden; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.add-top { display: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(18, 27, 61, .6); }
.stat { border: 0; background: transparent; padding: 12px 6px; text-align: center; color: var(--ink); }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat b { display: block; font: 800 24px/1.1 var(--display); }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.due span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); margin-inline-end: 6px; vertical-align: 1px; }
.stat[aria-current="page"] { background: rgba(53, 217, 241, .1); }

/* Tabs: a bottom bar on phones, a segmented control on wider screens */
.tabs { position: fixed; z-index: 20; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(9, 14, 36, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { color: var(--cyan); }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--teal); color: #032a20; font-size: 11px; font-weight: 800; line-height: 18px; }
.fab { position: fixed; z-index: 21; right: 18px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--cyan); color: var(--on-cyan); box-shadow: 0 12px 30px rgba(53, 217, 241, .35); display: grid; place-items: center; }
.fab svg { width: 26px; height: 26px; }
#app[hidden] ~ #fab, body[data-screen="review"] #fab, body[data-screen="board"] #fab, body[data-screen="explore"] #fab { display: none; } /* only inside the app, and not over the grade buttons */

/* Words list */
.toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.search { position: relative; }
.search svg { position: absolute; inset-inline-start: 13px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; min-height: 46px; padding: 0 14px 0 42px; border-radius: 12px; border: 1px solid var(--line); background: rgba(18, 27, 61, .7); color: var(--ink); }
.search input:focus { outline: none; border-color: var(--line-strong); }
.filters { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--soft); font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: rgba(53, 217, 241, .14); border-color: var(--line-strong); color: var(--cyan); }
.filters select { flex: none; width: 116px; margin-inline-start: auto; min-height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--soft); }
.count { margin: 2px 2px 10px; color: var(--muted); font-size: 13.5px; }
.list { display: grid; gap: 10px; }
.card { border: 1px solid var(--line); border-radius: 16px; background: rgba(18, 27, 61, .72); overflow: hidden; }
.card.open { border-color: var(--line-strong); }
.card-main { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 14px 10px 16px; border: 0; background: transparent; text-align: start; color: inherit; }
.card-word { font: 700 18px/1.3 var(--body); overflow-wrap: anywhere; }
.card-tr { font: 600 16px/1.4 var(--arabic); color: var(--soft); text-align: end; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; gap: 10px; padding: 0 8px 8px 16px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(145, 164, 224, .28); }
.dots i.on { background: var(--teal); }
.when { font-size: 13px; color: var(--muted); }
.when.due { color: var(--teal); font-weight: 600; }
.card-meta .actions { margin-inline-start: auto; display: flex; }
.card-body { padding: 4px 16px 16px; border-top: 1px dashed var(--line); }
.label { display: inline-block; margin: 12px 0 6px; padding: 3px 9px; border-radius: 6px; background: rgba(53, 217, 241, .12); color: var(--cyan); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.context { margin: 0; color: var(--soft); font-style: italic; border-inline-start: 2px solid var(--cyan); padding-inline-start: 10px; }
.context mark { background: none; color: var(--cyan); font-weight: 700; }
.context-link { display: inline-block; margin-top: 6px; color: var(--cyan); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.note-area { width: 100%; min-height: 76px; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); resize: vertical; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.more-btn { width: 100%; margin-top: 12px; }

/* Review */
.review { padding: 26px 18px 20px; border-radius: 20px; border: 1px solid var(--line); background: rgba(18, 27, 61, .78); text-align: center; }
.review .eyebrow { color: var(--teal); font-size: 12.5px; font-weight: 800; letter-spacing: .12em; }
.review h2 { margin: 12px 0 10px; font: 800 clamp(34px, 9vw, 46px)/1.1 var(--display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.say-row { display: flex; justify-content: center; gap: 10px; }
.say-row .icon-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.review .cue { margin: 18px 0 0; text-align: start; }
.reveal { width: 100%; margin-top: 22px; min-height: 52px; border-radius: 14px; border: 1px dashed var(--line-strong); background: transparent; color: var(--cyan); font-weight: 700; font-size: 16px; }
.answer-tr { margin: 22px 0 6px; font: 700 26px/1.4 var(--arabic); }
.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.grade { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; justify-content: center; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--ink); }
.grade b { font-size: 15px; }
.grade small { font-size: 12.5px; color: var(--muted); }
.grade.again b { color: var(--warn); }
.grade.good { border-color: var(--line-strong); }
.grade:hover { background: rgba(53, 217, 241, .1); }
.know { width: 100%; margin-top: 10px; min-height: 46px; border-radius: 12px; border: 1px solid rgba(45, 226, 183, .45); background: rgba(45, 226, 183, .08); color: var(--teal); font-weight: 700; }
.keys { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.empty { padding: 36px 20px; border: 1px dashed var(--line); border-radius: 18px; text-align: center; color: var(--soft); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }

/* Leaderboard */
.av { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--surface-2); color: #fff; font-weight: 800; font-size: 16px; border: 1px solid rgba(255, 255, 255, .12); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.lg { width: 58px; height: 58px; font-size: 22px; border: 2px solid var(--line-strong); }
.me { padding: 18px; border-radius: 20px; border: 1px solid var(--line-strong); background: radial-gradient(120% 100% at 0% 0%, rgba(53, 217, 241, .14), transparent 55%), radial-gradient(120% 100% at 100% 100%, rgba(139, 92, 246, .18), transparent 55%), rgba(18, 27, 61, .85); }
.me-head { display: flex; align-items: center; gap: 14px; }
.me-id { display: grid; gap: 4px; min-width: 0; }
.me-id b { font: 800 20px/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-btn { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font: inherit; }
.lv-btn:hover { background: rgba(45, 226, 183, .24); }
.lv-caret { font-size: 11px; transition: transform .15s ease; }
.lv-btn.open .lv-caret { transform: rotate(180deg); }
.lv-chip { justify-self: start; padding: 3px 10px; border-radius: 999px; background: rgba(45, 226, 183, .14); color: var(--teal); font-size: 12.5px; font-weight: 700; }
.me-rank { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font: 800 22px/1 var(--display); }
.me-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 14px; }
.me-stats div { padding: 10px 6px; border-radius: 12px; background: rgba(7, 11, 31, .45); text-align: center; }
.me-stats b { display: block; font: 800 20px/1.2 var(--display); }
.me-stats span { font-size: 12px; color: var(--muted); }
.lv-bar { height: 8px; border-radius: 8px; background: rgba(145, 164, 224, .18); overflow: hidden; }
.lv-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--cyan), var(--teal)); }
.lv-next { margin: 8px 0 0; color: var(--soft); font-size: 13.5px; }
.join { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 16px; border-radius: 16px; border: 1px dashed var(--line-strong); background: rgba(53, 217, 241, .05); }
.join b { display: block; font-size: 16px; }
.join p { margin: 2px 0 0; color: var(--soft); font-size: 13.5px; }
.join .btn { flex: none; }
.board-title { margin: 24px 2px 10px; font: 800 20px/1.2 var(--display); }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 34px 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(18, 27, 61, .7); }
.row.top { background: rgba(24, 37, 82, .8); }
.row.mine { border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--cyan); }
.rank { display: grid; place-items: center; font: 800 16px/1 var(--display); color: var(--muted); }
.cup svg { width: 26px; height: 26px; display: block; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .4)); }
.me-rank .cup svg { width: 28px; height: 28px; }
.who { display: grid; min-width: 0; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small, .score small { color: var(--muted); font-size: 12px; }
.score { display: grid; text-align: end; }
.score b { font: 800 16px/1.2 var(--display); color: var(--cyan); }
.board-note { margin: 16px 2px 8px; color: var(--muted); font-size: 13px; }
.leave { margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; color: var(--soft); }
.check input { width: 20px; height: 20px; accent-color: var(--cyan); }
@media (max-width: 420px) { .score small { display: none; } .join { flex-direction: column; align-items: stretch; } }

/* Motivation card (website only) */
.motivate { display: grid; gap: 10px; margin-bottom: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(53, 217, 241, .09), rgba(139, 92, 246, .1)); }
.mot-main { display: grid; gap: 3px; }
.mot-main b { font-size: 15.5px; }
.mot-main span { color: var(--soft); font-size: 14px; }
.mot-main .mot-next { color: var(--teal); font-weight: 600; font-size: 13.5px; }
.tip { border-top: 1px dashed var(--line); padding-top: 8px; }
.tip summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.tip summary::-webkit-details-marker { display: none; }
.tip summary::after { content: "+"; margin-inline-start: auto; color: var(--cyan); font-size: 18px; }
.tip[open] summary::after { content: "–"; }
.tip-label { padding: 2px 8px; border-radius: 6px; background: rgba(139, 92, 246, .2); color: #c9b8ff; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.tip p { margin: 8px 0 0; color: var(--soft); font-size: 14px; }

/* Word details, stages */
.body-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.strength { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); font-weight: 600; }
.review-stage { display: flex; justify-content: center; margin: -2px 0 12px; }
.details-block { margin-top: 4px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; color: var(--muted); font-size: 13.5px; }
.meta-line .ipa { color: var(--soft); }
.meta-line .lvl { color: var(--teal); }
.meta-line .pos { color: var(--warn); font-weight: 600; }
.def { margin: 0; color: var(--ink); }
.example { margin: 0; color: var(--soft); font-style: italic; }
.syn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.syn-chip { padding: 3px 10px; border-radius: 999px; background: rgba(145, 164, 224, .12); color: var(--soft); font-size: 13px; }
.loading-line, .muted-line { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; }
.review .details-block { text-align: start; margin: 4px auto 0; max-width: 560px; }
.recall { margin: 22px 0 0; color: var(--soft); }
.recall + .reveal { margin-top: 10px; }
.know-lock { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; }
.how { margin-top: 12px; }
.how summary { cursor: pointer; color: var(--cyan); font-weight: 600; font-size: 14px; }
.how ul { margin: 8px 0; padding-inline-start: 18px; color: var(--soft); font-size: 13.5px; }
.how ul b { color: var(--teal); }
.how p { margin: 0; color: var(--muted); font-size: 13px; }
.me-rank { flex-direction: column; align-items: flex-end; gap: 0; }
.me-rank small { color: var(--muted); font-size: 12px; font-family: var(--body); font-weight: 600; }
@media (max-width: 520px) { .me-stats { grid-template-columns: repeat(2, 1fr); } }

/* Tabs: short names on phones */
.t-short { display: inline; } .t-long { display: none; }
@media (min-width: 720px) { .t-short { display: none; } .t-long { display: inline; } }
.tab { font-size: 11.5px; }

/* Streak progress for today */
.day-bar { height: 6px; margin: 6px 0 2px; border-radius: 6px; background: rgba(145, 164, 224, .18); overflow: hidden; }
.day-bar i { display: block; height: 100%; background: linear-gradient(90deg, #fbbf24, #ff7a8a); border-radius: 6px; }

/* Levels list */
.levels { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.levels li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.levels li.done { color: var(--soft); }
.levels li.done .lvl-n { background: rgba(45, 226, 183, .18); color: var(--teal); }
.levels li.here { background: rgba(53, 217, 241, .12); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-strong); }
.levels li.here .lvl-n { background: var(--cyan); color: var(--on-cyan); }
.lvl-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(145, 164, 224, .14); font-size: 12px; font-weight: 800; }
.lvl-min { font-variant-numeric: tabular-nums; }

/* Period switch */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 24px 2px 10px; }
.board-head .board-title { margin: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: rgba(18, 27, 61, .7); }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: rgba(53, 217, 241, .15); color: var(--cyan); }

/* Celebration */
.celebrate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(3, 6, 18, .6); backdrop-filter: blur(3px); }
.cel-card { width: min(380px, 100%); padding: 28px 24px 22px; border-radius: 22px; text-align: center; background: radial-gradient(120% 100% at 50% 0%, rgba(53, 217, 241, .18), transparent 60%), var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1); }
.cel-emoji { font-size: 56px; line-height: 1; margin-bottom: 10px; animation: bounce 1s ease-in-out infinite alternate; }
.cel-card h3 { margin: 0 0 8px; font: 800 26px/1.2 var(--display); }
.cel-card p { margin: 0 0 18px; color: var(--soft); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { to { transform: translateY(-6px) scale(1.06); } }
.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; width: 100vw; height: 100vh; }

/* Memory tip pop-up */
.tip-pop { position: fixed; z-index: 40; right: 16px; top: calc(68px + env(safe-area-inset-top)); width: min(360px, calc(100% - 32px)); padding: 14px 44px 14px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(18, 27, 61, .96)); border: 1px solid rgba(139, 92, 246, .5); box-shadow: 0 18px 40px rgba(0, 0, 0, .45); animation: rise .3s ease-out; }
.tip-pop b { display: block; margin: 6px 0 4px; }
.tip-pop p { margin: 0; color: var(--soft); font-size: 14px; }
.tip-pop .tip-close { position: absolute; top: 6px; right: 6px; font-size: 22px; }
@media (min-width: 720px) { .tip-pop { top: 76px; } }

/* Settings */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--cyan); }
.range-val { min-width: 44px; text-align: end; color: var(--soft); font-variant-numeric: tabular-nums; }
.setting-check { align-items: flex-start; margin: 4px 0 14px; }
.setting-check span { display: grid; }
.setting-check small { color: var(--muted); }
.row-end.start { justify-content: flex-start; margin: -4px 0 14px; }
.row-end.center { justify-content: center; }
.link-btn { border: 0; background: none; color: var(--cyan); font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Explore */
.map-card { padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: rgba(18, 27, 61, .75); margin-bottom: 14px; }
.map-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.map-head .label { margin-top: 0; }
.map-head .band { display: block; font: 800 24px/1.2 var(--display); }
.map-head small { color: var(--muted); font-size: 12.5px; }
.cefr-map { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 130px; margin-top: 12px; }
.cefr { display: grid; grid-template-rows: auto 1fr auto; align-items: end; height: 100%; text-align: center; gap: 4px; }
.cefr-n { font-size: 12px; color: var(--muted); }
.cefr-bar { height: 100%; display: flex; align-items: flex-end; }
.cefr-bar i { width: 100%; border-radius: 8px 8px 3px 3px; background: rgba(145, 164, 224, .35); }
.cefr.my-band .cefr-bar i { background: linear-gradient(180deg, var(--cyan), var(--teal)); }
.cefr b { font-size: 13px; color: var(--soft); }
.cefr.my-band b { color: var(--cyan); }
.explore-card .def.big { font-size: 17px; margin: 14px auto 0; max-width: 520px; }
.meta-line.center { justify-content: center; }
.explore-actions { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin-top: 20px; }
.explore-actions .know-btn { border-color: rgba(45, 226, 183, .45); color: var(--teal); }

/* Line tools: listen / translate */
.line-head { display: flex; align-items: center; gap: 8px; }
.line-head.center { justify-content: center; }
.line-head .label { margin-inline-end: 2px; }
.line-tools { display: inline-flex; gap: 4px; margin-top: 6px; }
.mini-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--soft); }
.mini-btn:hover { color: var(--cyan); border-color: var(--line-strong); }
.mini-btn svg { width: 15px; height: 15px; }
.line-tr { margin: 4px 0 0; padding: 6px 10px; border-radius: 8px; background: rgba(53, 217, 241, .08); color: var(--ink); font-family: var(--body), var(--arabic); }
.explore-tr { margin: -2px 0 10px; font: 700 20px/1.4 var(--arabic); color: var(--soft); min-height: 1.4em; }
/* “New” words */
.new-chip { display: inline-block; margin-inline-start: 8px; padding: 2px 7px; border-radius: 6px; background: linear-gradient(135deg, #fbbf24, #ff9f5a); color: #2b1600; font: 800 10.5px/1.4 var(--body); letter-spacing: .06em; vertical-align: 3px; }
.review h2 .new-chip { font-size: 11px; vertical-align: 10px; margin-inline-start: 10px; }
.mot-main .hl { padding: 1px 8px; border-radius: 7px; background: rgba(53, 217, 241, .16); color: var(--cyan); white-space: nowrap; }
.mot-main .hl.time { background: rgba(251, 191, 36, .16); color: #fbbf24; }
.hint.inline { margin: 0; flex: 1; align-self: center; }

/* Six tabs on wide screens; on phones Archive is reached from the “Archived” count */
@media (max-width: 719px) { .tab[data-desktop-only] { display: none; } }
@media (min-width: 720px) { .tabs { grid-template-columns: repeat(6, auto); justify-content: space-between; } .tab { white-space: nowrap; padding: 0 10px; font-size: 14px; gap: 7px; } }

/* ───────── Media ───────── */
.media.dragging .drop { border-color: var(--cyan); background: rgba(53, 217, 241, .08); }
.drop { display: grid; justify-items: center; gap: 8px; padding: 42px 20px; border: 2px dashed var(--line-strong); border-radius: 22px; text-align: center; cursor: pointer; background: rgba(18, 27, 61, .6); }
.drop:hover, .drop:focus-visible { border-color: var(--cyan); background: rgba(53, 217, 241, .06); }
.drop-icon svg { width: 54px; height: 54px; color: var(--cyan); }
.drop b { font: 800 20px/1.3 var(--display); }
.drop span { color: var(--soft); max-width: 46ch; }
.recent-title { margin: 24px 2px 10px; font: 700 17px/1.2 var(--display); }
.recent { display: grid; gap: 8px; }
.recent-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(18, 27, 61, .7); }
.recent-item b { display: block; overflow-wrap: anywhere; }
.recent-item small { color: var(--muted); }
.recent-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.recent-actions .btn { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.media-player .mstatus { margin: 10px 2px 0; color: var(--soft); font-size: 14px; }
.mtools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mtools .btn { min-height: 40px; font-size: 14.5px; }
.mkeys { margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; }

.mstage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 16px; overflow: hidden; user-select: none; -webkit-user-select: none; outline: none; container-type: inline-size; }
.mstage.is-full, .mstage:fullscreen { border-radius: 0; aspect-ratio: auto !important; width: 100vw !important; height: 100vh !important; max-width: none; }
.mstage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Always something drawn over the video (almost invisible). Without it, when no caption is on screen, Chrome hands a
   full-screen video to the graphics card as a separate layer and stops repainting what appears over it: the controls
   then showed only when a caption changed, and they flickered when switching between the two modes. */
.mstage::after { content: ""; position: absolute; inset: 0; z-index: 2; background: rgba(0, 0, 0, .012); pointer-events: none; }
/* Captions: English (clickable) above, translation below; they rise above the controls when the controls show */
.mcap { position: absolute; left: 12px; right: 12px; bottom: var(--mcap-bottom, 8%); z-index: 3; display: flex; justify-content: center; align-items: center; gap: 10px; transition: bottom .2s ease; pointer-events: none; }
.mcap > * { pointer-events: auto; }
.mcap-lines { max-width: 86%; } /* wide and balanced: one English line, the translation under it */
.mcap-lines { padding: .35em 1em .45em; border-radius: 8px; background: rgba(8, 10, 22, var(--mcap-bg, .6)); text-align: center; font-size: clamp(14px, 1.45cqw, 26px); }
.mcap-en { color: var(--mcap-en, #fff); font: var(--mcap-weight, 700) 1em/1.45 var(--mcap-font, var(--body)); opacity: var(--mcap-alpha, 1); text-shadow: 0 1px 3px rgba(0, 0, 0, .85); }
.mcap-tr { margin-top: .15em; color: var(--mcap-trc, #fde047); font: var(--mcap-weight, 700) .92em/1.5 var(--arabic); opacity: var(--mcap-alpha, 1); text-shadow: 0 1px 3px rgba(0, 0, 0, .85); transition: filter .2s ease; }
.mcap-tr.pending { opacity: .55; }
.mstage[data-tr="blur"] .mcap-tr { filter: blur(var(--mcap-blur, 6px)); }
.mstage[data-tr="blur"] .mcap-lines:hover .mcap-tr, .mstage[data-tr="blur"] .mcap-tr:active { filter: none; }
.mstage[data-tr="hide"] .mcap-tr { display: none; }
.mstage[data-size="s"] .mcap-lines { font-size: clamp(13px, 1.2cqw, 22px); }
.mstage[data-size="l"] .mcap-lines { font-size: clamp(16px, 1.8cqw, 32px); }
.mstage[data-size="xl"] .mcap-lines { font-size: clamp(18px, 2.2cqw, 40px); }
.mw { cursor: pointer; border-radius: .3em; padding: 0 .12em; margin: 0 -.12em; transition: background .12s ease, box-shadow .12s ease; }
.mw:hover, .mw:focus-visible { background: rgba(96, 165, 250, .22); box-shadow: inset 0 0 0 1.5px rgba(191, 219, 254, .75); outline: none; }
.mw.sel { background: rgba(59, 130, 246, .35); box-shadow: inset 0 0 0 2px rgba(219, 234, 254, .95); }
.mw.mine { text-decoration: underline 3px rgba(253, 224, 71, .95); text-underline-offset: 6px; text-decoration-skip-ink: none; }
.mw.due { text-decoration: underline 3px rgba(251, 146, 60, .98); text-underline-offset: 6px; text-decoration-skip-ink: none; }
.mcap-navs { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.mcap-nav, .mcap-drag { position: absolute; left: -100px; top: 0; border: 0; color: #fff; opacity: 0; pointer-events: none; transition: opacity .15s ease, background .15s ease; }
.mcap-nav { width: 40px; height: 40px; border-radius: 50%; background: rgba(8, 10, 22, .72); font-size: 22px; }
.mcap-drag { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(8, 10, 22, .6); cursor: ns-resize; touch-action: none; }
.mcap-drag svg { width: 16px; height: 16px; }
.mcap-drag:hover { background: rgba(53, 217, 241, .35); }
/* only while pointing at the caption */
.mstage.navs-ready.cap-hover .mcap-nav, .mstage.navs-ready.cap-hover .mcap-drag { opacity: 1; pointer-events: auto; }
.mstage.cap-dragging .mcap, .mstage.cap-dragging .mcap-navs * { transition: none; }
.mstage.cap-dragging .mcap-lines { box-shadow: 0 0 0 2px rgba(53, 217, 241, .6); }
/* sound descriptions, when shown: dimmed, with an ear */
.sdh { color: rgba(255, 255, 255, .55); font-style: italic; font-weight: 500; }
.sdh-ear { font-style: normal; margin-inline-end: .2em; font-size: .85em; }
.mcap-nav:hover { background: rgba(53, 217, 241, .35); }
/* hide the cursor with the controls, like YouTube */
.mstage.playing.idle:not(.show-ui) { cursor: none; }
/* Controls */
.mctrl { position: absolute; inset-inline: 0; bottom: 0; z-index: 4; padding: 26px 12px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.mstage.show-ui .mctrl { opacity: 1; pointer-events: auto; }
.mprog { position: relative; height: 14px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.mprog-rail, .mprog-played { position: absolute; left: 0; height: 4px; border-radius: 2px; transition: height .1s ease; }
.mprog-rail { right: 0; background: rgba(255, 255, 255, .3); }
.mprog-played { background: #ff2d4b; }
.mprog:hover .mprog-rail, .mprog:hover .mprog-played { height: 6px; }
.mprog-knob { position: absolute; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: #ff2d4b; transform: scale(0); transition: transform .1s ease; }
.mprog:hover .mprog-knob, .mprog:focus-visible .mprog-knob { transform: scale(1); }
.mprog-tip { position: absolute; bottom: 18px; translate: -50% 0; padding: 3px 7px; border-radius: 6px; background: rgba(0, 0, 0, .85); color: #fff; font-size: 12px; white-space: nowrap; }
.mrow { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; }
.mgroup { display: flex; align-items: center; gap: 2px; min-width: 0; }
.mbtn { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: #fff; }
.mbtn:hover { background: rgba(255, 255, 255, .12); }
.mbtn .ic svg { width: 24px; height: 24px; display: block; }
.mbtn.text { font: 700 14px/1 var(--body); }
.mbtn.on { box-shadow: inset 0 -3px 0 #ff2d4b; }
.mbtn.blurred { color: #fde047; }
.mvol { width: 76px; accent-color: #fff; }
.mtime { margin-inline-start: 6px; color: #fff; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mhint { position: absolute; top: 50%; left: 50%; translate: -50% calc(-50% + 70px); z-index: 6; padding: 8px 16px; border-radius: 999px; background: rgba(0, 0, 0, .66); color: #fff; font-weight: 700; pointer-events: none; white-space: nowrap; }
/* play / pause: a large icon in the centre that swells and fades, like YouTube */
.mbig { position: absolute; top: 50%; left: 50%; z-index: 6; display: grid; place-items: center; width: clamp(64px, 7cqw, 96px); height: clamp(64px, 7cqw, 96px); margin: calc(clamp(64px, 7cqw, 96px) / -2) 0 0 calc(clamp(64px, 7cqw, 96px) / -2); border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; pointer-events: none; }
.mbig svg { width: 46%; height: 46%; display: block; }
.mbig.show { animation: big-pop .6s ease-out; }
@keyframes big-pop { 0% { opacity: .95; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.35); } }
/* Word bubble: the extension's look on YouTube (compact, translucent) */
.mbubble { position: absolute; z-index: 7; width: max-content; min-width: 240px; max-width: min(380px, calc(100% - 16px)); padding: 5px 7px 8px 6px; border-radius: 14px; font-size: 12.5px; color: #f4f7ff; text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  /* the extension's glass on YouTube: translucent tint, strong blur and saturation, a hairline border */
  background: rgba(18, 22, 34, .5); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 8px 24px rgba(0, 0, 0, .26);
  -webkit-backdrop-filter: blur(20px) saturate(1.7); backdrop-filter: blur(20px) saturate(1.7); transform-origin: var(--arrow, 50%) 100%; }
.mbubble:not([hidden]) { animation: lens-in .16s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes lens-in { from { opacity: 0; transform: translateY(5px) scale(.92); } to { opacity: 1; transform: none; } }
.mb-arrow { position: absolute; left: var(--arrow, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: rgba(18, 22, 34, .5); border-right: 1px solid rgba(255, 255, 255, .1); border-bottom: 1px solid rgba(255, 255, 255, .1); border-radius: 0 0 3px 0; transform: rotate(45deg); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.mb-row { display: flex; align-items: center; gap: 2px; min-height: 40px; }
.mb-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border: 0; border-radius: 9px; background: transparent; color: rgba(226, 232, 248, .72); }
.mb-ic:hover { background: rgba(255, 255, 255, .1); color: #f4f7ff; }
.mb-ic svg { width: 17px; height: 17px; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.mb-word { margin: 0 6px 0 4px; color: #4fe3f7; font-size: 17px; font-weight: 800; text-decoration: underline 1.5px rgba(79, 227, 247, .5); text-underline-offset: 4px; }
.mb-tr { flex: 1 1 auto; font: 700 16px/1.3 var(--arabic); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 3em; } /* the meaning takes the room that is left */
.mbubble.open { width: min(360px, calc(100% - 16px)); }
.mb-close { margin-inline-start: auto; }
.mb-row .mb-save { margin-inline-start: auto; }
.mb-tr { margin-inline-end: 6px; }
.mb-more { display: none; margin-top: 6px; }
.mbubble.open .mb-more { display: block; }
.mb-toggle svg { transition: transform .15s ease; transform: rotate(180deg); }
.mbubble.open .mb-toggle svg { transform: none; }
.mbubble .mb-phrase { margin: 6px 0 0; }
.mbubble.open .mb-phrase { margin-bottom: 0; }
.mb-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 3px 2px 7px; }
.mb-level { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .7); font-size: 11.5px; min-height: 16px; }
.mb-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.mb-bars i { width: 2.5px; border-radius: 1px; background: rgba(255, 255, 255, .25); }
.mb-bars i:nth-child(1) { height: 3px; } .mb-bars i:nth-child(2) { height: 5px; } .mb-bars i:nth-child(3) { height: 8px; } .mb-bars i:nth-child(4) { height: 10px; }
.mb-bars.b1 i:nth-child(-n+1), .mb-bars.b2 i:nth-child(-n+2), .mb-bars.b3 i:nth-child(-n+3), .mb-bars.b4 i:nth-child(-n+4) { background: #35d9f1; }
.mb-save { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1.3px solid rgba(63, 240, 191, .75); background: rgba(63, 240, 191, .08); color: #3ff0bf; font-weight: 700; font-size: 12.5px; }
.mb-save .ic svg { width: 11px; height: 11px; display: block; }
.mb-save.saved { border-color: transparent; background: #3ff0bf; color: #032018; text-shadow: none; }
.mb-save.saved svg { fill: currentColor; }
.mb-phrase { display: flex; align-items: center; gap: 6px; width: 100%; margin: -2px 0 7px; padding: 4px 10px; border-radius: 999px; border: 1px dashed rgba(53, 217, 241, .45); background: transparent; color: #fff; font-size: 12.5px; }
.mb-phrase b { color: var(--cyan); }
.mb-phrase small { font-size: 9.5px; opacity: .7; letter-spacing: .06em; }
.mb-phrase span { margin-inline-start: auto; opacity: .7; }
.mb-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mb-tab { min-height: 26px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: rgba(255, 255, 255, .6); font-weight: 700; font-size: 11.5px; }
.mb-tab.on { background: rgba(255, 255, 255, .1); border-color: rgba(191, 219, 254, .5); color: #fff; }
.mb-tab sup { margin-inline-start: 2px; font-size: 9px; color: rgba(255, 255, 255, .55); }
.mb-body { margin-top: 7px; min-height: 26px; }
.mb-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-bottom: 4px; }
.mb-chip { padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .12); font: 700 13px/1.5 var(--arabic); }
.mb-pos { padding: 2px 7px; border-radius: 6px; background: rgba(59, 130, 246, .3); color: #a9c9ff; font-weight: 800; font-size: 11px; align-self: center; }
.mb-line { display: flex; align-items: flex-start; gap: 4px; }
.mb-def, .mb-ex { margin: 0; flex: 1; color: rgba(255, 255, 255, .85); line-height: 1.45; font-size: 12.5px; }
.mb-ex { font-style: italic; }
.mb-tools { display: inline-flex; gap: 1px; }
.mb-line-tr { margin: 5px 0 0; padding: 5px 8px; border-radius: 6px; background: rgba(53, 217, 241, .1); font-family: var(--body), var(--arabic); font-size: 12.5px; }
.mb-muted { margin: 0; color: rgba(255, 255, 255, .6); font-size: 12px; }
/* Subtitles online */
.os-box { margin-top: 12px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(18, 27, 61, .75); }
.os-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 8px; }
.os-head > b { font-size: 16px; }
.os-head .seg button { white-space: nowrap; }
.os-close { margin-inline-start: auto; }
.os-list { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.os-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(7, 11, 31, .45); border: 1px solid transparent; }
.os-item.best { border-color: rgba(45, 226, 183, .5); }
.os-item b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.os-item small { color: var(--muted); }
.os-item.best small { color: var(--teal); }
.os-item .btn { min-height: 36px; flex: none; }
.os-key { margin: 8px 0 0; font-size: 13px; }
.os-box .hint a { color: var(--cyan); }
/* Title of what is playing */
.now { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; min-width: 0; }
.now .label { margin: 0; flex: none; }
.now-title { font: 700 17px/1.3 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtitle { position: absolute; inset-inline: 0; top: 0; z-index: 4; padding: 14px 18px 30px; background: linear-gradient(rgba(0, 0, 0, .7), transparent); color: #fff; font: 700 clamp(14px, 1.5cqw, 22px)/1.3 var(--display); text-shadow: 0 1px 3px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .2s ease; pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mstage.show-ui .mtitle, .mstage.is-full.show-ui .mtitle { opacity: 1; }
.mtools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mtools .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
/* Settings menus */
.prow { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent; color: #fff; text-align: start; font-size: 14px; }
.prow:hover { background: rgba(255, 255, 255, .08); }
.prow small { color: var(--muted); font-size: 12.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow b { color: var(--muted); font-size: 18px; }
.pback { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px -4px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: #fff; font-weight: 700; font-size: 15px; }
.pback:hover { background: rgba(255, 255, 255, .08); }
.pback b { font-size: 20px; line-height: 1; }
.pseg.wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pseg.wrap button { min-width: 0; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset { width: 100%; margin-top: 8px; min-height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: var(--soft); font-weight: 600; }
.preset:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }
.phint { margin: 0; color: var(--muted); font-size: 12.5px; }
/* Resume after a reload */
.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line-strong); background: rgba(53, 217, 241, .08); }
.resume b { display: block; }
.resume small { color: var(--soft); }
/* Panels */
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); }
.swatch.on { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(53, 217, 241, .35); }
.mpanel { position: absolute; right: 12px; bottom: 64px; z-index: 8; width: min(330px, calc(100% - 24px)); max-height: calc(100% - 80px); overflow: auto; padding: 14px; border-radius: 14px; background: rgba(20, 24, 44, .97); border: 1px solid rgba(255, 255, 255, .12); color: #fff; }
.panel-title { display: block; margin-bottom: 10px; font-size: 15px; }
.panel-close { position: absolute; top: 8px; right: 8px; }
.speed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.speed-grid button, .pseg button { min-height: 34px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: transparent; color: #fff; font-weight: 600; }
.speed-grid button.on, .pseg button.on { background: rgba(53, 217, 241, .2); border-color: var(--cyan); color: var(--cyan); }
.pset { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13.5px; color: var(--soft); }
.pseg { display: flex; gap: 4px; flex-wrap: wrap; }
.pseg button { flex: 1; min-width: 42px; padding: 0 8px; }
.pset input[type=range] { accent-color: var(--cyan); }
.pcheck { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.pcheck input { width: 18px; height: 18px; accent-color: var(--cyan); }
@media (max-width: 600px) {
  .mstage { border-radius: 12px; }
  .mcap-lines { max-width: 94%; }
  .mcap-lines { padding: 6px 10px 7px; }
  .mcap-navs { display: none; }
  .mvol, .mbtn[aria-label^="Back 10"], .mbtn[aria-label^="Forward 10"] { display: none; }
  .mbtn { min-width: 34px; height: 36px; padding: 0 4px; }
  .mtime { font-size: 12px; }
  .mctrl { padding: 14px 6px 2px; }
  .mrow { margin-top: 0; }
  .mstage.show-ui .mcap-tr { display: none; } /* small screen: while the controls show, keep only the English line */
}

/* Sheets (dialogs): bottom sheet on phones, centred on desktop */
dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); max-height: 92dvh; }
dialog.sheet::backdrop { background: rgba(3, 6, 18, .66); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-inner { padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); }
.grabber { width: 42px; height: 5px; border-radius: 3px; background: rgba(145, 164, 224, .35); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 14px; font: 700 20px/1.3 var(--display); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13.5px; color: var(--soft); font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--line-strong); }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; }
.actions-list { display: grid; gap: 8px; }
.actions-list .btn { width: 100%; justify-content: flex-start; }
.hint { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }

.toast { position: fixed; z-index: 50; left: 50%; top: auto; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); translate: -50% 0; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: #1d2a5c; border: 1px solid var(--line-strong); color: var(--ink); font-size: 14.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }

/* Wider screens */
@media (min-width: 720px) {
  .app { padding-bottom: 60px; }
  .tabs { position: static; height: auto; margin: 0 0 16px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(18, 27, 61, .6); }
  .tab { flex-direction: row; min-height: 42px; border-radius: 10px; font-size: 14.5px; gap: 8px; }
  .tab svg { width: 18px; height: 18px; }
  .tab[aria-selected="true"] { background: rgba(53, 217, 241, .12); }
  .badge { position: static; }
  .fab { display: none; }
  .add-top { display: inline-flex; }
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .card-tr { max-width: 40ch; }
  dialog.sheet { width: min(520px, 100% - 32px); margin: auto; border-radius: 20px; }
  .grabber { display: none; }
  .sheet-inner { padding: 22px 24px 24px; }
}

/* ═════════════ 6.9 ═════════════ */

/* Today: three tiles (what is waiting · the streak · the level) instead of three sentences */
.today { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.today > :where(.today-go, .today-streak, .today-level) { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(18, 27, 61, .62); color: var(--ink); text-align: start; }
.today-txt { display: grid; gap: 1px; min-width: 0; }
.today-txt b { font-size: 15px; line-height: 1.25; }
.today-txt small { color: var(--soft); font-size: 12.5px; line-height: 1.3; }
.today-go { border-color: var(--line-strong); background: linear-gradient(135deg, rgba(53, 217, 241, .16), rgba(45, 226, 183, .07)); }
button.today-go:hover { border-color: var(--cyan); }
.today-go small { color: #fbbf24; font-weight: 600; }
.today-go.clear { border-color: rgba(45, 226, 183, .35); background: rgba(45, 226, 183, .07); }
.today-go.clear small { color: var(--soft); font-weight: 400; }
.today-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: rgba(53, 217, 241, .14); color: var(--cyan); }
.today-go.clear .today-ic { background: rgba(45, 226, 183, .14); color: var(--teal); }
.today-ic svg { width: 20px; height: 20px; }
.today-arrow { margin-inline-start: auto; color: var(--cyan); font-size: 24px; line-height: 1; }
.flame { display: inline-flex; align-items: baseline; gap: 3px; flex: none; }
.flame > span { font-size: 20px; }
.flame b { font: 800 26px/1 var(--display); }
.today-streak .day-bar { margin: 5px 0 0; width: 100%; }
.today-streak.done small { color: var(--teal); font-weight: 600; }
.today-streak:has(.week) { flex-wrap: wrap; row-gap: 8px; }
.week { display: flex; justify-content: space-between; gap: 4px; flex: 1 0 100%; max-width: 190px; margin: 0; padding: 0; list-style: none; cursor: help; }
.week li { display: grid; justify-items: center; gap: 6px; }
.week i { width: 9px; height: 9px; border-radius: 50%; background: rgba(145, 164, 224, .22); }
.week li.on i { background: #ff9f5a; }
.week li.is-today i { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px #ff9f5a; }
.week span { color: var(--muted); font-size: 9.5px; line-height: 1; font-weight: 600; }
.week li.is-today span { color: #ff9f5a; }
.today-level { cursor: pointer; }
.today-level:hover { border-color: var(--line-strong); }
.today-level .today-txt b { color: var(--teal); }
.ring { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--p, 0) * 360deg), rgba(145, 164, 224, .2) 0); }
.ring b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); font: 800 15px/1 var(--display); }
.today button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 719px) {
  .today { grid-template-columns: 1fr 1fr; gap: 8px; }
  .today-go { grid-column: 1 / -1; }
  .today > :where(.today-go, .today-streak, .today-level) { padding: 10px 12px; gap: 10px; }
  .flame b { font-size: 22px; }
  .ring { width: 34px; height: 34px; } .ring b { width: 27px; height: 27px; font-size: 13px; }
}

/* Review: progress through today's pile, one status line under the word */
.session { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.session-bar { flex: 1; height: 4px; border-radius: 4px; background: rgba(145, 164, 224, .18); overflow: hidden; }
.session-bar i { display: block; height: 100%; border-radius: 4px; background: var(--teal); }
.stage-new { display: inline-block; padding: 3px 12px; border-radius: 999px; border: 1px solid rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .12); color: #fbbf24; font-size: 13px; font-weight: 700; }
@media (hover: none) { .kbd-only { display: none; } }

/* Account button: a ring that fills toward the next level, the level on a badge, its name beside it */
.review { scroll-margin-top: calc(72px + env(safe-area-inset-top)); }
/* Phones, meaning shown: the grade buttons stay pinned just above the tab bar while the definition scrolls under them */
@media (max-width: 719px) {
  body[data-screen="review"] #view { min-height: calc(100dvh + 40px); } /* room to bring the card to the top even when the page is short */
  .review.revealed { padding-top: 16px; }
  .review.revealed .session { display: none; }
  .review.revealed h2 { margin: 2px 0 6px; font-size: clamp(28px, 8vw, 38px); }
  .review.revealed .review-stage { margin-bottom: 6px; }
  .review.revealed .say-row .icon-btn { width: 40px; height: 40px; }
  .review.revealed .answer-tr { margin: 12px 0 4px; font-size: 23px; }
  .review.revealed .grades { position: sticky; z-index: 5; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); margin: 14px -10px 0; padding: 8px; border-radius: 16px; background: rgba(18, 27, 61, .96); border: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(3, 6, 18, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .review.revealed .grade { min-height: 54px; }
}
.rank-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(45, 226, 183, .35); background: rgba(45, 226, 183, .1); color: var(--teal); font-size: 13px; font-weight: 700; }
.rank-chip:hover { border-color: var(--teal); }
.avatar.has-lv { position: relative; width: 44px; height: 44px; padding: 3px; border: 0; overflow: visible; background: conic-gradient(var(--teal) calc(var(--p, 0) * 360deg), rgba(145, 164, 224, .22) 0); }
.avatar-pic { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--surface-2); }
.avatar.has-lv .avatar-pic { border: 2px solid var(--bg); }
.avatar-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lv { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px; border: 2px solid var(--bg); background: var(--teal); color: #03211a; font: 800 11px/1 var(--body); }
.avatar:focus-visible, .rank-chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
@media (max-width: 480px) { .rank-chip { display: none; } }

/* Word bubble: the meaning sits next to the word, Save keeps its distance at the end of the row */
.mb-tr { flex: 0 1 auto; margin-inline: 2px 14px; }

/* Caption settings: groups, in-place controls, a pinned live preview */
.mpanel[data-kind="settings"] { width: min(360px, calc(100% - 24px)); padding-top: 12px; overscroll-behavior: contain; }
.mpanel[data-kind="settings"] .panel-title { margin-bottom: 8px; }
.ppreview { position: sticky; top: -12px; z-index: 1; margin: 0 -14px 4px; padding: 12px 14px; background: linear-gradient(160deg, #2b2218, #0b0a0f); border-block: 1px solid rgba(255, 255, 255, .08); text-align: center; }
.ppv-lines { display: inline-block; max-width: 100%; padding: .3em .8em .4em; border-radius: 7px; background: rgba(8, 10, 22, var(--mcap-bg, .6)); font-size: 16px; }
.ppv-en { color: var(--mcap-en, #fff); font: var(--mcap-weight, 700) 1em/1.4 var(--mcap-font, var(--body)); opacity: var(--mcap-alpha, 1); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ppv-tr { color: var(--mcap-trc, #fde047); font: var(--mcap-weight, 700) .92em/1.45 var(--arabic); opacity: var(--mcap-alpha, 1); }
.mstage[data-size="s"] .ppv-lines { font-size: 14px; } .mstage[data-size="l"] .ppv-lines { font-size: 18.5px; } .mstage[data-size="xl"] .ppv-lines { font-size: 21px; }
.mstage[data-tr="blur"] .ppv-tr { filter: blur(var(--mcap-blur, 6px)); }
.mstage[data-tr="hide"] .ppv-tr { display: none; }
.psec { padding: 12px 0 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.ppreview + .psec { border-top: 0; }
.psec h4 { margin: 0 0 10px; color: var(--cyan); font-size: 13px; font-weight: 700; }
.psec .pset { margin-bottom: 12px; }
.pset-label { color: var(--soft); }
.pset-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pset output { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.pset input[type=range] { width: 100%; }
.pswitch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-size: 14px; color: #fff; cursor: pointer; }
.pswitch-txt { display: grid; gap: 1px; }
.pswitch-txt small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.pswitch input { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 38px; height: 22px; margin: 0; border-radius: 999px; background: rgba(255, 255, 255, .18); cursor: pointer; transition: background .15s ease; }
.pswitch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.pswitch input:checked { background: var(--teal); }
.pswitch input:checked::after { transform: translateX(16px); }
.pswitch input:focus-visible, .pseg button:focus-visible, .pstep button:focus-visible, .swatch:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pstep { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pstep button { min-height: 32px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: transparent; color: #fff; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.pstep button:hover, .pseg button:hover { background: rgba(255, 255, 255, .08); }
.pstep .zero { color: var(--muted); }
.psec .phint { margin: -4px 0 10px; }
.psec .pseg.wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Transcript beside the picture */
.mstage { --tx-w: min(360px, 42%); }
.mtx-handle { position: absolute; top: 50%; right: 0; z-index: 6; display: grid; place-items: center; width: 30px; height: 68px; margin-top: -34px; border: 1px solid rgba(255, 255, 255, .14); border-right: 0; border-radius: 12px 0 0 12px; background: rgba(12, 16, 32, .72); color: #fff; opacity: 0; pointer-events: none; transform: translateX(8px); transition: opacity .15s ease, transform .15s ease; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mtx-handle .ic svg { width: 18px; height: 18px; display: block; }
.mtx-handle:hover { background: rgba(53, 217, 241, .3); }
.mstage.tx-near .mtx-handle, .mtx-handle:focus-visible { opacity: 1; pointer-events: auto; transform: none; }
@media (hover: none) { .mstage.show-ui .mtx-handle { opacity: 1; pointer-events: auto; transform: none; } } /* touch screens have no pointer to come near */
.mstage.tx-open .mtx-handle { opacity: 0; pointer-events: none; }
.mtx { position: absolute; top: 0; right: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; width: var(--tx-w); background: rgba(9, 12, 28, .9); border-left: 1px solid rgba(255, 255, 255, .1); color: #fff; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
.mtx.open { transform: none; visibility: visible; transition: transform .22s ease; }
.mtx-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.mtx-head b { flex: 1; font-size: 15px; }
.mtx-head .mb-ic { font-size: 20px; }
.mtx-spoil { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.mtx-spoil input { width: 15px; height: 15px; accent-color: var(--cyan); }
.mtx-list { position: relative; flex: 1; margin: 0; padding: 8px 8px 90px; overflow-y: auto; list-style: none; overscroll-behavior: contain; scrollbar-width: thin; }
.mtx-item button { display: grid; grid-template-columns: 50px 1fr; gap: 0 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: start; font-size: 14px; line-height: 1.45; }
.mtx-item time { grid-row: span 2; padding-top: 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mtx-tr { color: var(--muted); font: 500 13px/1.45 var(--arabic); }
.mtx-tr:empty { display: none; }
.mtx-item.past button { color: #c8cfe8; }
.mtx-item.past button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.mtx-item.now button { background: rgba(53, 217, 241, .14); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.mtx-item.now time { color: var(--cyan); }
.mtx-item.now .mtx-tr { color: var(--soft); }
.mtx:not(.show-future) .mtx-item.future button { cursor: default; }
.mtx:not(.show-future) .mtx-item.future .mtx-en, .mtx:not(.show-future) .mtx-item.future .mtx-tr { filter: blur(5px); opacity: .6; user-select: none; }
.mtx-item button:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.mtx-empty { padding: 20px 10px; color: var(--muted); font-size: 14px; }
.mtx-follow { position: absolute; left: 50%; bottom: 16px; translate: -50% 10px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--cyan); color: var(--on-cyan); font-weight: 700; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .15s ease, translate .15s ease; }
.mtx-follow.show { opacity: 1; pointer-events: auto; translate: -50% 0; }
/* with the transcript open, the captions, controls and title use the rest of the picture */
.mstage.tx-open .mcap { right: calc(var(--tx-w) + 12px); }
.mstage.tx-open .mtitle { inset-inline-end: var(--tx-w); }
/* the control bar keeps its full width and sits over the foot of the transcript (the list leaves room for it) */
.mstage.tx-open .mpanel { right: calc(var(--tx-w) + 12px); }
@media (max-width: 600px) {
  .mstage { --tx-w: 100%; }
  .mtx { top: auto; left: 0; height: 62%; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .12); border-radius: 14px 14px 0 0; transform: translateY(100%); }
  .mtx { z-index: 5; }
  .mstage.tx-open .mcap, .mstage.tx-open .mctrl, .mstage.tx-open .mtitle { visibility: hidden; }
  .mstage.tx-open .mpanel { right: 12px; }
  .mtx-list { padding-bottom: 60px; }
}

/* Review bubble while watching (optional) */
.mrb { position: absolute; top: 56px; left: 14px; z-index: 6; min-width: 210px; max-width: min(320px, calc(100% - 28px)); padding: 5px 6px 7px; border-radius: 14px; color: #f4f7ff; background: rgba(18, 22, 34, .55); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.mrb:not([hidden]) { animation: lens-in .18s cubic-bezier(.2, .9, .3, 1.15) both; }
.mrb-row { display: flex; align-items: center; gap: 4px; }
.mrb-row .mb-ic:last-child { margin-inline-start: auto; font-size: 18px; }
.mrb-word { padding: 2px 4px; border: 0; background: none; color: #4fe3f7; font: 800 17px/1.2 var(--body); text-decoration: underline 1.5px rgba(79, 227, 247, .5); text-underline-offset: 4px; }
.mrb .dots { margin-inline-start: 4px; }
.mrb-hint { display: block; padding: 0 8px; color: rgba(255, 255, 255, .6); font-size: 12px; }
.mrb-tr { margin: 2px 8px 8px; font: 700 16px/1.4 var(--arabic); }
.mrb-grades { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 4px; }
.mrb-grades button { min-height: 32px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: #fff; font-weight: 700; font-size: 13px; }
.mrb-again { color: var(--warn) !important; }
.mrb-good { border-color: rgba(45, 226, 183, .6) !important; color: var(--teal) !important; }
.mrb-grades button:hover { background: rgba(255, 255, 255, .12); }
.mstage.is-full .mrb { top: 70px; left: 24px; }


/* ═════════════ 6.9.1 · caption styles ═════════════
   Size follows the screen height (--mcap-fs, set by media.js).
   Style 1 (shadow): no box, white text with a soft black shadow.
   Style 2 (band): one tight dark box around both lines that grows with the longest line.
   Style 3 (box): the classic rounded box. */
.mstage[data-size] .mcap-lines { font-size: var(--mcap-fs, clamp(14px, 1.45cqw, 26px)); }
.mcap-tr:empty { display: none; }
.mcap-lines :is(.mcap-en, .mcap-tr) { text-wrap: balance; } /* two even lines, never one word alone on the second */
.mstage[data-capstyle="shadow"] .mcap-lines, .mstage[data-capstyle="shadow"] .ppv-lines { background: none; padding: 0 .3em; border-radius: 0; }
.mstage[data-capstyle="shadow"] .mcap-lines { max-width: 90%; }
.mstage[data-capstyle="shadow"] :is(.mcap-en, .mcap-tr, .ppv-en, .ppv-tr) { text-shadow: 0 0 1px #000, 0 0 2px rgba(0, 0, 0, .95), 0 1px 4px rgba(0, 0, 0, .9), 0 2px 10px rgba(0, 0, 0, .55); }
.mstage[data-capstyle="shadow"] .mcap-tr { margin-top: .05em; }
.mstage[data-capstyle="band"] .mcap-lines, .mstage[data-capstyle="band"] .ppv-lines { padding: .12em .55em .2em; border-radius: 3px; background: rgba(0, 0, 0, var(--mcap-bg, .6)); max-width: 92%; }
.mstage[data-capstyle="band"] :is(.mcap-en, .mcap-tr, .ppv-en, .ppv-tr) { text-shadow: none; }
.mstage[data-capstyle="band"] :is(.mcap-tr, .ppv-tr) { margin-top: 0; }
/* blurred translation on a box: blur the letters, keep the box sharp */
.mstage[data-capstyle="band"][data-tr="blur"] :is(.mcap-tr, .ppv-tr), .mstage[data-capstyle="box"][data-tr="blur"] :is(.mcap-tr, .ppv-tr) { filter: none; color: transparent; text-shadow: 0 0 calc(var(--mcap-blur, 6px) * .9) var(--mcap-trc, #fde047); }
.mstage[data-capstyle][data-tr="blur"] .mcap-lines:hover .mcap-tr, .mstage[data-capstyle][data-tr="blur"] .mcap-tr:active { color: var(--mcap-trc, #fde047); text-shadow: none; filter: none; }

@media (min-width: 720px) { .toast { bottom: calc(28px + env(safe-area-inset-bottom)); } }
/* phones, meaning shown: the note sits above the pinned grade buttons */
@media (max-width: 719px) { body[data-screen="review"] .toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 96px); } }

/* Subtitle fit: green in sync · yellow may need a shift · red likely out of sync */
.fit { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.fit i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.fit-good { color: #34d399; border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); }
.fit-ok { color: #fbbf24; border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .1); }
.fit-bad { color: #fb7185; border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .1); }
.fit-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 10px; color: var(--muted); font-size: 12.5px; }
.fit-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fit-fix { margin-inline-start: 4px; padding: 0 6px; border: 0; border-radius: 6px; background: rgba(251, 113, 133, .2); color: #fff; font-size: 11.5px; font-weight: 700; }
.os-item { gap: 12px; }
.os-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(145, 164, 224, .14); color: var(--soft); font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.os-body { flex: 1; min-width: 0; }
.os-item.in-use { border-color: var(--cyan); background: rgba(53, 217, 241, .08); }
.os-item.in-use .os-n { background: var(--cyan); color: var(--on-cyan); }
.os-used { padding: 2px 9px; border-radius: 999px; background: var(--cyan); color: var(--on-cyan); font-size: 12px; font-weight: 800; white-space: nowrap; }
.os-rel { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.os-rel b { overflow-wrap: anywhere; }


/* ═════════════ 6.9.2 · word bubble in the extension's layout ═════════════ */
.mbubble { padding: 0; min-width: 220px; max-width: min(360px, calc(100% - 16px)); font-size: 14px; --lx-accent: #4fe3f7; --lx-save: #3ff0bf; --lx-raised: rgba(255, 255, 255, .1); --lx-raised-2: rgba(255, 255, 255, .16); --lx-line: rgba(255, 255, 255, .16); --lx-muted: rgba(226, 232, 248, .72); }
.mbubble.open { width: min(340px, calc(100% - 16px)); }
.lx-row { display: flex; align-items: center; gap: 2px; min-height: 44px; padding: 5px 5px 5px 4px; }
.lx-hw { display: flex; align-items: baseline; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 2px 6px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.lx-hw:hover { background: var(--lx-raised); }
.lx-word { color: var(--lx-accent); font-size: 17px; font-weight: 700; white-space: nowrap; letter-spacing: -.01em; }
.lx-word.known { text-decoration: underline 2px rgba(63, 240, 191, .7); text-underline-offset: 4px; }
.lx-meaning { min-width: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f4f7ff; font: 650 15.5px/1.4 var(--arabic); }
.lx-meaning.pending { opacity: .6; }
.mbubble.open .lx-meaning { max-width: none; white-space: normal; }
.lx-sk { display: inline-block; width: 64px; height: 12px; border-radius: 6px; vertical-align: middle; background: linear-gradient(90deg, var(--lx-raised) 25%, var(--lx-raised-2) 50%, var(--lx-raised) 75%); background-size: 200% 100%; animation: lx-shimmer 1.1s linear infinite; }
@keyframes lx-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.lx-chev .ic svg { transition: transform .22s; }
.mbubble.open .lx-chev .ic svg { transform: rotate(180deg); }
.lx-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .26s cubic-bezier(.2, .8, .2, 1); }
.mbubble.open .lx-more { grid-template-rows: 1fr; }
.lx-inner { overflow: hidden; min-height: 0; }
.lx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 12px 8px; color: var(--lx-muted); font-size: 12px; }
.lx-meta b { color: #f4f7ff; font-weight: 600; }
.lx-level { display: inline-flex; align-items: center; gap: 5px; }
.lx-freq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.lx-freq i { width: 3px; border-radius: 1px; background: var(--lx-raised-2); }
.lx-freq i:nth-child(1) { height: 3px; } .lx-freq i:nth-child(2) { height: 5px; } .lx-freq i:nth-child(3) { height: 7px; } .lx-freq i:nth-child(4) { height: 9px; } .lx-freq i:nth-child(5) { height: 11px; }
.lx-freq i.on { background: var(--lx-accent); }
.lx-dots { display: inline-flex; gap: 3px; } .lx-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--lx-raised-2); } .lx-dots i.on { background: var(--lx-save); box-shadow: 0 0 6px rgba(63, 240, 191, .55); }
.lx-save { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 2px 11px 2px 7px; border: 1px solid rgba(63, 240, 191, .5); border-radius: 999px; background: rgba(63, 240, 191, .15); color: var(--lx-save); font-size: 12px; font-weight: 650; text-shadow: none; cursor: pointer; }
.lx-save .ic svg { width: 14px; height: 14px; display: block; }
.lx-save:hover { background: rgba(63, 240, 191, .26); }
.lx-save.saved { background: var(--lx-save); color: #032018; border-color: transparent; cursor: default; }
.lx-save.saved svg { fill: currentColor; }
.lx-save:disabled:not(.saved) { opacity: .4; cursor: default; }
.lx-tabs { display: flex; gap: 4px; padding: 0 8px 8px; }
.lx-tab { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 4px; min-width: 0; height: 28px; padding: 0 6px; border: 1px solid var(--lx-line); border-radius: 8px; background: transparent; color: var(--lx-muted); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.lx-tab:hover { color: #f4f7ff; }
.lx-tab[aria-selected="true"] { color: #f4f7ff; background: var(--lx-raised); border-color: rgba(79, 227, 247, .5); }
.lx-tab .n { font-size: 10.5px; color: var(--lx-muted); }
.lx-panel { max-height: 170px; overflow: auto; overscroll-behavior: contain; padding: 2px 12px 12px; scrollbar-width: thin; animation: lx-fade .2s both; }
@keyframes lx-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lx-group { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--lx-line); }
.lx-group:first-child { border-top: 0; padding-top: 0; }
.lx-pos { flex: none; padding: 5px 7px; border-radius: 6px; color: var(--tone, var(--lx-muted)); background: color-mix(in srgb, var(--tone, #94a3b8) 22%, transparent); font: 700 11px/1 var(--body); text-shadow: none; }
.lx-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.lx-chip { padding: 2px 8px; border-radius: 7px; background: var(--lx-raised); font: 600 13.5px/1.35 var(--arabic); animation: lx-fade .22s both; animation-delay: calc(var(--i, 0) * 25ms); }
.lx-dline { display: flex; align-items: center; gap: 2px; margin-bottom: 5px; }
.lx-label { margin-right: 4px; padding: 2px 8px; border-radius: 6px; background: rgba(79, 227, 247, .13); color: var(--lx-accent); font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; text-shadow: none; }
.lx-small { width: 26px; height: 26px; border-radius: 7px; }
.lx-small .ic svg, .lx-small svg { width: 16px; height: 16px; }
.lx-small.on { color: var(--lx-accent); }
.lx-text { margin: 0; color: #f4f7ff; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.lx-text.ex { font-style: italic; }
.lx-text mark { background: transparent; color: var(--lx-accent); font-weight: 700; }
.lx-tr { margin: 6px 0 0; padding: 5px 9px; border-radius: 8px; background: var(--lx-raised); font: 600 13.5px/1.55 var(--arabic); }
.lx-syn { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }
.lx-syn span { color: var(--lx-muted); font-size: 11.5px; }
.lx-syn button { padding: 1px 8px; border: 1px solid var(--lx-line); border-radius: 999px; background: transparent; color: #f4f7ff; font-size: 12px; cursor: pointer; }
.lx-syn button:hover { border-color: var(--lx-accent); color: var(--lx-accent); }
.lx-empty { padding: 0 12px 10px; color: var(--lx-muted); font-size: 12px; }
.mbubble .mb-phrase { width: calc(100% - 12px); margin: 2px 6px 6px; }


/* Sound converted in the browser (Dolby Digital Plus, DTS, TrueHD…) */
.msound { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 6px 0 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(18, 27, 61, .62); font-size: 13.5px; color: var(--soft); }
.msound-ic { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: rgba(53, 217, 241, .15); color: var(--cyan); font-weight: 800; }
.msound-txt { flex: 1 1 260px; min-width: 0; }
.msound[data-kind="on"] { border-color: rgba(45, 226, 183, .35); }
.msound[data-kind="on"] .msound-ic { background: rgba(45, 226, 183, .15); color: var(--teal); }
.msound[data-kind="busy"] .msound-ic { animation: msound-pulse 1.2s ease-in-out infinite; }
@keyframes msound-pulse { 50% { opacity: .35; } }
.msound[data-kind="error"] { border-color: rgba(251, 113, 133, .45); }
.msound[data-kind="error"] .msound-ic { background: rgba(251, 113, 133, .15); color: #fb7185; }
.msound-pick { max-width: 100%; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: inherit; }
.msound-go { padding: 6px 12px; min-height: 0; }
.pseg.stack { grid-template-columns: 1fr !important; }
.pseg.stack button { text-align: start; padding-inline: 10px; }

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