:root {
  --bg: #0e0f13; --panel: #171920; --panel2: #1f222b; --line: #2a2e39;
  --text: #eef0f4; --muted: #8c93a3; --accent: #f2a130; --accent2: #5fb3ff;
  --ok: #4cc38a; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: rgba(14,15,19,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #111; font-weight: 800; }
.tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; }
.tab.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }

.view { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; padding: 24px; max-width: 1400px; margin: 0 auto; }
#view-ext { display: block; max-width: 1100px; }
.view[hidden] { display: none !important; }

.video-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 0; }
.badges { display: flex; gap: 6px; }
.chip, .lvl { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); }
.lvl { background: rgba(95,179,255,.14); color: var(--accent2); border-color: rgba(95,179,255,.35); }

.player-wrap { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; }

.subs { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; min-height: 132px; }
.sub-en { font-size: 24px; font-weight: 600; line-height: 1.45; }
.sub-ru { font-size: 18px; color: #c9ced8; margin-top: 6px; transition: filter .2s; }
.subs.ru-blur .sub-ru { filter: blur(7px); cursor: pointer; }
.subs.ru-blur .sub-ru:hover { filter: none; }
.subs.ru-hide .sub-ru { display: none; }
.w { cursor: pointer; border-radius: 5px; padding: 0 1px; transition: background .12s; }
.w:hover { background: rgba(242,161,48,.22); }
.w.hard { text-decoration: underline dotted var(--accent) 2px; text-underline-offset: 5px; }
.w.saved { color: var(--accent); }
.phrases { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.phrase { font-size: 13px; background: rgba(242,161,48,.1); border: 1px solid rgba(242,161,48,.35); color: #f5c47a; padding: 3px 10px; border-radius: 99px; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ctl { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 44px; }
.ctl:hover { border-color: var(--muted); }
.ctl-main { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; }
.sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toggle select { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 7px 10px; font-size: 13px; color: var(--muted); }
.seg button.is-on { background: var(--panel2); color: var(--text); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: calc(100vh - 110px); position: sticky; top: 80px; overflow: hidden; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.stab { flex: 1; background: transparent; border: 0; padding: 12px; color: var(--muted); font-weight: 600; }
.stab.is-on { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
#bank-count { font-size: 11px; background: var(--panel2); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.script { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.script li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.script li:hover { background: var(--panel2); }
.script li.now { background: rgba(242,161,48,.12); }
.script .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.script .ru { color: var(--muted); display: block; }
.script .l { font-size: 10px; font-weight: 700; color: var(--accent2); }
.bank { padding: 12px; overflow-y: auto; }
.bank-item { padding: 10px 12px; border-radius: 10px; background: var(--panel2); margin-bottom: 8px; font-size: 13px; }
.bank-item b { font-size: 15px; }
.bank-item .ctx { color: var(--muted); display: block; margin-top: 2px; }
.bank-empty { color: var(--muted); font-size: 13px; padding: 8px; }
.train { width: 100%; margin-top: 6px; background: var(--accent); color: #111; border: 0; border-radius: 10px; padding: 10px; font-weight: 700; }
.card { background: var(--panel2); border-radius: 12px; padding: 18px; text-align: center; margin-bottom: 10px; }
.card-word { font-size: 26px; font-weight: 700; }
.card-ctx { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.card-ru { font-size: 18px; color: var(--accent); margin-bottom: 10px; }
.card-btns { display: flex; gap: 8px; justify-content: center; }
.card-btns button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }

.pop { position: absolute; z-index: 50; width: 260px; background: #fff; color: #15171c; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.pop .lvl { background: #e8f2ff; color: #1f6fd1; border-color: #bcd8ff; }
.pop-head b { font-size: 18px; }
.pop-lemma { font-size: 12px; color: #6b7280; }
.pop-ru { font-size: 16px; margin: 6px 0 10px; }
.pop-btns { display: flex; gap: 6px; }
.pop-btns button { flex: 1; background: #f1f2f5; border: 0; border-radius: 8px; padding: 7px; font-size: 13px; }
.pop-btns #pop-save { background: var(--accent); }

.lead { font-size: 16px; max-width: 780px; }
.browser { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0f0f0f; }
.bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #202124; font-size: 12px; color: #bdc1c6; }
.dots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #5f6368; margin-right: 5px; }
.url { flex: 1; background: #303134; border-radius: 99px; padding: 4px 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ext-ico { background: var(--accent); color: #111; font-weight: 800; border-radius: 6px; padding: 1px 6px; }
.yt { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px; }
.yt-video { aspect-ratio: 16/9; border-radius: 12px; display: grid; place-items: center; color: #aaa; font-size: 14px;
  background: linear-gradient(135deg, #2b2b2b, #151515); }
.yt-title { font-size: 17px; font-weight: 600; margin-top: 10px; }
.yt-meta { font-size: 13px; color: #aaa; }
.ext-panel { background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 12px; font-size: 14px; }
.ext-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ext-line { padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.ext-line.now { background: rgba(242,161,48,.12); color: var(--text); font-weight: 600; }
.ext-line .ru { font-weight: 400; color: var(--muted); font-size: 13px; }
.ext-line u { text-decoration: underline dotted var(--accent) 2px; text-underline-offset: 4px; }
.ext-pop { background: #fff; color: #15171c; border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 13px; }
.ext-pop button { margin-left: 6px; border: 0; background: var(--accent); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.ext-tools { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.notes { margin-top: 20px; padding-left: 18px; max-width: 820px; }
.notes li { margin-bottom: 8px; }

.foot { max-width: 1400px; margin: 0 auto; padding: 8px 24px 32px; font-size: 12px; color: var(--muted); }

@media (max-width: 960px) {
  .view { grid-template-columns: 1fr; padding: 16px; }
  .side { position: static; max-height: 420px; }
  .yt { grid-template-columns: 1fr; }
  .sub-en { font-size: 20px; }
  .top { padding: 10px 16px; }
}
