/* 0) БАЗА + ПЕРЕМЕННЫЕ */
:root{
  --bg:#0b1020;
  --bg2:#0e1530;

  --card: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.14);

  --text:#eaf0ff;
  --muted: rgba(234,240,255,.68);

  --brand: var(--c-acc-1);
  --brand2: var(--c-acc-2);
  --good: var(--c-acc-3);

  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --r: 22px;
  --r2: 16px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}

*{ box-sizing:border-box; }

/* ── PERF KILL-SWITCH ──────────────────────────────────────────────────────
   Глобальное отключение тяжёлых эффектов когда <html class="perf-lite">.
   Этот класс ставится JS-ом в base.html для Safari / macOS, мобилок,
   prefers-reduced-motion, и устройств с >2 cores. Убирает backdrop-filter,
   filter:blur и тяжёлые animation:infinite — это даёт +30–60 FPS
   и устраняет ощущение «страница лагает». */
html.perf-lite *,
html.perf-lite *::before,
html.perf-lite *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.perf-lite .panel::before { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Важно: фон и анти-белые зоны при "перетягивании" */
html, body{
  height:100%;
  margin:0;
  background:#070b17;          /* fallback, чтобы не вылезал белый фон */
  overscroll-behavior:none;     /* убирает bounce в Chromium/Firefox */
}

body{
  min-height:100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(var(--c-acc-1-rgb),.35), transparent 55%),
    radial-gradient(1100px 900px at 85% 15%, rgba(var(--c-acc-2-rgb),.22), transparent 55%),
    radial-gradient(900px 700px at 60% 90%, rgba(var(--c-acc-3-rgb),.18), transparent 55%),
    linear-gradient(180deg, var(--bg), #070b17 65%);
  overflow-x:hidden;
}

a{ color:inherit; text-decoration:none; }
button{ font:inherit; color:inherit; border:0; background:transparent; cursor:pointer; }

/* Обёртка страницы — держит высоту, чтобы снизу не появлялась "пустота" */
.page{
  min-height: calc(100vh - 0px);
  padding-bottom: 24px;
}

/* Общий контейнер (совпадает с HTML: class="container") */
/* Сайт шире + меньше отступы от краёв */
.container{
  width: min(1400px, calc(100vw - 32px)); /* по 16px с каждой стороны */
  margin: 0 auto;
}

/* 1) СТЕКЛЯННАЯ ПАНЕЛЬ (class="panel") */
/* Убраны backdrop-filter:blur и ::before filter:blur — оба ОЧЕНЬ дорого
   стоят браузеру (особенно Safari/macOS), а на странице 5-10 .panel,
   и каждая запускает re-paint всего слоя при скролле/анимации. */
.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border:1px solid var(--stroke);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  position:relative;
  overflow:hidden;
}

.panel > *{ position:relative; }

/* 2) ВЕРХНЯЯ ПОЛОСА (header.topbar) */
.topbar{
  padding: 12px 0 8px; /* меньше воздуха */
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

/* Лого: <a class="logo"> ... */
.logo{
  display:flex;
  align-items:center;
  gap:28px;
}

.logo__mark{
  width:245px;
  height:245px;
  flex: 0 0 245px;
  border-radius:42px;
  background:
    radial-gradient(18px 18px at 28% 35%, rgba(255,255,255,.6), transparent 55%),
    conic-gradient(from 210deg, var(--brand), var(--brand2), var(--good), var(--brand));
  box-shadow: 0 14px 40px rgba(var(--c-acc-1-rgb),.30);
  border:1px solid rgba(255,255,255,.18);
  position:relative;
}

.logo__text{
  margin-left: 8px;
}

.logo__mark::after{
  content:"</>";
  position:absolute; inset:0;
  display:grid; place-items:center;
  font-family: var(--mono);
  font-weight:900;
  font-size:13px;
  color: rgba(9,12,25,.92);
}

.logo__text b{
  display:block;
  font-size:15px;
  letter-spacing:.2px;
}

.logo__text small{
  display:block;
  margin-top:2px;
  color:var(--muted);
  font-size:12px;
}

/* Поиск: <div class="search"> ... */
.search{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: 999px;
  background: var(--card);
  border:1px solid var(--stroke);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  min-width: 420px;
}

.search__icon{ opacity:.75; }

.search__input{
  flex:1;
  background:transparent;
  border:0;
  outline:0;
  color: var(--text);
  font-size:13px;
}

.search__kbd{
  font-family: var(--mono);
  font-size:11px;
  padding:4px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(234,240,255,.78);
}

/* Блок кнопок справа: <div class="topbar__actions"> */
.topbar__actions{
  display:flex;
  align-items:center;
  gap:10px;
}

/* 3) КНОПКИ (class="btn") */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
  transition: transform .12s ease, border-color .12s ease;
}

