:root { color-scheme: dark; }

body {
  background-color: #0d1117;
  color: #f0f6fc;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #262c36; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3b4454; }

:focus-visible { outline: 2px solid #f0843c; outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline-offset: 0; }

/* ---- Анимации кнопок главного меню и навигации ---- */
.nav-item {
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.nav-item:hover {
  transform: translateX(3px);
}
.nav-item:active {
  transform: scale(0.94) !important;
}
.nav-item .nav-icon {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  transform: scale(1.25) rotate(-8deg);
}
.nav-item.active {
  background-color: #1e2430;
  color: #f0843c;
  font-weight: 600;
  box-shadow: inset 0 0 18px rgba(240, 132, 60, 0.08);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background-color: #f0843c;
  border-radius: 0 3px 3px 0;
}

/* Универсальная пружинящая анимация для кнопок + волна клика */
button, .btn-interactive {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
button:not(:disabled):active, .btn-interactive:active {
  transform: scale(0.94);
}
.dash-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(240, 132, 60, 0.35);
}
.dash-action-btn:active {
  transform: scale(0.93) translateY(0);
}

.kpi-card {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}
.kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 132, 60, 0.4);
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.5);
}

.click-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
  background: radial-gradient(circle, rgba(240, 132, 60, 0.45) 0%, rgba(255, 255, 255, 0.15) 60%, transparent 100%);
  animation: rippleWave 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes rippleWave {
  to {
    transform: scale(3.5);
    opacity: 0;
  }
}

/* ---- Прогресс-бары и плашка цели ---- */
.bar-fill {
  height: 0%;
  transition: height 0.75s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.25s ease;
}

.progress-bar-animated {
  width: 0%;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.goal-banner-card {
  background: linear-gradient(135deg, rgba(240, 132, 60, 0.10) 0%, rgba(22, 27, 34, 0.95) 55%, rgba(63, 185, 80, 0.08) 100%);
  position: relative;
  overflow: hidden;
}
.goal-progress-shimmer {
  position: relative;
  overflow: hidden;
  transition: width 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}
.goal-progress-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-100%);
  animation: shimmerSlide 2.6s infinite;
}
@keyframes shimmerSlide {
  100% { transform: translateX(100%); }
}

