* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #111827;
  color: #f9fafb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #818cf8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
nav {
  background: #1f2937;
  padding: 12px 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid #374151;
  flex-wrap: wrap;
}
nav .logo {
  color: #6366f1;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}
nav .logo:hover { color: #818cf8; text-decoration: none; }
nav a { color: #d1d5db; font-size: 14px; }
nav a:hover { color: #f9fafb; text-decoration: none; }
nav a.active { color: #6366f1; }

/* CONTAINER */
.container { max-width: 1000px; margin: 40px auto; padding: 0 20px; flex: 1; width: 100%; }
.container-wide { max-width: 1200px; margin: 40px auto; padding: 0 20px; flex: 1; width: 100%; }

/* CARD */
.card {
  background: #1f2937;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid #374151;
}
.card h2 { font-size: 20px; margin-bottom: 20px; color: #e5e7eb; }
.card h3 { font-size: 16px; margin-bottom: 12px; color: #d1d5db; }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #9ca3af; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 8px;
  color: #f9fafb;
  font-size: 14px;
  font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: #6366f1;
}

/* BUTTONS */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.05s;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: #6366f1; color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-secondary { background: #374151; color: #f9fafb; }
.btn-success { background: #10b981; color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-full { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* ALERT */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: #7f1d1d; color: #fca5a5; }
.alert-success { background: #064e3b; color: #6ee7b7; }
.alert-info { background: #1e3a5f; color: #93c5fd; }

/* AUTH PAGE */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 20px;
}
.auth-card {
  background: #1f2937;
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  border: 1px solid #374151;
}
.auth-card h1 { font-size: 24px; color: #6366f1; margin-bottom: 8px; }
.auth-card p { color: #9ca3af; font-size: 14px; margin-bottom: 24px; }

/* TIMER */
.timer-display {
  text-align: center;
  padding: 32px 0;
}
.timer-display .time {
  font-size: 72px;
  font-weight: 700;
  color: #6366f1;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.timer-display .time.paused { color: #f59e0b; }
.timer-display .status {
  font-size: 16px;
  color: #9ca3af;
  margin-top: 8px;
}
.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* DURATION ADJUSTER (big -25+ block) */
.duration-adjuster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 20px 0 6px;
}
.duration-adjuster .big-num {
  font-size: 72px;
  font-weight: 700;
  color: #6366f1;
  font-variant-numeric: tabular-nums;
  min-width: 130px;
  text-align: center;
  line-height: 1;
  background: transparent;
  border: 2px solid transparent;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 8px;
  -moz-appearance: textfield;
}
.duration-adjuster .big-num::-webkit-outer-spin-button,
.duration-adjuster .big-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.duration-adjuster .big-num:focus {
  outline: none;
  border-color: #6366f1;
  background: #2d3748;
}
.duration-adjuster .unit {
  display: block;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 18px;
}
.adjust-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #374151;
  border: 1px solid #4b5563;
  color: #f9fafb;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}
.adjust-btn:hover { background: #4b5563; }
.adjust-btn:active { transform: translateY(1px); }

.duration-adjuster.small .big-num { font-size: 36px; min-width: 70px; }
.duration-adjuster.small .adjust-btn { width: 36px; height: 36px; font-size: 18px; }

/* MODE TABS (Фокус / Чилл / Фокус+Чилл) */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 22px;
}
.mode-tab {
  flex: 1;
  padding: 12px 14px;
  background: #374151;
  color: #d1d5db;
  border: 1px solid #4b5563;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
}
.mode-tab:hover { background: #4b5563; color: #f9fafb; }
.mode-tab.active {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

/* QUICK DURATION CHIPS */
.duration-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chip {
  background: #374151;
  color: #d1d5db;
  border: 1px solid #4b5563;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { background: #4b5563; color: #f9fafb; }
.chip.active { background: #6366f1; color: white; border-color: #6366f1; }

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-box {
  background: #374151;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-box .value { font-size: 28px; font-weight: 700; color: #6366f1; }
.stat-box .label { font-size: 12px; color: #9ca3af; margin-top: 4px; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: #064e3b; color: #6ee7b7; }
.badge-completed { background: #1e3a5f; color: #93c5fd; }
.badge-locked { background: #374151; color: #9ca3af; }
.badge-warn { background: #78350f; color: #fcd34d; }
.badge-rare-common { background: #374151; color: #d1d5db; }
.badge-rare-rare { background: #1e3a5f; color: #93c5fd; }
.badge-rare-epic { background: #4c1d95; color: #c4b5fd; }
.badge-rare-legendary { background: #78350f; color: #fcd34d; }

/* LIST */
.item-list { display: flex; flex-direction: column; gap: 12px; }
.item {
  background: #374151;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: #4b5563; }
.item .name { font-weight: 600; font-size: 15px; }
.item .desc { font-size: 13px; color: #9ca3af; margin-top: 3px; }

/* PROGRESS BAR */
.progress-bar {
  background: #4b5563;
  border-radius: 4px;
  height: 6px;
  margin-top: 8px;
}
.progress-bar .fill {
  background: #6366f1;
  border-radius: 4px;
  height: 100%;
  transition: width 0.3s;
}

/* TWO COLUMNS */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
}

/* HERO */
.hero {
  text-align: center;
  padding: 40px 20px;
}
.hero h1 {
  font-size: 38px;
  color: #6366f1;
  margin-bottom: 12px;
}
.hero .lead {
  font-size: 17px;
  color: #9ca3af;
  margin-bottom: 24px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* FULLSCREEN TIMER (soft, CSS-only) */
body.timer-fullscreen nav,
body.timer-fullscreen .card:not(#activeTimerCard) {
  display: none !important;
}
body.timer-fullscreen .container,
body.timer-fullscreen .container-wide {
  max-width: none;
  margin: 0;
  padding: 0;
}
body.timer-fullscreen #activeTimerCard {
  min-height: 100vh;
  margin: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 20px;
}
body.timer-fullscreen #activeTimerCard h2 {
  text-align: center;
  font-size: 22px;
  color: #9ca3af;
  margin-bottom: 0;
}
body.timer-fullscreen #activeTimerCard .timer-display {
  padding: 24px 0;
}
body.timer-fullscreen #activeTimerCard .timer-display .time {
  font-size: clamp(120px, 22vh, 280px);
  letter-spacing: 4px;
}
body.timer-fullscreen #activeTimerCard .timer-display .status {
  font-size: 18px;
  margin-top: 12px;
}
body.timer-fullscreen #activeTimerCard .timer-controls .btn {
  padding: 14px 28px;
  font-size: 16px;
}

/* CREDIT (Wart01) — inline right after the logo, then auto-margin pushes nav links right */
.nav-credit {
  font-size: 12px;
  color: #6b7280;
  margin-right: auto;
  white-space: nowrap;
}
.nav-credit a {
  color: #818cf8;
  font-weight: 600;
}
.page-credit-tl {
  position: absolute;
  top: 14px;
  left: 20px;
  font-size: 12px;
  color: #6b7280;
  z-index: 10;
}
.page-credit-tl a {
  color: #818cf8;
  font-weight: 600;
}

/* ============================================================ */
/* CHARTS — pure CSS, no libraries                              */
/* ============================================================ */

/* Vertical bar chart (focus by day, weekday avg) */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding: 8px 6px;
  background: #111827;
  border-radius: 8px;
}
.bar-chart .bar {
  flex: 1;
  background: #6366f1;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  transition: opacity 0.15s;
}
.bar-chart .bar:hover { opacity: 0.8; }
.bar-chart .bar .bar-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #f9fafb;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border: 1px solid #374151;
  z-index: 2;
}
.bar-chart .bar:hover .bar-tooltip { opacity: 1; }
.bar-labels {
  display: flex;
  gap: 4px;
  padding: 6px 6px 0;
  font-size: 11px;
  color: #9ca3af;
}
.bar-labels span { flex: 1; text-align: center; overflow: hidden; }

/* Heatmap calendar (CSS Grid) */
.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-width: 360px;
}
.heatmap .cell {
  aspect-ratio: 1;
  background: #1f2937;
  border-radius: 3px;
  position: relative;
}
.heatmap .cell.l1 { background: #312e81; }
.heatmap .cell.l2 { background: #4338ca; }
.heatmap .cell.l3 { background: #6366f1; }
.heatmap .cell.l4 { background: #818cf8; }
.heatmap .cell .cell-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #f9fafb;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border: 1px solid #374151;
  z-index: 2;
}
.heatmap .cell:hover .cell-tooltip { opacity: 1; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 10px;
  justify-content: flex-end;
}
.heatmap-legend .swatch { width: 12px; height: 12px; border-radius: 3px; }

/* Horizontal bar list (top domains) */
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar {
  display: grid;
  grid-template-columns: 160px 1fr 70px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.hbar .hbar-name {
  color: #d1d5db;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar .hbar-bar {
  background: #374151;
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}
.hbar .hbar-bar .hbar-fill {
  background: #6366f1;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.hbar .hbar-val { color: #9ca3af; text-align: right; }
@media (max-width: 540px) {
  .hbar { grid-template-columns: 110px 1fr 60px; font-size: 12px; }
}

/* Stacked horizontal bar (Productive / Distracting / Neutral) */
.stack-bar {
  display: flex;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  background: #374151;
}
.stack-bar > div { transition: width 0.3s; }
.stack-bar .seg-prod { background: #10b981; }
.stack-bar .seg-dist { background: #ef4444; }
.stack-bar .seg-neut { background: #9ca3af; }
.stack-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 13px;
  color: #d1d5db;
  flex-wrap: wrap;
}
.stack-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.stack-legend .dot-prod { background: #10b981; }
.stack-legend .dot-dist { background: #ef4444; }
.stack-legend .dot-neut { background: #9ca3af; }
