/* ─────────────────────────────────────────────────────────
   Фокус — тёмная системная эстетика.
   Двухтональность: циан = система (обвязка, уровни),
   фиолет = действие (кнопка старта, кольцо фокуса).
   ───────────────────────────────────────────────────────── */
:root {
  --bg: #05070d;
  --bg-2: #0a0f1a;
  --text: #e8f1ff;
  --muted: #7c8aa6;

  /* Системный акцент */
  --cyan: #38d9ff;
  --cyan-hi: #8eebff;
  --cyan-dim: rgba(56, 217, 255, 0.18);

  /* Акцент действия */
  --violet: #8b7cf6;
  --violet-2: #a78bfa;
  --violet-hi: #c4b5fd;

  --rest: #5dcaa5;
  --warn: #ffb84d;

  --surface: rgba(18, 30, 48, 0.55);
  --surface-2: rgba(28, 44, 68, 0.7);
  --border: rgba(56, 217, 255, 0.16);
  --border-soft: rgba(255, 255, 255, 0.07);

  --radius: 6px;
  --radius-lg: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font-display: "Exo 2", system-ui, -apple-system, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Глубина пространства: цианое свечение сверху, фиолетовое снизу, тонкая сетка. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -8%, rgba(56, 217, 255, 0.13), transparent 62%),
    radial-gradient(90% 55% at 50% 108%, rgba(139, 124, 246, 0.10), transparent 60%),
    var(--bg);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(120% 90% at 50% 20%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 20%, #000 30%, transparent 85%);
}

/* Дрейфующие частицы — генерируются в app.js. */
#particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#particles span {
  position: absolute; border-radius: 50%;
  background: var(--cyan); filter: blur(1.5px);
  animation: drift linear infinite;
}
@keyframes drift {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  15%  { opacity: 0.55; }
  85%  { opacity: 0.35; }
  100% { transform: translateY(-100vh) scale(0.7); opacity: 0; }
}

#app { position: relative; min-height: 100dvh; width: 100%; max-width: 480px; margin: 0 auto; }

/* ─── Экраны / переходы ─────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  max-width: 480px;
  margin: 0 auto;
  display: none;
  flex-direction: column;
  padding: calc(20px + var(--safe-t)) 22px calc(20px + var(--safe-b));
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.screen.is-active { display: flex; opacity: 1; }

/* ─── Splash ────────────────────────────────────────────── */
#splash { align-items: center; justify-content: center; }
.splash-orb {
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff, var(--cyan-hi) 35%, var(--cyan) 60%, transparent 74%);
  box-shadow: 0 0 70px 12px rgba(56, 217, 255, 0.4);
  animation: breathe 2.4s var(--ease) infinite;
}
@keyframes breathe { 0%,100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.05); opacity: 1; } }

/* ─── Auth ──────────────────────────────────────────────── */
.auth-wrap { margin: auto 0; display: flex; flex-direction: column; gap: 30px; }
.brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand-orb {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff, var(--cyan-hi) 38%, var(--cyan) 62%, transparent 76%);
  box-shadow: 0 0 50px 8px rgba(56, 217, 255, 0.45);
}
.brand-title {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 600; letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(56, 217, 255, 0.35);
}
.brand-sub { color: var(--muted); font-size: 15px; }

/* Базовая «системная панель»: стекло, цианый хайрлайн, внутреннее свечение.
   Свечение — слоем фона, а не псевдоэлементом: ::before/::after оставлены
   под угловые скобки. */
