/* ═══════════════════════════════════════════════════════════════
   EPIC ENGLISH — SHARED STYLES (full)
   ═══════════════════════════════════════════════════════════════ */

/* ─────────── FONTS ─────────── */
/* ─────────── TOKENS ─────────── */
:root{
  --bg: #F5F5F5;
  --graphic: #67655E;
  --ink: #191919;
  --graphic-soft: rgba(103, 101, 94, 0.10);
  --graphic-line: rgba(103, 101, 94, 0.20);
  --ink-soft: rgba(25, 25, 25, 0.62);
  --ink-mute: rgba(25, 25, 25, 0.42);
  --bg-soft: rgba(245, 245, 245, 0.62);
  --white: #FFFFFF;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --success: #1F8A4C;
  --success-soft: rgba(31, 138, 76, 0.10);
  --danger: #C73B3B;
  --danger-soft: rgba(199, 59, 59, 0.10);
  --warn: #C78A2A;
  --warn-soft: rgba(199, 138, 42, 0.12);
  --flame: #FF7A29;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.9) inset, 0 30px 60px -30px rgba(25,25,25,0.18), 0 8px 24px -12px rgba(103,101,94,0.18);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.8) inset, 0 12px 32px -16px rgba(25,25,25,0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-strong: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─────────── RESET ─────────── */
*{ box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body{ width: 100%; }
html{ scroll-behavior: smooth; }
body{
  font-family: 'TT Norms Pro', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  min-height: 100vh;
  position: relative;
}
body::before{
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(103,101,94,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 40%, rgba(103,101,94,0.07), transparent 55%),
    radial-gradient(700px 400px at 50% 110%, rgba(25,25,25,0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─────────── KEYFRAMES ─────────── */
@keyframes rise{ from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ───────── Scroll-reveal: проявление из размытия при скролле ───────── */
@keyframes reveal-fade-in{
  0%   { opacity: 0; transform: translate3d(0, 40px, 0); filter: blur(8px); }
  100% { opacity: 1; transform: translate3d(0, 0, 0);    filter: blur(0); }
}
.reveal{
  opacity: 0;
  will-change: opacity, transform, filter;
  animation: none;
}
.reveal.in{
  animation: reveal-fade-in 2.4s var(--ease-strong) both;
  will-change: auto;
}
.reveal.in.d1{ animation-delay: 0.15s; }
.reveal.in.d2{ animation-delay: 0.30s; }
.reveal.in.d3{ animation-delay: 0.45s; }
.reveal.in.d4{ animation-delay: 0.60s; }
@media (prefers-reduced-motion: reduce){
  .reveal, .reveal.in{ opacity: 1; transform: none; filter: none; animation: none; }
}
@keyframes fadeDown{ from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse{ 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes checkPop{ 0% { transform: scale(0.5); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes questionIn{ from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes questionOut{ from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-8px); } }
@keyframes questionOutBack{ from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* ─────────── COMMON COMPONENTS ─────────── */
.back-btn{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 14px;
  background: var(--glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 100px;
  text-decoration: none; color: var(--ink);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-soft);
}
.back-btn:hover{ background: var(--white); transform: translateX(-3px); }
.back-btn svg{ transition: transform 0.3s var(--ease); }
.back-btn:hover svg{ transform: translateX(-2px); }

.crumb, .breadcrumb{
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--ink); opacity: 0.42;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.crumb a, .breadcrumb a{ color: inherit; text-decoration: none; transition: opacity 0.25s; }
.crumb a:hover, .breadcrumb a:hover{ opacity: 1; }
.crumb span.sep, .breadcrumb span.sep, .breadcrumb span{ margin: 0 8px; opacity: 0.5; }

.crumb-row{
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}

.btn-primary{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px 14px 26px;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: 14px;
  font-family: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; transition: all 0.35s var(--ease);
  position: relative; overflow: hidden;
}
.btn-primary::before{
  content: ""; position: absolute; top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(245,245,245,0.18), transparent);
  transition: left 0.7s var(--ease);
}
.btn-primary:hover::before{ left: 100%; }
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(25,25,25,0.4); }
.btn-primary:disabled{ opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary svg{ transition: transform 0.3s var(--ease); }
.btn-primary:hover:not(:disabled) svg{ transform: translateX(3px); }

.btn-ghost{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--graphic-line);
  border-radius: 14px;
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer; transition: all 0.3s var(--ease);
}
.btn-ghost:hover{ background: var(--white); border-color: var(--ink); }
.btn-ghost:disabled{ opacity: 0.35; cursor: not-allowed; }

/* ─────────── ACTION BAR ─────────── */
.action-bar{
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(180%);
  z-index: 100;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 22px;
  background: rgba(25,25,25,0.94);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  border: 1px solid rgba(245,245,245,0.06);
  box-shadow: 0 20px 60px -10px rgba(25,25,25,0.4);
  transition: transform 0.55s var(--ease-spring);
  max-width: calc(100vw - 32px);
}
.action-bar.show, .action-bar.always{ transform: translateX(-50%) translateY(0); }
.ab-info{ display: flex; flex-direction: column; gap: 2px; color: var(--bg); margin-right: 8px; }
.ab-info-l{ font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.6; font-weight: 500; }
.ab-info-v{ font-size: 13px; font-weight: 600; }
.ab-divider{ width: 1px; height: 30px; background: rgba(245,245,245,0.16); margin-right: 4px; }
.ab-btn{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: none; border-radius: 12px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.3s var(--ease); white-space: nowrap;
}
.ab-btn.secondary{ background: rgba(245,245,245,0.10); color: var(--bg); border: 1px solid rgba(245,245,245,0.16); }
.ab-btn.secondary:hover:not(:disabled){ background: rgba(245,245,245,0.18); }
.ab-btn.secondary:disabled{ opacity: 0.45; cursor: not-allowed; }
.ab-btn.primary{ background: var(--bg); color: var(--ink); }
.ab-btn.primary:hover:not(:disabled){ transform: translateY(-1px); box-shadow: 0 10px 24px -6px rgba(245,245,245,0.4); }
.ab-btn.primary:disabled{ background: rgba(245,245,245,0.14); color: var(--bg); opacity: 0.45; cursor: not-allowed; }
.ab-btn.primary.done{ background: var(--success); color: var(--bg); }
.ab-btn.primary.done svg{ animation: checkPop 0.5s var(--ease-spring); }
.ab-btn svg{ width: 14px; height: 14px; }
.ab-btn-label-short{ display: none; }
.ab-btn-label-full{ display: inline; }

/* ─────────── TOAST ─────────── */
.toast{
  position: fixed; bottom: 140px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(25, 25, 25, 0.72);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(245, 245, 245, 0.08);
  color: var(--bg);
  padding: 12px 18px; border-radius: 14px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(25,25,25,0.35);
  opacity: 0; pointer-events: none; z-index: 95;
  transition: all 0.4s var(--ease);
  display: flex; align-items: center; gap: 8px;
}
.toast.show{ transform: translateX(-50%) translateY(0); opacity: 1; }
.toast svg{ width: 14px; height: 14px; }

/* ─────────── PAGE LAYOUT ─────────── */
.page{ position: relative; z-index: 1; margin: 0 auto; min-height: 100vh; }
.page--narrow{ max-width: 760px; padding: 28px 28px 80px; }
.page--medium{ max-width: 1100px; padding: 28px 40px 140px; }
.page--wide  { max-width: 1180px; padding: 28px 40px 140px; }
.page--xwide { max-width: 1360px; padding: 28px 40px 80px; }
.topbar{
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px; gap: 16px; flex-wrap: wrap;
  animation: fadeDown 0.6s var(--ease) both;
}

/* ═══════════════════ TOPIC PAGE ═══════════════════ */
.read-progress{ position: fixed; top: 0; left: 0; right: 0; height: 3px; background: transparent; z-index: 200; pointer-events: none; }
.read-progress-fill{
  height: 100%;
  background: linear-gradient(90deg, var(--graphic), var(--ink));
  width: 0%; transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(25,25,25,0.3);
}

.article-layout{ display: grid; grid-template-columns: 1fr 220px; gap: 48px; align-items: start; }
.article{ max-width: 760px; }

.t-hero{ margin-bottom: 48px; animation: rise 0.8s var(--ease) 0.1s both; }
.t-eyebrow{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px;
  background: var(--graphic-soft);
  border: 1px solid var(--graphic-line);
  border-radius: 100px;
  font-size: 12px; font-weight: 600; color: var(--graphic);
  letter-spacing: 0.02em; text-transform: uppercase;
  margin-bottom: 22px;
}
.t-eyebrow .pip{
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}
.t-h1{ font-size: clamp(36px, 4.5vw, 54px); font-weight: 600; line-height: 1.02; letter-spacing: -0.035em; margin-bottom: 22px; }
.t-h1 .accent{ color: var(--graphic); font-weight: 500; }
.t-desc{ font-size: 17px; line-height: 1.55; color: var(--ink); opacity: 0.72; max-width: 600px; margin-bottom: 28px; }
.t-meta{
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  padding-top: 18px; border-top: 1px solid var(--graphic-line);
  font-size: 13px; color: var(--ink); opacity: 0.62;
}
.t-meta-item{ display: inline-flex; align-items: center; gap: 6px; }
.t-meta-item svg{ width: 14px; height: 14px; opacity: 0.7; }
.t-meta-dot{ width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.4; }

/* TOC */
.toc{
  position: sticky; top: 30px; align-self: start;
  padding: 22px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  animation: rise 0.8s var(--ease) 0.3s both;
}
.toc h4{
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink); opacity: 0.42; font-weight: 600; margin-bottom: 14px;
}
.toc ul{ list-style: none; display: flex; flex-direction: column; gap: 2px; }
.toc a{
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px 7px 14px;
  font-size: 13px; font-weight: 500; color: var(--ink); opacity: 0.62;
  text-decoration: none; border-radius: 8px;
  transition: all 0.25s var(--ease);
  line-height: 1.35; position: relative;
}
.toc a::before{
  content: ""; position: absolute; left: 4px; top: 50%;
  width: 2px; height: 2px; background: currentColor;
  border-radius: 50%; transform: translateY(-50%);
  opacity: 0.5; transition: all 0.25s var(--ease);
}
.toc a:hover{ opacity: 1; background: var(--graphic-soft); }
.toc a.active{ opacity: 1; color: var(--ink); font-weight: 600; background: var(--graphic-soft); }
.toc a.active::before{ width: 6px; height: 6px; background: var(--ink); opacity: 1; left: 2px; }

/* SECTIONS */
.section{ margin-bottom: 56px; scroll-margin-top: 24px; }
.section-head{ margin-bottom: 22px; display: flex; align-items: baseline; gap: 14px; }
.section-num{
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink); opacity: 0.42; font-weight: 600;
  padding: 4px 10px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 100px; letter-spacing: 0.05em; flex-shrink: 0;
}
.section h2{ font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.section h3{ font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 28px 0 12px; }
.section p{ font-size: 16px; line-height: 1.65; margin-bottom: 14px; opacity: 0.84; }
.section p strong, .section li strong{ font-weight: 600; opacity: 1; }
.hl{
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  background: var(--graphic-soft);
  padding: 1px 6px; border-radius: 6px;
  font-size: 0.92em;
}

/* EG LIST */
.eg-list{ list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.eg-list li{
  padding: 14px 16px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 12px; font-size: 15px;
  transition: all 0.3s var(--ease);
}
.eg-list li:hover{ border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(25,25,25,0.12); }
.eg-list .eg-en{ font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.eg-list .eg-en .accent{ color: var(--graphic); font-weight: 700; }
.eg-list .eg-ru{ display: block; font-size: 13px; color: var(--ink); opacity: 0.62; margin-top: 4px; }

/* RULE */
.rule{
  display: flex; gap: 14px;
  padding: 18px 20px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: var(--radius-md); margin: 18px 0;
  position: relative; overflow: hidden;
}
.rule::before{ content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink); }
.rule.success::before{ background: var(--success); }
.rule.danger::before{ background: var(--danger); }
.rule.warn::before{ background: var(--warn); }
.rule-icon{
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--graphic-soft); color: var(--ink);
}
.rule.success .rule-icon{ background: var(--success-soft); color: var(--success); }
.rule.danger .rule-icon{ background: var(--danger-soft); color: var(--danger); }
.rule.warn .rule-icon{ background: var(--warn-soft); color: var(--warn); }
.rule-icon svg{ width: 16px; height: 16px; }
.rule-body{ flex: 1; }
.rule-body h4{ font-size: 13px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.005em; }
.rule-body p{ font-size: 14.5px; line-height: 1.55; margin: 0; opacity: 0.78; }
.rule-body p .hl{ background: rgba(103,101,94,0.18); }

/* COMPARE */
.compare{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.compare-card{
  padding: 14px 16px; border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.compare-card.wrong{
  background: var(--danger-soft);
  border: 1px solid rgba(199, 59, 59, 0.22);
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: rgba(199, 59, 59, 0.5);
}
.compare-card.right{
  background: var(--success-soft);
  border: 1px solid rgba(31, 138, 76, 0.22);
  color: var(--success);
}
.compare-card .mark{
  width: 22px; height: 22px;
  border-radius: 50%; display: grid; place-items: center;
  flex-shrink: 0;
}
.compare-card.wrong .mark{ background: rgba(199, 59, 59, 0.18); }
.compare-card.right .mark{ background: rgba(31, 138, 76, 0.18); }
.compare-card .mark svg{ width: 12px; height: 12px; }

/* TRANSFORM */
.transform{ display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.transform-row{
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px; align-items: center;
  padding: 12px 16px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 12px;
  transition: all 0.3s var(--ease);
}
.transform-row:hover{ border-color: rgba(25,25,25,0.3); }
.transform-side{ font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; }
.transform-side .accent{ color: var(--graphic); font-weight: 700; }
.transform-side.before{ color: var(--ink); opacity: 0.7; }
.transform-side.after{ color: var(--ink); font-weight: 600; }
.transform-arrow{
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--graphic-soft);
  display: grid; place-items: center;
  color: var(--graphic); flex-shrink: 0;
}
.transform-arrow svg{ width: 13px; height: 13px; }

/* CHEATSHEET */
.cheatsheet{
  padding: 32px;
  background: var(--ink); color: var(--bg);
  border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
  margin: 20px 0 8px;
}
.cheatsheet::before{
  content: ""; position: absolute; top: -30%; right: -10%;
  width: 60%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(31,138,76,0.22), transparent 62%);
  pointer-events: none;
}
.cheatsheet::after{
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(245,245,245,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,245,245,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 82%);
  pointer-events: none;
}
.cheatsheet-head{ display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; position: relative; z-index: 1; }
.cheatsheet-head h4{ font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.cheatsheet-tag{
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; padding: 5px 10px; border-radius: 100px;
  background: rgba(245,245,245,0.10);
  border: 1px solid rgba(245,245,245,0.15);
  font-weight: 500; opacity: 0.8;
}
.cheat-eq{
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(16px, 4.6vw, 22px); font-weight: 600; margin-bottom: 20px;
  letter-spacing: -0.02em; line-height: 1.3; overflow-wrap: break-word;
  position: relative; z-index: 1;
}
.cheat-eq .ink-acc{ color: #5fd989; }
/* Карточная сетка: каждый <li> — самостоятельная карточка.
   auto-fit + minmax сам схлопывается в одну колонку на узких экранах. */
.cheat-list{
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 10px;
  position: relative; z-index: 1;
}
.cheat-list li{
  position: relative;
  min-width: 0;
  padding: 15px 16px 15px 56px;
  background: rgba(245,245,245,0.05);
  border: 1px solid rgba(245,245,245,0.10);
  border-radius: 13px;
  font-size: 14px; line-height: 1.5; opacity: 0.9;
  overflow-wrap: break-word;
}
.cheat-list li::before{
  content: "";
  position: absolute; left: 16px; top: 14px;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(95,217,137,0.16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%235fd989' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.cheat-list li strong{ color: var(--bg); font-weight: 700; opacity: 1; }

/* ═══════════════════ TEST PAGE ═══════════════════ */
.test-page{
  max-width: 880px; margin: 0 auto; padding: 28px 28px 80px;
  min-height: 100vh; display: flex; flex-direction: column;
}
/* На широких экранах даём контейнеру больше воздуха, чтобы тест не казался прижатым */
@media (min-width: 1280px){
  .test-page{ max-width: 1000px; padding-top: 40px; }
}

.progress-track{ width: 100%; max-width: 720px; margin: 0 auto 32px; animation: fadeDown 0.7s var(--ease) 0.05s both; }
.progress-info{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-label{ font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.progress-label .num{ font-size: 14px; }
.progress-label .of{ opacity: 0.42; }
.progress-text{ font-size: 12px; color: var(--ink); opacity: 0.62; font-weight: 500; }
.progress-bar{ height: 4px; background: var(--graphic-line); border-radius: 100px; overflow: hidden; }
.progress-fill{
  height: 100%;
  background: linear-gradient(90deg, var(--graphic), var(--ink));
  border-radius: 100px; width: 0%;
  transition: width 0.5s var(--ease);
  box-shadow: 0 0 8px rgba(25,25,25,0.2);
}

/* START SCREEN */
.start-screen{ flex: 1; display: none; flex-direction: column; justify-content: center; align-items: flex-start; width: 100%; max-width: 680px; margin: 0 auto; animation: rise 0.7s var(--ease) both; }
.start-screen.active{ display: flex; }
.start-eyebrow{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px;
  background: var(--graphic-soft);
  border: 1px solid var(--graphic-line);
  border-radius: 100px;
  font-size: 11px; font-weight: 600; color: var(--graphic);
  letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 22px;
}
.start-eyebrow .pip{
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}
.start-h1{ font-size: clamp(36px, 4.5vw, 52px); font-weight: 600; line-height: 1.04; letter-spacing: -0.035em; margin-bottom: 16px; }
.start-h1 .accent{ color: var(--graphic); font-weight: 500; }
.start-desc{ font-size: 16px; line-height: 1.6; opacity: 0.7; max-width: 520px; margin-bottom: 26px; }
.start-meta{ display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.start-meta-item{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 10px; font-size: 13px; font-weight: 500;
}
.start-meta-item svg{ width: 14px; height: 14px; opacity: 0.62; }

.prev-attempts{
  width: 100%; max-width: 520px;
  padding: 20px 22px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: var(--radius-md);
  margin-bottom: 24px; display: none;
}
.prev-attempts.show{ display: block; }
.prev-attempts h4{
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink); opacity: 0.42; font-weight: 600;
  margin-bottom: 14px; display: flex; justify-content: space-between;
}
.prev-attempts h4 .total{ font-family: 'JetBrains Mono', monospace; opacity: 0.6; }
.attempt-row{
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--graphic-line);
  cursor: pointer; transition: opacity 0.2s;
}
.attempt-row:first-of-type{ border-top: none; }
.attempt-row:hover{ opacity: 0.8; }
.att-idx{ font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink); opacity: 0.42; font-weight: 600; }
.att-date{ font-size: 13px; font-weight: 500; }
.att-detail{ font-size: 12px; opacity: 0.62; font-family: 'JetBrains Mono', monospace; }
.att-score{
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
  padding: 4px 9px; border-radius: 100px;
}
.att-score.s-low{ background: var(--danger-soft); color: var(--danger); }
.att-score.s-mid{ background: var(--warn-soft); color: var(--warn); }
.att-score.s-hi{ background: var(--success-soft); color: var(--success); }
.start-actions{ display: flex; gap: 10px; flex-wrap: wrap; }

/* QUIZ SCREEN */
.quiz-screen{ flex: 1; display: none; flex-direction: column; width: 100%; max-width: 680px; margin: 0 auto; }
.quiz-screen.active{ display: flex; }
.question{
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 20px 0 40px;
  animation: questionIn 0.45s var(--ease) both;
}
.question.leaving{ animation: questionOut 0.25s var(--ease) both; }
.question.leaving-back{ animation: questionOutBack 0.25s var(--ease) both; }
.q-num{
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  opacity: 0.42; font-weight: 600; letter-spacing: 0.05em;
  margin-bottom: 14px; text-transform: uppercase;
}
.q-num .part-tag{
  display: inline-block; margin-left: 8px;
  padding: 2px 8px;
  background: var(--graphic-soft); border-radius: 100px;
  color: var(--graphic); font-size: 10px; letter-spacing: 0.08em;
}
.q-text{ font-size: clamp(24px, 3.4vw, 32px); font-weight: 600; line-height: 1.3; letter-spacing: -0.025em; margin-bottom: 16px; }
.q-subtitle{ font-size: 14px; opacity: 0.6; margin-bottom: 24px; }
.q-text .blank{
  display: inline-block; min-width: 60px; padding: 0 4px;
  border-bottom: 3px solid var(--ink);
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  color: var(--graphic); transition: color 0.3s var(--ease);
}
.q-text .blank.filled{ color: var(--ink); border-bottom-color: var(--graphic); }
.q-text .original{
  font-family: 'JetBrains Mono', monospace;
  background: var(--danger-soft);
  border: 1px dashed rgba(199, 59, 59, 0.4);
  color: var(--danger);
  padding: 2px 10px; border-radius: 8px;
  font-weight: 500; display: inline-block;
}

.options{ display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.option{
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 14px; cursor: pointer;
  transition: all 0.3s var(--ease);
  text-align: left; width: 100%; font-family: inherit;
}
.option:hover{ border-color: var(--ink); transform: translateX(2px); box-shadow: 0 8px 22px -12px rgba(25,25,25,0.18); }
.option-key{
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--graphic-soft);
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600;
  flex-shrink: 0; transition: all 0.3s var(--ease);
}
.option:hover .option-key{ background: var(--ink); color: var(--bg); }
.option-text{ flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 17px; font-weight: 500; line-height: 1.4; }
.option.selected{ background: var(--ink); color: var(--bg); border-color: var(--ink); }
.option.selected .option-key{ background: var(--bg); color: var(--ink); }

.quiz-foot{
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 18px; border-top: 1px solid var(--graphic-line);
  gap: 12px; flex-wrap: wrap;
}
.quiz-foot .btn-ghost{ padding: 12px 18px 12px 16px; font-size: 13.5px; }
.q-hint{ font-size: 12px; opacity: 0.42; display: inline-flex; align-items: center; gap: 6px; }
.q-hint kbd{
  display: inline-block; padding: 2px 6px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
  opacity: 0.9;
}

/* RESULT SCREEN */
.result-screen{ flex: 1; display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px 0; }
.result-screen.active{ display: flex; animation: rise 0.6s var(--ease) both; }
.result-circle{ position: relative; width: 200px; height: 200px; margin-bottom: 28px; }
.result-circle svg{ width: 100%; height: 100%; transform: rotate(-90deg); }
.rc-bg{ fill: none; stroke: var(--graphic-line); stroke-width: 8; }
.rc-fg{
  fill: none; stroke: var(--ink); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 565; stroke-dashoffset: 565;
  transition: stroke-dashoffset 1.8s var(--ease);
}
.rc-fg.s-low{ stroke: var(--danger); }
.rc-fg.s-mid{ stroke: var(--warn); }
.rc-fg.s-hi{ stroke: var(--success); }
.rc-center{ position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rc-pct{ font-size: 54px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.rc-pct sup{ font-size: 22px; font-weight: 400; opacity: 0.5; top: -0.55em; }
.rc-correct{
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  opacity: 0.6; margin-top: 6px; font-weight: 500; white-space: nowrap;
}
.result-title{ font-size: clamp(26px, 3.4vw, 34px); font-weight: 600; letter-spacing: -0.025em; margin-bottom: 12px; line-height: 1.15; }
.result-message{ font-size: 16px; line-height: 1.6; opacity: 0.72; max-width: 460px; margin: 0 auto 28px; }
.result-tag{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 100px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  margin-bottom: 22px;
}
.result-tag.s-low{ background: var(--danger-soft); color: var(--danger); }
.result-tag.s-mid{ background: var(--warn-soft); color: var(--warn); }
.result-tag.s-hi{ background: var(--success-soft); color: var(--success); }
.result-actions{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* REVIEW SCREEN */
.review-screen{ flex: 1; display: none; flex-direction: column; width: 100%; max-width: 720px; margin: 0 auto; animation: rise 0.5s var(--ease) both; }
.review-screen.active{ display: flex; }
.review-head{ margin-bottom: 22px; }
.review-head h2{ font-size: 28px; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 6px; }
.review-head p{ font-size: 14px; opacity: 0.62; }
.review-stats{ display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 24px; }
.review-stat{ padding: 14px 16px; background: var(--white); border: 1px solid var(--graphic-line); border-radius: 12px; }
.review-stat .l{ font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.5; font-weight: 600; margin-bottom: 4px; }
.review-stat .v{ font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 600; }
.review-stat.correct .v{ color: var(--success); }
.review-stat.wrong .v{ color: var(--danger); }
.review-list{ display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.review-item{
  padding: 18px 20px;
  background: var(--white); border: 1px solid var(--graphic-line);
  border-radius: 14px;
  position: relative; overflow: hidden;
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.review-item::before{ content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.review-item.correct::before{ background: var(--success); }
.review-item.wrong::before{ background: var(--danger); }
.rev-q-head{ display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.rev-q-num{
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  background: var(--graphic-soft); border-radius: 6px;
}
.rev-q-mark{
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.rev-q-mark.correct{ background: var(--success-soft); color: var(--success); }
.rev-q-mark.wrong{ background: var(--danger-soft); color: var(--danger); }
.rev-q-mark svg{ width: 11px; height: 11px; }
.rev-q-text{
  font-family: 'JetBrains Mono', monospace; font-size: 14.5px;
  font-weight: 500; margin-bottom: 12px; line-height: 1.45;
}
.rev-q-text .blank{
  display: inline-block; padding: 0 6px;
  border-bottom: 2px solid var(--ink);
  min-width: 30px; font-weight: 600;
}
.rev-q-text .original{
  font-family: 'JetBrains Mono', monospace;
  background: var(--danger-soft); color: var(--danger);
  padding: 1px 8px; border-radius: 6px;
  font-weight: 500; display: inline-block;
}
.rev-answers{ display: flex; flex-direction: column; gap: 6px; }
.rev-ans{
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--graphic-line);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500;
}
.rev-ans.correct{ background: var(--success-soft); border-color: rgba(31, 138, 76, 0.25); color: var(--success); }
.rev-ans.user-wrong{
  background: var(--danger-soft);
  border-color: rgba(199, 59, 59, 0.25);
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: rgba(199, 59, 59, 0.5);
}
.rev-ans-tag{
  font-size: 10px; padding: 2px 7px; border-radius: 100px;
  margin-left: auto; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.rev-ans.correct .rev-ans-tag{ background: var(--success); color: var(--bg); }
.rev-ans.user-wrong .rev-ans-tag{ background: var(--danger); color: var(--bg); text-decoration: none; }
.review-foot{ display: flex; gap: 10px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--graphic-line); }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 1024px){
  .article-layout{ grid-template-columns: 1fr; }
  .toc{ display: none; }
}
@media (max-width: 720px){
  .topbar{ flex-direction: column; align-items: flex-start; gap: 10px; }
  /* iOS Safari зумит при тапе в поле с font-size < 16px — поднимаем до 16px */
  input, select, textarea{ font-size: 16px; }
  .action-bar{
    bottom: 12px; width: calc(100% - 24px);
    padding: 10px 10px 10px 16px; gap: 8px;
    border-radius: 16px; flex-wrap: nowrap; align-items: center;
  }
  .ab-info{ flex: 1; min-width: 0; margin-right: 4px; overflow: hidden; }
  .ab-info-l{ font-size: 9px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-info-v{ font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-divider{ display: none; }
  .ab-btn{ padding: 0; font-size: 0; border-radius: 10px; flex-shrink: 0; justify-content: center; }
  .ab-btn.secondary{ width: auto; height: 40px; padding: 0 14px; font-size: 13px; font-weight: 600; }
  .ab-btn.secondary svg{ display: none; }
  .ab-btn.secondary .ab-btn-label-full{ display: none; }
  .ab-btn.secondary .ab-btn-label-short{ display: inline; font-size: 13px; }
  .ab-btn.primary{ width: auto; height: 40px; padding: 0 16px; font-size: 13px; gap: 6px; }
  .ab-btn.primary svg{ width: 16px; height: 16px; }
  .ab-btn.primary .ab-btn-label, .ab-btn.primary .ab-btn-label-full{ display: inline; white-space: nowrap; }
  .toast{ bottom: 130px; }
  .page--wide, .page--medium{ padding: 16px 16px 140px; }
  .t-h1{ font-size: 32px; }
  .section h2{ font-size: 22px; }
  .section h3{ font-size: 16px; }
  .section p{ font-size: 15px; }
  .eg-list{ grid-template-columns: 1fr; }
  .transform-row{ grid-template-columns: 1fr; gap: 8px; }
  .transform-arrow{ transform: rotate(90deg); }
  .test-page{ padding: 16px 16px 80px; }
  .q-text{ font-size: 22px; }
  .option-text{ font-size: 16px; }
  .result-circle{ width: 160px; height: 160px; }
  .rc-pct{ font-size: 42px; }
  .rc-pct sup{ font-size: 18px; }
  .rc-correct{ font-size: 11px; margin-top: 4px; }
  .review-stats{ grid-template-columns: 1fr; }
  .start-actions, .result-actions, .review-foot{ flex-direction: column; }
  .start-actions .btn-primary, .start-actions .btn-ghost,
  .result-actions .btn-primary, .result-actions .btn-ghost,
  .review-foot .btn-primary, .review-foot .btn-ghost{ width: 100%; justify-content: center; }
}

/* ─────────── Б13: НАВИГАЦИЯ ВНИЗУ ТЕМЫ (бета-тест, июнь 2026; редизайн 14.06) ─────────── */
/* Селекторы с .topic-bottom-nav перед .tbn-btn — чтобы перебить стиль ссылок
   статьи (.article a: underline + inline), из-за которого кнопки слипались. */
.topic-bottom-nav{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 48px 0 104px;   /* запас снизу под фиксированный action-bar */
}
/* Когда кнопка одна (нет «следующей темы») — занимает свою колонку, не растягивается */
.topic-bottom-nav.single{ grid-template-columns: minmax(0, 360px); }

.topic-bottom-nav .tbn-btn{
  box-sizing: border-box;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 20px;
  background: var(--white);
  border: 1px solid var(--graphic-line);
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;          /* перебиваем underline ссылок статьи */
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease, ease), border-color 0.2s ease, background 0.2s ease;
}
.topic-bottom-nav .tbn-btn:hover{
  transform: translateY(-2px);
  border-color: var(--graphic);
}
.topic-bottom-nav .tbn-btn:active{ transform: translateY(0) scale(0.99); }

.topic-bottom-nav .tbn-btn .tbn-label{
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 15px; line-height: 1.25;
  text-decoration: none;
}
/* В «следующей теме» стрелка прижата к правому краю */
.topic-bottom-nav .tbn-btn.primary .tbn-label{ justify-content: space-between; }
.topic-bottom-nav .tbn-btn .tbn-label svg{ flex: 0 0 auto; }

.topic-bottom-nav .tbn-btn .tbn-title{
  font-size: 13px; line-height: 1.3; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-bottom-nav .tbn-btn.primary{
  background: var(--ink); border-color: var(--ink);
  color: #fff;
}
.topic-bottom-nav .tbn-btn.primary .tbn-label{ color: #fff; }
.topic-bottom-nav .tbn-btn.primary .tbn-title{ color: rgba(255,255,255,0.7); }

@media (max-width: 640px){
  .topic-bottom-nav{
    grid-template-columns: 1fr;   /* в столбик на телефоне */
    gap: 10px;
    margin: 36px 0 120px;
  }
  .topic-bottom-nav.single{ grid-template-columns: 1fr; }
  .topic-bottom-nav .tbn-btn{ min-height: 56px; }
}