.btn:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.24);
}

/* В твоём HTML: class="btn btn--primary" */
.btn--primary{
  border-color: rgba(var(--c-acc-1-rgb),.55);
  background:
    radial-gradient(60% 120% at 50% 0%, rgba(255,255,255,.22), transparent 58%),
    linear-gradient(135deg, rgba(var(--c-acc-1-rgb),.70), rgba(var(--c-acc-2-rgb),.28));
}

/* Точка внутри primary-кнопки: <span class="btn__dot"> */
.btn__dot{
  width:10px;height:10px;border-radius:999px;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(var(--c-acc-3-rgb),.14);
}

/* В твоём HTML: class="btn btn--ghost" */
.btn--ghost{
  border-color: rgba(var(--c-acc-1-rgb),.45);
  background: linear-gradient(135deg, rgba(var(--c-acc-1-rgb),.28), rgba(var(--c-acc-2-rgb),.10));
}

/* семантическая danger-кнопка (delete и т.п.) — мягкий красный с
   адаптацией под светлую тему */
.btn--danger{
  color: #ff7a8a;
  border-color: rgba(255,80,100,.45);
}
.btn--danger:hover{
  border-color: rgba(255,80,100,.75);
  background: rgba(255,80,100,.08);
}
body.light .btn--danger{
  color: #c41a3a;
  border-color: rgba(196,26,58,.45);
}
body.light .btn--danger:hover{
  background: rgba(196,26,58,.08);
  border-color: rgba(196,26,58,.70);
}

/* 4) ОСНОВНАЯ СЕТКА: <div class="container layout"> */
.layout{
  margin: 6px auto 24px; /* меньше отступы => ближе к краям */
  display:grid;
  grid-template-columns: 300px 1fr;
  gap:12px; /* меньше расстояние между колонками */
}

/* 5) ЛЕВАЯ ПАНЕЛЬ: <aside class="sidebar panel"> */
.sidebar{
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height: 660px;
}

.sidebar__nav{
  padding:12px;
  border-radius: var(--r2);
  background: rgba(0,0,0,.22);
  border:1px solid rgba(255,255,255,.12);
  display:flex;
  flex-direction:column;
  gap:8px;
}

.sidebar__link{
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: rgba(234,240,255,.86);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.sidebar__link:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
}

/* Активный пункт: class="sidebar__link is-active" */
.sidebar__link.is-active{
  border-color: rgba(var(--c-acc-1-rgb),.55);
  background: linear-gradient(135deg, rgba(var(--c-acc-1-rgb),.35), rgba(var(--c-acc-2-rgb),.12));
}

.sidebar__card{
  padding:12px;
  border-radius: var(--r2);
  background: rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.12);
}

.sidebar__cardTitle{
  font-weight:900;
  font-size:13px;
  margin-bottom:10px;
}

/* ===== Виджет стрика в сайдбаре ===== */
.streak-card{
  display:block;
  margin-top: 10px;
  text-decoration:none;
  color: inherit;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  border-radius: var(--r2);
  padding: 12px;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.streak-card:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.22);
}
.streak-card__top{
  display:flex;
  align-items:center;
  gap: 10px;
}
.streak-card__emoji{
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(255, 120, 40, .35));
}
.streak-card__counter{
  display:flex;
  flex-direction: column;
  line-height: 1.1;
}
.streak-card__num{
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .3px;
}
.streak-card__label{
  font-size: 11px;
  opacity: .72;
  letter-spacing: .2px;
}
.streak-card__rec{
  margin-top: 8px;
  font-size: 11px;
  opacity: .68;
}
/* Активный стрик (сегодня уже есть активность) — светится */
.streak-card--active{
  border-color: rgba(255, 150, 60, .50);
  background:
    radial-gradient(220px 120px at 20% 0%, rgba(255,140,50,.18), transparent 70%),
    rgba(0,0,0,.22);
  box-shadow: 0 10px 26px rgba(255, 120, 40, .18);
}
/* Холодный стрик (current = 0) — огонёк тусклый */
.streak-card--cold .streak-card__emoji{
  opacity: .35;
  filter: none;
}
body.light .streak-card{
  background: rgba(16,32,63,.04);
  border-color: rgba(16,32,63,.14);
}
body.light .streak-card--active{
  background:
    radial-gradient(220px 120px at 20% 0%, rgba(255,140,50,.22), transparent 70%),
    rgba(16,32,63,.04);
}

/* Прогресс: .progress__row .progress__bar .progress__fill */
.progress__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: rgba(234,240,255,.78);
  font-size:12px;
}

.progress__row b{
  font-family: var(--mono);
  font-weight:900;
  color: rgba(234,240,255,.92);
}