.card, .overall-panel, .attr-panel, .task-row, .project-row, .fvp-candidate {
  position: relative;
  background:
    linear-gradient(180deg, rgba(56,217,255,0.085), transparent 45%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* Размытие фона — только у крупных одиночных панелей.
   На строках списка оно дорого: длинный список ощутимо проседает на мобильном. */
.card, .overall-panel, .attr-panel, .fvp-candidate {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Угловые скобки — характерный признак «системного окна». */
.bracketed::before, .bracketed::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
}
.bracketed::before {
  top: -1px; left: -1px;
  border-top: 1.5px solid var(--cyan); border-left: 1.5px solid var(--cyan);
  border-radius: var(--radius) 0 0 0;
}
.bracketed::after {
  bottom: -1px; right: -1px;
  border-bottom: 1.5px solid var(--cyan); border-right: 1.5px solid var(--cyan);
  border-radius: 0 0 var(--radius) 0;
}

.card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }

.field {
  width: 100%;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 15px 16px;
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field::placeholder { color: var(--muted); }
.field:focus {
  outline: none; border-color: rgba(56,217,255,0.6);
  background: rgba(56,217,255,0.05);
  box-shadow: 0 0 0 3px rgba(56,217,255,0.10);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 15px;
  font-size: 16px; font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--violet-2), #6d5df0);
  box-shadow: 0 8px 26px -8px rgba(139,124,246,0.75);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, opacity 0.2s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; }

.btn-ghost {
  width: 100%;
  border: 1px solid rgba(56,217,255,0.28);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 15px;
  font-size: 16px; font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s;
}
.btn-ghost:active { transform: scale(0.97); background: var(--surface-2); border-color: rgba(56,217,255,0.5); }

.link {
  background: none; border: none; color: var(--cyan-hi);
  font-size: 15px; cursor: pointer; text-align: center; padding: 4px;
}
.link-quiet { color: var(--muted); }
.auth-error { color: var(--warn); font-size: 14px; text-align: center; }

/* ─── Topbar ────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; }
.streak {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 13px; border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(12px);
}
.streak-flame { color: var(--cyan-hi); font-size: 14px; text-shadow: 0 0 10px rgba(56,217,255,0.7); }
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 0.2s, transform 0.15s var(--ease), border-color 0.2s;
}
.icon-btn:active { transform: scale(0.92); background: var(--surface-2); border-color: rgba(56,217,255,0.45); }

/* ─── Главный экран ─────────────────────────────────────── */
.home-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }

/* Кнопка действия — единственный тёплый фиолетовый объект на экране. */
.start-btn {
  position: relative;
  width: 244px; height: 244px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #fff;
  font-family: var(--font-display);
  background:
    radial-gradient(circle at 50% 35%, var(--violet-hi) 0%, var(--violet-2) 40%, #6d5df0 78%, #5b49d6 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.14) inset,
    0 20px 60px -12px rgba(139,124,246,0.7),
    0 0 80px 4px rgba(139,124,246,0.32);
  transition: transform 0.18s var(--ease), box-shadow 0.3s;
  animation: pulse 3.6s var(--ease) infinite;
}
.start-btn::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 1px solid rgba(56,217,255,0.22);
}
.start-btn:active { transform: scale(0.95); box-shadow: 0 12px 40px -12px rgba(139,124,246,0.7); }
.start-label { font-size: 30px; font-weight: 600; letter-spacing: 0.01em; }
.start-mins { font-size: 15px; opacity: 0.85; font-weight: 400; letter-spacing: 0.02em; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.14) inset, 0 20px 60px -12px rgba(139,124,246,0.7), 0 0 80px 4px rgba(139,124,246,0.28); }
  50%      { box-shadow: 0 0 0 1px rgba(255,255,255,0.14) inset, 0 20px 60px -12px rgba(139,124,246,0.7), 0 0 100px 12px rgba(139,124,246,0.44); }
}

.today-line { color: var(--muted); font-size: 15px; text-align: center; }

.dayfocus { padding-top: 8px; }
.dayfocus-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  color: var(--text); font-size: 15px;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.dayfocus-input::placeholder { color: var(--muted); }
.dayfocus-input:focus {
  outline: none; border-color: rgba(56,217,255,0.55);
  box-shadow: 0 0 0 3px rgba(56,217,255,0.10);
}

/* ─── Таймер ────────────────────────────────────────────── */
#running { align-items: center; justify-content: center; gap: 30px; }

.timer-wrap { position: relative; width: 300px; height: 300px; display: grid; place-items: center; }
.ring { width: 300px; height: 300px; transform: rotate(-90deg); }

/* Засечки — тонкая шкала, задаёт «приборный» характер. */
.ring-ticks line { stroke: rgba(255,255,255,0.14); stroke-width: 1; }
.ring-ticks line.major { stroke: rgba(56,217,255,0.40); stroke-width: 1.6; }

.ring-bg { fill: none; stroke: rgba(255,255,255,0.055); stroke-width: 6; }

