/* ──────────────────────────────────────────────────────────────
   Push-up Tracker — light + dark via CSS custom properties.
   Палитра: индиго / оранж в светлой; фиолетово-оранжевая в тёмной.
   ────────────────────────────────────────────────────────────── */

:root {
  --bg:        #f7f8fc;
  --surface:   #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e8ebf3;
  --border:    #e3e6ef;
  --text:      #0f172a;
  --muted:     #64748b;
  --primary:   #6366f1;
  --primary-2: #8b5cf6;
  --primary-fg:#ffffff;
  --accent:    #f97316;
  --accent-2:  #ef4444;
  --success:   #10b981;
  --danger:    #ef4444;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:    0 1px 3px rgba(15, 23, 42, .05), 0 10px 30px -10px rgba(15, 23, 42, .12);
  --shadow-lg: 0 1px 3px rgba(15, 23, 42, .06), 0 20px 50px -12px rgba(99, 102, 241, .18);
  --radius:    18px;
  --radius-sm: 14px;
  --gap:       16px;
  --ease:      cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg:        #0a0a12;
  --surface:   #14141d;
  --surface-2: #1c1c28;
  --surface-3: #252533;
  --border:    #2a2a38;
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --primary:   #a78bfa;
  --primary-2: #818cf8;
  --primary-fg:#0a0a12;
  --accent:    #fb923c;
  --accent-2:  #f87171;
  --success:   #34d399;
  --danger:    #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 1px 3px rgba(0, 0, 0, .5), 0 10px 30px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 1px 3px rgba(0, 0, 0, .6), 0 20px 50px -12px rgba(167, 139, 250, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .35s var(--ease), color .35s var(--ease);
  position: relative;
  overflow-x: hidden;
}

/* ─── Декоративный фон ────────────────────────────────────── */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  animation: blobFloat 18s ease-in-out infinite alternate;
}
.bg-blob--a {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--primary), transparent 70%);
  top: -180px; left: -120px;
}
.bg-blob--b {
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: 40%; right: -140px;
  animation-delay: -6s;
}
@keyframes blobFloat {
  0%   { transform: translate(0,0)        scale(1); }
  100% { transform: translate(40px, 30px) scale(1.08); }
}
[data-theme="dark"] .bg-blob { opacity: .22; }

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 940px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__emoji {
  font-size: 26px;
  display: inline-block;
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0)   rotate(0); }
  50%      { transform: translateY(-3px) rotate(-6deg); }
}
.brand__txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: .2px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), background-color .2s ease, box-shadow .2s ease;
}
.iconbtn:hover { background: var(--surface-2); box-shadow: var(--shadow); }
.iconbtn:active { transform: scale(.94); }

/* ─── Layout ──────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  padding: 4px 24px 48px;
  display: grid;
  gap: var(--gap);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ─── HERO (компактный) ───────────────────────────────────── */
.hero { display: flex; flex-direction: column; gap: 16px; }
.hero__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
}
.hero__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hero__date {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.3px;
}

/* Цель — компактная inline-полоска */
.goal-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  width: fit-content;
}
.goal-inline__lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 0 8px 0 6px;
}
.goal__step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: background-color .15s ease, color .15s ease;
}
.goal__step:hover { background: var(--surface); color: var(--text); }
.goal-inline input {
  width: 56px;
  text-align: center;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.goal-inline input::-webkit-outer-spin-button,
.goal-inline input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Правая часть hero: кольцо + streak рядом */
.hero__progress {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero__ring {
  position: relative;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring__track {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 10;
}
.ring__fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 289.027;       /* 2π·46 */
  stroke-dashoffset: 289.027;
  transition: stroke-dashoffset .9s var(--ease);
}
.ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring__count {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--primary);
}
.ring__goal {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}
.ring__pct {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Streak — нейтральный по умолчанию, "горячий" при streak ≥ 3 */
.hero__streak {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 110px;
  box-shadow: var(--shadow-sm);
  transition: background .3s var(--ease), border-color .3s var(--ease), transform .25s var(--ease);
}
.hero__streak.is-hot {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  transform: scale(1.02);
}
.streak__flame {
  font-size: 22px;
  display: inline-block;
  transform-origin: 50% 90%;
}
.hero__streak.is-hot .streak__flame { animation: flicker 1.4s ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { transform: scale(1)    rotate(-3deg); }
  50%      { transform: scale(1.12) rotate(3deg); }
}
.streak__txt {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.streak__num {
  font-size: 22px;
  font-weight: 800;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.streak__lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 3px;
  color: var(--muted);
}
.hero__streak.is-hot .streak__lbl { color: rgba(255,255,255,.85); }

/* Форма добавления */
.adder {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.stepper { display: flex; gap: 6px; }
.step {
  width: 42px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease, transform .1s ease, border-color .15s ease;
}
.step:hover { background: var(--surface-3); border-color: var(--primary); }
.step:active { transform: scale(.94); }
.adder input {
  height: 44px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  outline: none;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.adder input::-webkit-outer-spin-button,
.adder input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.adder input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }

.primary {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-fg);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .12s var(--ease), box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--primary) 60%, transparent);
}
.primary:hover { filter: brightness(1.05); box-shadow: 0 6px 20px -4px color-mix(in srgb, var(--primary) 70%, transparent); }
.primary:active { transform: scale(.97); }
.primary:disabled { opacity: .7; cursor: progress; }

.quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.quick__lbl {
  margin-right: 2px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, transform .1s ease, border-color .15s ease, color .15s ease;
}
.chip:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-2));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}
.chip:active { transform: scale(.94); }