.progress__bar{
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  overflow:hidden;
  margin-top:10px;
}

.progress__fill{
  height:100%;
  border-radius:999px;
  width:0%;
  background: linear-gradient(90deg, var(--brand), var(--brand2), var(--good));
  box-shadow: 0 10px 30px rgba(var(--c-acc-1-rgb),.25);
}

.progress__hint{
  margin-top:10px;
  color: var(--muted);
  font-size:12px;
  line-height:1.35;
}

/* Нижний совет: .sidebar__tip */
.sidebar__tip{
  margin-top:auto;
  padding:12px;
  border-radius: var(--r2);
  background: rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.12);
  display:flex;
  gap:10px;
  align-items:flex-start;
}

.sidebar__tipBadge{
  width:34px;height:34px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  display:grid; place-items:center;
  font-family: var(--mono);
  font-weight:900;
}

.sidebar__tip p{
  margin:0;
  color: var(--muted);
  font-size:12px;
  line-height:1.35;
}

.sidebar__tip b{ color: rgba(234,240,255,.92); }

/* 6) ПРАВЫЙ КОНТЕНТ: <main class="content panel"> */
.content{
  padding:14px;
  min-height: 660px;
}

/* Hero: <section class="hero"> */
.hero{
  padding:16px;
  border-radius: var(--r);
  background:
    radial-gradient(90% 140% at 0% 0%, rgba(var(--c-acc-1-rgb),.25), transparent 58%),
    radial-gradient(90% 140% at 100% 0%, rgba(var(--c-acc-2-rgb),.18), transparent 58%),
    rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.12);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap: wrap;
  gap:14px;
}

.hero__title{
  margin:0;
  font-size:18px;
  letter-spacing:.2px;
}

.hero__desc{
  margin:8px 0 0;
  color: var(--muted);
  font-size:12px;
  line-height:1.45;
  max-width: 70ch;
}

.hero__right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* Badge: <span class="badge"> <span class="badge__lamp"> */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  font-size:12px;
  color: rgba(234,240,255,.86);
}

.badge__lamp{
  width:9px;height:9px;
  border-radius:999px;
  background: var(--c-acc-3, #ffcc66);
  box-shadow: 0 0 0 4px rgba(var(--c-acc-3-rgb, 255,204,102), .14);
}

/* 7) КАРТОЧКИ: <section class="cards"> <article class="card"> */
.cards{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}

.card{
  padding:14px;
  border-radius: var(--r);
  background: rgba(0,0,0,.22);
  border:1px solid rgba(255,255,255,.12);
  overflow:hidden;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.22);
  background: rgba(0,0,0,.26);
}

.card__top{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
}

.chip{
  padding:7px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(234,240,255,.82);
}

.chip--soft{
  border-color: rgba(var(--c-acc-1-rgb),.35);
  background: rgba(var(--c-acc-1-rgb),.10);
}

a.chip,
.chip--link{
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .12s ease, color .14s ease;
}
a.chip:hover,
.chip--link:hover{
  background: rgba(var(--c-acc-1-rgb),.18);
  border-color: rgba(var(--c-acc-1-rgb),.42);
  color: var(--c-acc-1);
  transform: translateY(-1px);
}
a.chip:active,
.chip--link:active{ transform: translateY(0); }

.card__title{
  margin:10px 0 6px;
  font-size:14px;
}
.card__title-link{
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .18s ease, color .15s ease, opacity .15s ease;
}

/* Заголовок задачи/варианта получает тематический акцент ТОЛЬКО
   если у пользователя выбрана не-original тёмная палитра
   (атрибут data-palette-dark на <html> ставит inline-скрипт base.html
   только при не-original значении). На базовой original тёмной —
   остаётся inherit (белый --text), как просил пользователь.
   На светлых темах тоже inherit. */
html[data-palette-dark] body:not(.light) .card__title-link{
  color: var(--c-acc-1);
}
html[data-palette-dark] body:not(.light) .card__title-link:hover{
  color: var(--c-acc-2);
}
.card__title-link:hover{
  background-size: 100% 1px;
  opacity: .92;
}
.card__title-link:focus-visible{
  outline: 2px solid rgba(var(--c-acc-1-rgb),.55);
  outline-offset: 3px;
  border-radius: 3px;
}

.card__text{
  margin:0;
  color: var(--muted);
  font-size:12px;
  line-height:1.45;
}

.card__bottom{
  margin-top:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.meta{
  color: rgba(234,240,255,.72);
  font-size:12px;
}

/* 8) АДАПТИВ */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ min-height:auto; }
  .search{ min-width: 0; width: 100%; }
  .topbar__inner{ flex-wrap:wrap; }
  .cards{ grid-template-columns: 1fr; }
}