/* Широкий размытый след под прогрессом создаёт объёмное свечение. */
.ring-glow {
  fill: none; stroke: var(--violet); stroke-width: 14; stroke-linecap: round;
  opacity: 0.30; filter: blur(9px);
  stroke-dasharray: 703.72; stroke-dashoffset: 703.72;
  transition: stroke-dashoffset 1s linear;
}
.ring-fg {
  fill: none; stroke: url(#ring-grad); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 703.72; stroke-dashoffset: 703.72;
  transition: stroke-dashoffset 1s linear;
}
.ring-head {
  fill: #EDE9FF; filter: drop-shadow(0 0 7px rgba(196,181,253,0.95));
  transition: transform 1s linear;
  transform-origin: 130px 130px;
}

.timer-center { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.timer-text {
  font-family: var(--font-display);
  font-size: 62px; font-weight: 300; letter-spacing: 0.01em; line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 28px rgba(139,124,246,0.40);
}
.timer-sub {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}

.ask {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 24px;
  background: rgba(5,7,13,0.74); backdrop-filter: blur(10px);
}
.ask-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; }
.ask-actions { display: flex; flex-direction: column; gap: 12px; width: 220px; }

/* ─── Микро-награда ─────────────────────────────────────── */
.reward {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: rgba(5,7,13,0.88); backdrop-filter: blur(12px);
  animation: fadein 0.3s var(--ease);
}
.reward-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff, var(--violet-hi) 45%, var(--violet) 70%, transparent 80%);
  box-shadow: 0 0 90px 20px rgba(139,124,246,0.6);
  animation: reward-pop 0.6s var(--ease);
}
.reward-text { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
@keyframes reward-pop { 0% { transform: scale(0.2); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ─── Шторки ────────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); animation: fadein 0.25s var(--ease); }
.sheet {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--bg-2);
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  padding: 12px 22px calc(26px + var(--safe-b));
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,0.7);
  animation: sheet-up 0.35s var(--ease);

  /* Шторка прибита к низу и растёт вверх. Без ограничения высоты содержимое
     уходит за верхнюю границу экрана и становится недоступным — именно так
     пропадали название задачи и блок шагов. */
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Полоса прокрутки внутри шторки не должна спорить с оформлением. */
.sheet::-webkit-scrollbar { width: 3px; }
.sheet::-webkit-scrollbar-thumb { background: rgba(56,217,255,0.28); border-radius: 999px; }
/* Верхняя граница шторки — светящийся градиент, а не сплошная линия. */
.sheet::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,217,255,0.55), transparent);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
/* Ручка липнет к верху: при прокрутке длинной шторки остаётся видимой,
   и всегда понятно, где её край. */
.sheet-handle {
  position: sticky; top: 0; z-index: 1;
  width: 100%; padding: 4px 0 12px; margin: 0 0 6px;
  background: var(--bg-2);
}
.sheet-handle::after {
  content: ""; display: block; width: 40px; height: 4px; margin: 0 auto;
  border-radius: 999px; background: rgba(255,255,255,0.18);
}
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.row-title { font-size: 16px; font-weight: 500; }
.row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sheet-hint { font-size: 13px; color: var(--muted); padding-top: 10px; }
.sheet-logout { margin-top: 18px; }

.time-input {
  background: rgba(255,255,255,0.035); border: 1px solid var(--border-soft); color: var(--text);
  border-radius: var(--radius); padding: 8px 12px; font-size: 16px;
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
}
.time-input:focus { outline: none; border-color: rgba(56,217,255,0.55); }

/* Переключатель */
.toggle { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255,255,255,0.12); transition: background 0.25s var(--ease), box-shadow 0.25s;
}
.toggle-track::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease);
}
.toggle input:checked + .toggle-track {
  background: linear-gradient(180deg, var(--violet-2), var(--violet));
  box-shadow: 0 0 16px -2px rgba(139,124,246,0.7);
}
.toggle input:checked + .toggle-track::before { transform: translateX(20px); }

/* ─── Топбар: действия и заголовок ──────────────────────── */
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; letter-spacing: 0.02em;
}
.topbar-spacer { width: 42px; }
.topbar-date { font-size: 14px; color: var(--muted); }

/* ─── Текущая задача на главном ─────────────────────────── */
.focus-task {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  max-width: 300px; text-align: center;
}
.focus-task-label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan-hi);
  text-shadow: 0 0 12px rgba(56,217,255,0.5);
}
.focus-task-title { font-size: 18px; font-weight: 500; line-height: 1.3; }

.running-task { color: var(--violet-hi); font-size: 16px; font-weight: 500; text-align: center; max-width: 300px; margin-bottom: 4px; }