/* ─── STATS ───────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 6%, transparent), transparent 60%);
  pointer-events: none;
}
.stat__icon {
  font-size: 20px;
  display: block;
  margin-bottom: 2px;
}
.stat__label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 600;
}
.stat__value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.stat__hint {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

/* ─── CHART (компактный) ──────────────────────────────────── */
.chart { padding: 18px 20px; }
.chart__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chart__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.chart__wrap { position: relative; }
.chart__svg {
  width: 100%;
  height: 110px;
  display: block;
}
.chart__bar {
  fill: color-mix(in srgb, var(--primary) 70%, var(--surface-3));
  rx: 3;
  transition: fill .15s ease;
  cursor: pointer;
}
.chart__bar:hover { fill: var(--primary); }
.chart__bar.is-today { fill: var(--accent); }
.chart__axis {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
.chart__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 110px;
  color: var(--muted);
  font-size: 13px;
}
.chart__empty[hidden] { display: none; }
.chart__empty .emj { font-size: 28px; }
.chart__tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -100%);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  z-index: 5;
}
.chart__tip strong { color: var(--primary); }

/* ─── HISTORY ─────────────────────────────────────────────── */
.history { padding: 18px 20px; }
.history__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.history__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.filters { display: flex; align-items: center; gap: 8px; }
.filters select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease;
}
.filters select:focus { border-color: var(--primary); }
.history__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.history__list::-webkit-scrollbar { width: 8px; }
.history__list::-webkit-scrollbar-track { background: transparent; }
.history__list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
.history__list::-webkit-scrollbar-thumb:hover { background: var(--border); }

.history__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: transform .15s var(--ease), background-color .15s ease;
  animation: slideIn .35s var(--ease) both;
}
.history__row:hover {
  transform: translateX(2px);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface-2));
}
.history__date { font-weight: 600; font-size: 14px; }
.history__date em {
  font-style: normal;
  color: var(--accent);
  font-size: 11px;
  margin-left: 6px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
}
.history__note { color: var(--muted); font-size: 12px; margin-top: 3px; }
.history__count {
  font-weight: 800;
  font-size: 16px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.history__count small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-left: 3px;
}
.history__delete {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.history__delete:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }

.history__empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px;
  font-size: 13px;
}
.history__empty .emj {
  font-size: 36px;
  display: block;
  margin-bottom: 6px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Footer ──────────────────────────────────────────────── */
.foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 4px 0 24px;
}

/* ─── Utilities ───────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 28px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 18px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error  { border-color: var(--danger); color: var(--danger); }
.toast.ok     { border-color: var(--success); color: var(--success); }
.toast.celebrate {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

/* ─── Confetti ────────────────────────────────────────────── */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; overflow: hidden; }
.confetti span {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── Адаптив ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .hero__row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .hero__progress { justify-content: space-between; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand__sub { display: none; }
}
@media (max-width: 520px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 4px 16px 32px; gap: 12px; }
  .card { padding: 16px; }
  .hero__ring { width: 96px; height: 96px; }
  .ring__count { font-size: 20px; }
  .hero__streak { padding: 8px 12px; min-width: 96px; }
  .streak__num { font-size: 20px; }
  .adder {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "stepL input stepR"
      "submit submit submit";
  }
  .adder .stepper:first-of-type { grid-area: stepL; }
  .adder input { grid-area: input; }
  .adder .stepper:last-of-type  { grid-area: stepR; }
  .adder .primary { grid-area: submit; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}