@media (max-width: 760px){
  .container{
    width: min(1400px, calc(100vw - 24px));
  }

  .layout{
    margin: 4px auto 18px;
    gap: 10px;
  }

  .content{
    order: 1;
    min-height: auto;
    padding: 12px;
  }

  .sidebar{
    order: 2;
    min-height: auto;
    padding: 12px;
    gap: 10px;
  }

  .sidebar__nav{
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar__link{
    min-height: 48px;
    padding: 10px 8px;
    justify-content: center;
    text-align: center;
  }

  .sidebar__card,
  .sidebar__tip{
    padding: 10px;
  }

  .hero{
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .hero__desc{
    max-width: none;
  }

  .hero__right{
    width: 100%;
    justify-content: flex-start;
  }

  .card{
    padding: 12px;
  }

  .card__bottom{
    align-items: flex-start;
    flex-direction: column;
  }

  .result-head{
    padding-right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .result-chip{
    position: static;
    align-self: flex-start;
  }

  .result-grid{
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .result-grid--head{
    display: none;
  }

  .status-col{
    justify-content: flex-start;
  }
}

@media (max-width: 560px){
  .container{
    width: min(1400px, calc(100vw - 20px));
  }

  .topbar{
    padding: 10px 0 6px;
  }

  .topbar__inner{
    gap: 10px;
    align-items: flex-start;
  }

  .logo{
    gap: 18px;
    align-items: flex-start;
  }

  .logo__mark{
    width: 150px;
    height: 150px;
    flex: 0 0 150px;
    border-radius: 28px;
  }

  .logo__text b{
    font-size: 14px;
  }

  .logo__text small{
    font-size: 11px;
  }

  .hero__title{
    font-size: 17px;
  }

  .sidebar__nav{
    grid-template-columns: 1fr 1fr;
  }

  .sidebar__cardTitle,
  .result-title{
    font-size: 24px;
  }

  .result-subtitle{
    font-size: 16px;
  }
}

.result-card{
  margin-top: 16px;
  border-radius: 18px;
  padding: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.result-head{
  position: relative;
  padding-right: 160px;
}

.result-title{
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
}

.result-subtitle{
  margin-top: 6px;
  font-size: 18px;
  opacity: .85;
}

.result-chip{
  position: absolute;
  right: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 700;
}

.result-chip .dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-acc-2, #f4c84f);
  box-shadow: 0 0 0 4px rgba(var(--c-acc-2-rgb, 244,200,79), .15);
}

.result-grid{
  display: grid;
  grid-template-columns: 90px 1fr 1fr 160px;
  gap: 14px;
  align-items: center;
}

.result-grid--head{
  margin-top: 18px;
  padding: 10px 12px;
  font-size: 26px;
  font-weight: 800;
}

.result-row{
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.status-col{
  display: flex;
  justify-content: flex-end;
}

.pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  font-weight: 800;
}

.pill--ok{
  border-color: rgba(45,200,130,0.32);
}

.pill--bad{
  border-color: rgba(255,80,100,0.32);
}

.mono{
  font-variant-numeric: tabular-nums;
}

/* Общая плашка */
.pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  transition: background .2s ease, border-color .2s ease;
}

/* Верно — зелёная (мягче, без жёсткого неона; читается на любой палитре) */
.pill--ok {
  color: #5cd699;
  border: 1px solid rgba(45, 200, 130, 0.55);
  background: rgba(45, 200, 130, 0.08);
  box-shadow:
    0 0 8px  rgba(45, 200, 130, 0.32),
    0 0 18px rgba(45, 200, 130, 0.18),
    inset 0 0 8px rgba(45, 200, 130, 0.12);
}

/* Ошибка — красная (мягче) */
.pill--bad {
  color: #ff7a8a;
  border: 1px solid rgba(255, 80, 100, 0.60);
  background: rgba(255, 80, 100, 0.08);
  box-shadow:
    0 0 8px  rgba(255, 80, 100, 0.32),
    0 0 18px rgba(255, 80, 100, 0.18),
    inset 0 0 8px rgba(255, 80, 100, 0.12);
}

/* ==========================================================
   Универсальный safety-net для белого текста на акцентном фоне
   (variant-chip, vl-tab--active, cm__btn--yes.cm-active и т.п.)
   На ярких темах (Forest, Aurora, Ocean) белый сам по себе
   даёт <2:1 на светло-зелёном/циановом акценте — text-shadow
   создаёт тёмный halo и поднимает читаемость.
   ========================================================== */
.variant-chip,
.vl-tab--active,
.cm__btn--yes.cm-active{
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}

/* ========================================================
   КОНФЕТТИ при правильном ответе
   ======================================================== */
.confetti-canvas{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}