/* ─── Списки задач ──────────────────────────────────────── */
#tasks { padding-top: calc(16px + var(--safe-t)); }
.braindump { padding: 8px 0 14px; }
.tasks-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; padding-bottom: 12px; }
.tasks-actions { padding-top: 12px; }

.tasks-group-title, .tasks-date-head, .section-head {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.tasks-group-title { margin-bottom: 10px; }
.tasks-date-head { margin: 4px 0 10px; }
.section-head { margin: 26px 0 6px; }
.tasks-empty { color: var(--muted); font-size: 15px; text-align: center; padding: 40px 0; }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 8px;
  transition: background 0.2s, border-color 0.2s;
}
.task-row.is-current {
  border-color: rgba(139,124,246,0.5);
  background: rgba(139,124,246,0.09);
  box-shadow: 0 0 24px -10px rgba(139,124,246,0.8);
}
.task-title-text { flex: 1; font-size: 15px; line-height: 1.35; word-break: break-word; }
.task-title-text.is-done { opacity: 0.4; text-decoration: line-through; }

.task-btn {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--radius);
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.03);
  color: var(--text); transition: background 0.2s, transform 0.15s var(--ease), border-color 0.2s;
}
.task-btn:active { transform: scale(0.9); }
.task-btn.play {
  color: #fff; border: none;
  background: linear-gradient(180deg, var(--violet-2), #6d5df0);
  box-shadow: 0 4px 14px -4px rgba(139,124,246,0.8);
}
.task-btn.del { color: var(--muted); }

.chain-index {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  background: rgba(139,124,246,0.2); color: var(--violet-hi);
}

.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.task-tag.is-overdue { color: var(--warn); }  /* спокойный янтарь, не красный */
.task-tag.is-today { color: var(--cyan-hi); }
.project-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ─── FVP-оверлей ───────────────────────────────────────── */
.fvp-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(5,7,13,0.92); backdrop-filter: blur(14px);
  animation: fadein 0.25s var(--ease);
}
.fvp-card { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.fvp-q { font-size: 15px; color: var(--muted); }
.fvp-candidate {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 500; line-height: 1.25;
  border-color: rgba(139,124,246,0.4);
  padding: 26px 20px;
  box-shadow: 0 0 40px -14px rgba(139,124,246,0.9);
}
.fvp-vs { font-size: 14px; color: var(--muted); }
.fvp-vs span { color: var(--text); }
.fvp-actions { display: flex; gap: 12px; margin-top: 4px; }
.fvp-actions .btn-primary, .fvp-actions .btn-ghost { flex: 1; }
.fvp-progress { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ask-task-title { font-size: 19px; font-weight: 500; text-align: center; max-width: 300px; line-height: 1.3; }

/* ─── Нижняя навигация ──────────────────────────────────── */
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(10, 15, 26, 0.92);
  backdrop-filter: blur(22px);
  padding-bottom: var(--safe-b);
}
.tabbar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,217,255,0.4), transparent);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 11px 4px 9px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 500;
  transition: color 0.2s var(--ease);
}
.tab.is-active { color: var(--cyan-hi); }
/* Световая черта над активной вкладкой. */
.tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px; border-radius: 999px;
  background: var(--cyan); box-shadow: 0 0 10px 1px rgba(56,217,255,0.9);
}
.tab.is-active svg { filter: drop-shadow(0 0 7px rgba(56,217,255,0.6)); }
.tab:active { transform: scale(0.94); }
.tab-badge {
  position: absolute; top: 7px; left: 50%; margin-left: 7px;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--violet); color: #fff;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600; line-height: 17px; text-align: center;
}

.screen.has-tabs { padding-bottom: calc(76px + var(--safe-b)); }