@keyframes goalPulseBoost {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.5); }
  50% { transform: scale(1.015); box-shadow: 0 0 0 10px rgba(63, 185, 80, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
.goal-boost-anim {
  animation: goalPulseBoost 0.65s ease-out;
}

.pill-process { background-color: rgba(240,132,60,.14); color: #f0843c; border: 1px solid rgba(240,132,60,.35); }
.pill-not-started { background-color: rgba(248,81,73,.14); color: #f85149; border: 1px solid rgba(248,81,73,.35); }
.pill-done { background-color: rgba(63,185,80,.14); color: #3fb950; border: 1px solid rgba(63,185,80,.35); }
.pill-postponed { background-color: rgba(139,148,158,.14); color: #9aa4b0; border: 1px solid rgba(139,148,158,.35); }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-pane { animation: fadeSlideUp 0.28s ease-out forwards; }

@keyframes datePulse {
  0% { background-color: rgba(240,132,60,.35); color: #fff; }
  100% { background-color: transparent; }
}
.date-shifted-highlight { animation: datePulse 1.1s ease-out; border-radius: 6px; }

input[type="checkbox"] { accent-color: #f0843c; }

/* ---- Календарь, бюджеты, горячие клавиши ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { min-height: 92px; transition: border-color .15s ease, background-color .15s ease; }
.cal-cell:hover { border-color: #3b4454; }
.cal-drop { outline: 2px dashed #f0843c; outline-offset: -2px; background-color: rgba(240,132,60,.08) !important; }
[data-drag-id] { cursor: grab; }
[data-drag-id]:active { cursor: grabbing; }
.budget-fill { transition: width .6s cubic-bezier(0.22, 1, 0.36, 1), background-color .25s ease; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 1px 6px; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.5;
  background: #1c212b; border: 1px solid #262c36; border-bottom-width: 2px; border-radius: 5px; color: #f0f6fc;
}

/* ---- Стили модуля «Копилка-казино» ---- */
.casino-big {
  font-family: 'Unbounded', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 6vw, 40px);
  letter-spacing: -0.03em;
  color: #e9c46a;
  transition: color 0.3s ease, transform 0.3s ease;
}
.casino-big.win {
  color: #3fb950;
  transform: scale(1.06);
}
.casino-big.lose {
  color: #f85149;
  animation: casinoShake 0.4s;
}
@keyframes casinoShake {
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.casino-pend-card {
  border-color: #e9c46a !important;
  animation: casinoPulse 2s ease-in-out infinite;
}
@keyframes casinoPulse {
  50% { box-shadow: 0 0 0 5px rgba(233, 196, 106, 0.22); }
}

.casino-coin {
  width: 112px;
  height: 112px;
  margin: 8px auto 18px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  perspective: 600px;
}
.casino-coin .face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-content: center;
  font: 700 40px 'Unbounded', 'Inter', sans-serif;
  color: #2b1d00;
  background: radial-gradient(circle at 35% 30%, #f4d98a, #d4a72c);
  border: 4px solid #9e7818;
  backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.casino-coin .face.back {
  transform: rotateY(180deg);
}

.casino-track {
  position: relative;
  height: 16px;
  border-radius: 99px;
  background: #f85149;
  margin: 28px 4px 10px;
  overflow: visible;
}
.casino-track i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 99px 0 0 99px;
  background: #3fb950;
  transition: width 0.2s;
}
.casino-track b {
  position: absolute;
  top: -9px;
  width: 4px;
  height: 34px;
  margin-left: -2px;
  background: #f0f6fc;
  border-radius: 2px;
  left: 0;
  transition: left 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.casino-track em {
  position: absolute;
  top: -26px;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 12px;
  font-style: normal;
  opacity: 0;
  transition: opacity 0.3s;
}

.casino-ball {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  margin: 6px auto 16px;
  display: grid;
  place-content: center;
  font: 700 34px 'Unbounded', 'Inter', sans-serif;
  color: #fff;
  background: #2ec27e;
  border: 4px solid #e9c46a;
  transition: background 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.casino-ball.r { background: #e0566a; }
.casino-ball.b { background: #2d333b; }
.casino-ball.spin { animation: casinoSpin 0.5s linear infinite; }
@keyframes casinoSpin { to { transform: rotate(360deg); } }

.casino-float {
  position: fixed;
  left: 50%;
  top: 32%;
  z-index: 80;
  font: 700 30px 'Unbounded', 'Inter', sans-serif;
  pointer-events: none;
  animation: casinoFloatUp 1.5s ease-out forwards;
}
@keyframes casinoFloatUp {
  from { transform: translate(-50%, 0); opacity: 0; }
  15% { opacity: 1; }
  to { transform: translate(-50%, -90px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .progress-bar-animated, .budget-fill, .cal-cell, .goal-progress-shimmer { transition: none; }
  .tab-pane, .date-shifted-highlight, .goal-progress-shimmer::after { animation: none; }
}
/* ============================================================================
   ДОПОЛНЕНИЯ v3.1: 3D-монета, ачивки, помидоро, колесо, конфетти, ретро-режим
   ============================================================================ */

/* ---- Исправление 3D: perspective должен быть у РОДИТЕЛЯ вращающегося
      элемента. Раньше он стоял на самой монете и влиял только на её грани,
      из-за чего подброс выглядел плоским сжатием, а не переворотом. ---- */
.casino-coin-stage {
  perspective: 700px;
  perspective-origin: 50% 45%;
  display: flex;
  justify-content: center;
}
.casino-coin { perspective: none; }

/* ---- Конфетти ---- */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

/* ---- Достижения ---- */
.ach {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #262c36;
  background: #0d1117;
  cursor: help;
  transition: transform .18s cubic-bezier(.22,1,.36,1), border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.ach:hover { transform: translateY(-2px); border-color: #3b4454; }
.ach-on { border-color: rgba(240,132,60,.55); box-shadow: inset 0 0 16px rgba(240,132,60,.08); }
.ach-on .ach-icon { filter: none; transform: scale(1.06); }
.ach-off { opacity: .55; }
.ach-off .ach-icon { filter: grayscale(1) brightness(.75); }
.ach-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), filter .25s ease;
}
.ach-title {
  font-size: 11px;
  font-weight: 700;
  color: #f0f6fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ach-bar {
  height: 3px;
  margin: 4px 0 3px;
  border-radius: 99px;
  background: #262c36;
  overflow: hidden;
}
.ach-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f0843c, #e9c46a);
  transition: width .6s cubic-bezier(.22,1,.36,1);
}
.ach-sub { font: 500 9px/1 'JetBrains Mono', monospace; color: #6e7681; }

.streak-hot {
  border-color: rgba(240,132,60,.6) !important;
  animation: streakGlow 2.4s ease-in-out infinite;
}
@keyframes streakGlow {
  50% { box-shadow: 0 0 0 4px rgba(240,132,60,.10); }
}

/* ---- Помидоро-таймер ---- */
.pomo { transition: border-color .25s ease, box-shadow .25s ease; }
.pomo-running { border-color: rgba(240,132,60,.45); }
.pomo-break { border-color: rgba(63,185,80,.4); }
.pomo-ring {
  --p: 0%;
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-content: center;
  background: conic-gradient(#f0843c var(--p), #262c36 0);
  transition: background .4s linear;
}
.pomo-break .pomo-ring { background: conic-gradient(#3fb950 var(--p), #262c36 0); }
.pomo-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #0d1117;
}
.pomo-ring span {
  position: relative;
  font: 700 11px/1 'JetBrains Mono', monospace;
  color: #f0f6fc;
  letter-spacing: -.02em;
}
.pomo-running .pomo-ring span { color: #f0843c; }
.pomo-ring:focus-visible { outline: 2px solid rgba(240,132,60,.65); outline-offset: 3px; }
.pomo-break .pomo-ring span { color: #3fb950; }

/* ---- Колесо прокрастинатора ---- */
.wheel-stage { position: relative; display: flex; justify-content: center; }
.wheel-stage canvas { width: min(320px, 78vw); height: auto; display: block; }
.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: #f0843c;
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}

/* ---- Подсветка строки, к которой нас отправило колесо ---- */
.row-flash { animation: rowFlash 2.2s ease-out; }
@keyframes rowFlash {
  0%, 30% { background-color: rgba(240,132,60,.22); }
  100% { background-color: transparent; }
}

/* ---- Кнопки состояния ---- */
.sound-off { color: #6e7681 !important; border-color: #262c36 !important; }
.retro-on { color: #e9c46a !important; border-color: rgba(233,196,106,.5) !important; }

/* ---- Ретро-режим (пасхалка Konami) ----
      Без filter/hue-rotate на <body>: они ломают position:fixed у тостов и модалок. */
#retroScanlines {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
}
html.retro-mode #retroScanlines {
  opacity: 1;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.25) 2px 4px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%);
  animation: retroFlicker 4s steps(2, end) infinite;
}
@keyframes retroFlicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: .82; }
  98% { opacity: .95; }
}
html.retro-mode body { background-color: #07090f; }
html.retro-mode .nav-item.active,
html.retro-mode h1,
html.retro-mode h2 {
  text-shadow: 0 0 10px rgba(240,132,60,.55), 0 0 26px rgba(233,196,106,.25);
}
html.retro-mode .kpi-card { border-color: rgba(233,196,106,.28); }
html.retro-mode .goal-banner-card {
  background: linear-gradient(135deg, rgba(233,196,106,.16) 0%, rgba(10,12,20,.96) 55%, rgba(63,185,80,.14) 100%);
}
html.retro-mode .casino-big { text-shadow: 0 0 18px rgba(233,196,106,.5); }

@media (prefers-reduced-motion: reduce) {
  #confettiCanvas { display: none; }
  html.retro-mode #retroScanlines { animation: none; }
  .ach, .ach-icon, .pomo-ring, .row-flash, .streak-hot { animation: none; transition: none; }
  .casino-coin { transition: none; }
}


/* ============================================================================
   v4.0 — отдельный Помодоро, PWA и мобильная нижняя навигация
   ============================================================================ */
.pomo-hero {
  background:
    radial-gradient(circle at 50% 35%, rgba(240,132,60,.10), transparent 42%),
    #161b22;
}
.pomo-hero .pomo-ring {
  width: clamp(210px, 34vw, 280px);
  height: clamp(210px, 34vw, 280px);
  cursor: pointer;
  box-shadow: 0 24px 70px rgba(0,0,0,.35), 0 0 0 1px rgba(240,132,60,.08);
}
.pomo-hero .pomo-ring::before { inset: 13px; }
.pomo-hero .pomo-ring span {
  font-size: clamp(42px, 8vw, 66px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
}
.pomo-hero.pomo-running .pomo-ring {
  box-shadow: 0 24px 70px rgba(0,0,0,.35), 0 0 42px rgba(240,132,60,.13);
}
.pomo-hero.pomo-break {
  background: radial-gradient(circle at 50% 35%, rgba(63,185,80,.10), transparent 42%), #161b22;
}

/* На телефоне разделы всегда под большим пальцем. Лента горизонтально прокручивается. */
@media (max-width: 767px) {
  #appContainer > aside {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    width: 100%;
    border-top: 1px solid #262c36;
    border-bottom: 0;
    background: rgba(22,27,34,.97);
    box-shadow: 0 -12px 30px rgba(0,0,0,.28);
    backdrop-filter: blur(14px);
  }
  #appContainer > aside nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 3px;
    padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
    scrollbar-width: none;
  }
  #appContainer > aside nav::-webkit-scrollbar { display: none; }
  #appContainer > aside .nav-item {
    min-width: 88px;
    min-height: 52px;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 6px 8px;
    font-size: 10px;
    border-radius: 10px;
  }
  #appContainer > aside .nav-item > span.flex { flex-direction: column; gap: 3px; }
  #appContainer > aside .nav-item [id$="Badge"] { display: none; }
  #appContainer > aside .nav-item:hover { transform: none; }
  #appContainer > aside .nav-item.active::before {
    left: 22%; right: 22%; top: 0; bottom: auto; width: auto; height: 2px; border-radius: 0 0 3px 3px;
  }
  #appContainer > main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  #toastContainer { top: 4.5rem; left: .75rem; right: .75rem; width: auto; }
}

@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
}