/* ─── Фильтры и чипы ────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chip.is-active {
  background: rgba(56,217,255,0.14); border-color: rgba(56,217,255,0.45);
  color: var(--cyan-hi); box-shadow: 0 0 18px -6px rgba(56,217,255,0.8);
}
.chip:active { transform: scale(0.95); }

.quick-add { padding: 10px 0 12px; }

/* Палитра проектов и показателей */
.c-violet { background: #8b7cf6; }
.c-cyan   { background: #38d9ff; }
.c-blue   { background: #378add; }
.c-teal   { background: #5dcaa5; }
.c-green  { background: #7fd858; }
.c-amber  { background: #ffb84d; }
.c-coral  { background: #ff7a59; }
.c-pink   { background: #ff6fa5; }
.c-gray   { background: #8aa0b8; }

/* ─── Профиль ───────────────────────────────────────────── */
.profile-scroll { flex: 1; overflow-y: auto; }
.profile-email {
  font-size: 15px; color: var(--muted); padding: 6px 0 16px;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 6px;
}

/* ─── Шторки: задача и проекты ──────────────────────────── */
.sheet-title-input {
  width: 100%; background: none; border: none; color: var(--text);
  font-family: var(--font-display);
  font-size: 20px; font-weight: 500; padding: 4px 0 14px;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 6px;
}
.sheet-title-input:focus { outline: none; border-color: rgba(56,217,255,0.6); }
/* ─── Шаги задачи ───────────────────────────────────────── */
.subtasks { padding: 6px 0 10px; }
.subtasks-head { display: flex; align-items: baseline; justify-content: space-between; }
.subtasks-head .section-head { margin: 6px 0; }
.subtasks-progress {
  font-family: var(--font-display); font-size: 12px; color: var(--cyan-hi);
  font-variant-numeric: tabular-nums;
}
.subtask-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft);
}
.subtask-check {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.03);
  color: transparent; transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.subtask-check.is-done {
  background: rgba(93,202,165,0.2); border-color: rgba(93,202,165,0.6); color: var(--rest);
}
.subtask-title { flex: 1; font-size: 14px; line-height: 1.35; word-break: break-word; }
.subtask-title.is-done { opacity: 0.42; text-decoration: line-through; }
.subtask-del {
  width: 26px; height: 26px; flex-shrink: 0; border: none; background: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.subtask-input {
  width: 100%; margin-top: 10px;
  background: rgba(255,255,255,0.035); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 11px 13px;
  color: var(--text); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.subtask-input::placeholder { color: var(--muted); }
.subtask-input:focus {
  outline: none; border-color: rgba(56,217,255,0.55);
  box-shadow: 0 0 0 3px rgba(56,217,255,0.10);
}

/* Прогресс шагов в списке задач */
.task-tag.is-steps { color: var(--cyan-hi); }

.notes-input {
  width: 100%; margin-top: 14px; resize: vertical; min-height: 66px;
  background: rgba(255,255,255,0.035); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 13px;
  color: var(--text); font-size: 14px; line-height: 1.45;
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.notes-input::placeholder { color: var(--muted); }
.notes-input:focus {
  outline: none; border-color: rgba(56,217,255,0.55);
  box-shadow: 0 0 0 3px rgba(56,217,255,0.10);
}

.project-editor {
  border-top: 1px solid var(--border-soft);
  padding-top: 14px; margin-bottom: 14px;
}
.project-editor .sheet-actions { margin-top: 12px; }
.project-row { cursor: pointer; }

.quick-dates { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0 4px; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.projects-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 46vh; overflow-y: auto; }
.project-row { display: flex; align-items: center; gap: 11px; padding: 12px 14px; }
.project-name { flex: 1; font-size: 15px; }
.project-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

select.time-input { max-width: 190px; }

/* ─── Настройки таймера ─────────────────────────────────── */
.preset-row { display: flex; gap: 8px; padding: 4px 0 8px; }
.num-field { display: flex; align-items: center; gap: 7px; }
.num-unit { font-size: 13px; color: var(--muted); }
.time-input.num { width: 72px; text-align: center; -moz-appearance: textfield; }
.time-input.num::-webkit-outer-spin-button,
.time-input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ─── Вкладка «Статус» ──────────────────────────────────── */
.overall-panel { padding: 16px 18px 15px; margin: 6px 0 16px; overflow: visible; }
.overall-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.overall-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.overall-level {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 600; line-height: 1.1; color: var(--cyan-hi);
  text-shadow: 0 0 20px rgba(56,217,255,0.6); font-variant-numeric: tabular-nums;
}
.overall-today {
  font-family: var(--font-display);
  font-size: 13px; color: var(--cyan-hi); font-variant-numeric: tabular-nums;
}
.overall-xp {
  font-size: 12px; color: var(--muted); margin-top: 8px;
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
}

.attr-panel { padding: 14px 15px; margin-bottom: 10px; }
.attr-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.attr-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.attr-name { flex: 1; font-size: 16px; font-weight: 500; }
.attr-level {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600; color: var(--cyan-hi);
  background: rgba(56,217,255,0.14); border: 1px solid rgba(56,217,255,0.3);
  padding: 3px 9px; border-radius: 999px;
}
.icon-btn.small { width: 30px; height: 30px; }

.attr-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.attr-bar-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.6s var(--ease); }
.attr-meta {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-size: 12px; color: var(--muted);
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
}
.attr-today { color: var(--cyan-hi); }

.counters { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.counter-row { display: flex; align-items: center; gap: 10px; }
.counter-name { flex: 1; font-size: 14px; color: var(--text); }
.counter-btns { display: flex; gap: 6px; }
.counter-btn {
  min-width: 44px; height: 32px; padding: 0 10px; border-radius: var(--radius);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.counter-btn:active { transform: scale(0.92); }
.counter-btn.is-hit {
  background: rgba(56,217,255,0.22); border-color: rgba(56,217,255,0.65); color: var(--cyan-hi);
  box-shadow: 0 0 20px -4px rgba(56,217,255,0.9);
}

/* ─── Квесты: дневная норма счётчика ────────────────────── */
.counter-block { display: flex; flex-direction: column; gap: 6px; }
.quest { display: flex; align-items: center; gap: 9px; padding-left: 1px; }
.quest-bar { flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.quest-fill {
  display: block; height: 100%; border-radius: 999px;
  background: var(--cyan); transition: width 0.5s var(--ease);
}
.quest-fill.is-done { background: var(--rest); box-shadow: 0 0 10px rgba(93,202,165,0.7); }
.quest-num {
  font-family: var(--font-display); font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.quest-num.is-done { color: var(--rest); }

/* ─── Детальный экран показателя ────────────────────────── */
.detail-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 22px; }
.detail-ring { position: relative; width: 168px; height: 168px; display: grid; place-items: center; }
.detail-ring svg { width: 168px; height: 168px; transform: rotate(-90deg); }
.detail-ring .track { fill: none; stroke: rgba(255,255,255,0.07); stroke-width: 7; }
.detail-ring .fill {
  fill: none; stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 452.39; transition: stroke-dashoffset 0.7s var(--ease);
}
.detail-level {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-display);
}
.detail-level b { font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.detail-level span { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.detail-xp { font-size: 13px; color: var(--muted); font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* График активности: столбики без тепловых карт и лишней аналитики. */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 76px; padding: 4px 0 0; }
.chart-bar {
  flex: 1; min-width: 0; border-radius: 2px 2px 0 0;
  background: rgba(56,217,255,0.25); transition: height 0.5s var(--ease);
}
.chart-bar.is-today { background: var(--cyan); box-shadow: 0 0 10px rgba(56,217,255,0.8); }
.chart-bar.is-empty { background: rgba(255,255,255,0.05); }
.chart-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.detail-counter {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.detail-counter-name { font-size: 15px; }
.detail-counter-total {
  font-family: var(--font-display); font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--cyan-hi);
}
.detail-counter-sub { font-size: 12px; color: var(--muted); }

.log-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px;
}
.log-amount { font-family: var(--font-display); color: var(--cyan-hi); font-variant-numeric: tabular-nums; }
.log-when { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ─── Статистика ────────────────────────────────────────── */
.stat-hero {
  position: relative;
  background: linear-gradient(180deg, rgba(56,217,255,0.10), transparent 55%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 18px; margin: 8px 0 14px; text-align: center;
}
.stat-hero-label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.stat-hero-value {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600; color: var(--cyan-hi); margin-top: 6px;
  text-shadow: 0 0 22px rgba(56,217,255,0.55); font-variant-numeric: tabular-nums;
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-card b {
  font-family: var(--font-display); font-size: 24px; font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-card span { font-size: 12px; color: var(--muted); }
.stat-note { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* Тепловая карта года: 53 колонки по 7 дней. */
.heatmap {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr); grid-auto-columns: 1fr;
  gap: 2px; padding: 4px 0 2px;
}
.hm-cell { aspect-ratio: 1; border-radius: 2px; background: rgba(255,255,255,0.05); }
.hm-l1 { background: rgba(56,217,255,0.25); }
.hm-l2 { background: rgba(56,217,255,0.45); }
.hm-l3 { background: rgba(56,217,255,0.68); }
.hm-l4 { background: var(--cyan); box-shadow: 0 0 6px rgba(56,217,255,0.55); }
.hm-cell.is-future { opacity: 0.25; }
.hm-cell.is-today { outline: 1px solid var(--cyan-hi); outline-offset: 1px; }

.hm-legend {
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
  font-size: 11px; color: var(--muted); margin-top: 8px;
}
.hm-legend .hm-cell { width: 10px; height: 10px; aspect-ratio: auto; }

/* Распределение времени — одна полоса вместо круговой диаграммы. */
.split-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,0.05); margin: 4px 0 12px;
}
.split-part { display: block; height: 100%; }
.split-legend { display: flex; flex-direction: column; gap: 8px; }
.split-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.split-name { flex: 1; }
.split-mins {
  font-family: var(--font-display); font-size: 13px; color: var(--cyan-hi);
  font-variant-numeric: tabular-nums;
}

/* ─── История сессий ────────────────────────────────────── */
.history-day { margin-bottom: 22px; }
.history-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}
.history-date {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.history-total {
  font-family: var(--font-display); font-size: 12px; color: var(--cyan-hi);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.history-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0; font-size: 14px;
}
.history-row.is-break { opacity: 0.55; }
.history-time {
  font-family: var(--font-display); font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; width: 42px; flex-shrink: 0;
}
.history-title { flex: 1; min-width: 0; word-break: break-word; }
.history-mins {
  font-family: var(--font-display); font-size: 13px; color: var(--cyan-hi);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.history-row.is-break .history-mins { color: var(--rest); }
.history-partial {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 1px 7px; margin-left: 4px; white-space: nowrap;
}

.color-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 0 4px; }
.color-dot {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.15s var(--ease), border-color 0.2s;
}
.color-dot.is-active { border-color: #fff; transform: scale(1.12); }
.counter-form-row { display: flex; gap: 8px; margin: 10px 0; }
.counter-form-row .time-input { flex: 1; max-width: none; }

/* ─── Повышение уровня ──────────────────────────────────── */
.levelup {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(5,7,13,0.92); backdrop-filter: blur(14px);
  animation: fadein 0.3s var(--ease);
}
.levelup-rings { position: absolute; width: 260px; height: 260px; }
.levelup-rings span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(56,217,255,0.7);
  animation: ring-out 1.8s var(--ease) infinite;
}
.levelup-rings span:nth-child(2) { animation-delay: 0.35s; }
.levelup-rings span:nth-child(3) { animation-delay: 0.7s; }
@keyframes ring-out {
  0%   { transform: scale(0.25); opacity: 0; }
  25%  { opacity: 0.9; }
  100% { transform: scale(1); opacity: 0; }
}
.levelup-level {
  position: relative;
  font-family: var(--font-display);
  font-size: 36px; font-weight: 600; color: var(--cyan-hi);
  text-shadow: 0 0 28px rgba(56,217,255,0.8); letter-spacing: 0.03em;
}
.levelup-name { position: relative; font-size: 16px; color: var(--muted); }

/* ─── Режим перерыва ────────────────────────────────────── */
#running.is-break .ring-fg { stroke: url(#ring-grad-break); }
#running.is-break .ring-glow { stroke: #3FB48D; }
#running.is-break .ring-head { fill: #DFF7EE; filter: drop-shadow(0 0 7px rgba(159,225,203,0.95)); }
#running.is-break .ring-ticks line.major { stroke: rgba(159,225,203,0.42); }
#running.is-break .timer-text { text-shadow: 0 0 28px rgba(93,202,165,0.4); }
#running.is-break .running-task { color: #9fe1cb; }
.break-label {
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #9fe1cb; text-align: center;
  text-shadow: 0 0 14px rgba(93,202,165,0.6);
}

/* ─── Уведомления и статус связи ────────────────────────── */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 16px; border-radius: var(--radius);
  background: rgba(28, 44, 68, 0.96);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  font-size: 14px; line-height: 1.35; text-align: center;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.8);
  animation: toast-in 0.28s var(--ease);
}
.toast.is-error { border-color: rgba(255, 184, 77, 0.45); color: #ffd9a0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.offline-bar {
  position: fixed; z-index: 91; top: 0; left: 0; right: 0;
  padding: calc(6px + var(--safe-t)) 12px 6px;
  background: rgba(255, 184, 77, 0.16);
  border-bottom: 1px solid rgba(255, 184, 77, 0.35);
  color: #ffd9a0; font-size: 12px; text-align: center;
  backdrop-filter: blur(12px);
}

[hidden] { display: none !important; }
