:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --bg-card: #1c2128;
  --border: #2d333b;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #f85149;
  --accent-dim: rgba(248, 81, 73, 0.15);
  --break: #3fb950;
  --break-dim: rgba(63, 185, 80, 0.15);
  --long: #58a6ff;
  --long-dim: rgba(88, 166, 255, 0.15);
  --radius: 14px;
  --ring-w: 12px;
}

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

body {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  background: radial-gradient(1200px 800px at 50% -10%, #1c2430 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.brand h1 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 1px;
}

.view-switch {
  display: flex;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.view-btn {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border);
}

.view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view.hidden {
  display: none;
}

/* Mode tabs */
.mode-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 18px;
}

.mode-tab {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab.active[data-mode="pomodoro"] {
  background: var(--accent-dim);
  color: var(--accent);
}

.mode-tab.active[data-mode="short"] {
  background: var(--break-dim);
  color: var(--break);
}

.mode-tab.active[data-mode="long"] {
  background: var(--long-dim);
  color: var(--long);
}

/* Task input */
.task-input {
  width: 100%;
  max-width: 380px;
  margin-bottom: 26px;
}

.task-input input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}

.task-input input::placeholder {
  color: var(--text-dim);
}

.task-input input:focus {
  border-color: var(--accent);
}

/* Timer ring */
.timer-wrap {
  position: relative;
  width: 340px;
  height: 340px;
  margin-bottom: 30px;
}

.ring {
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-soft);
  stroke-width: var(--ring-w);
}

.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: var(--ring-w);
  stroke-linecap: round;
  stroke-dasharray: 942.48;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
  filter: drop-shadow(0 0 6px var(--accent));
}

body.mode-short .ring-fg {
  stroke: var(--break);
  filter: drop-shadow(0 0 6px var(--break));
}

body.mode-long .ring-fg {
  stroke: var(--long);
  filter: drop-shadow(0 0 6px var(--long));
}

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.time {
  font-size: 64px;
  font-weight: 300;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.session-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* Controls */
.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  min-width: 130px;
}

body.mode-short .btn-primary {
  background: var(--break);
}

body.mode-long .btn-primary {
  background: var(--long);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}

.btn-danger:hover {
  border-color: var(--accent);
}

.btn-sm {
  font-size: 12px;
  padding: 7px 14px;
}

/* Stats row */
.stats-row {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 460px;
  justify-content: space-between;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 16px;
  font-weight: 500;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* History */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.summary-value {
  font-size: 20px;
  font-weight: 500;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.list-actions {
  display: flex;
  gap: 8px;
}

.chart-section {
  width: 100%;
  margin-bottom: 30px;
}

.chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 180px;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-track {
  width: 100%;
  max-width: 42px;
  height: 120px;
  background: var(--bg-soft);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.chart-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  border-radius: 6px;
  min-height: 0;
  transition: height 0.4s ease;
}

.chart-bar.hovered {
  filter: brightness(1.25);
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-dim);
}

.chart-bar-hours {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.chart-bar-col:hover .chart-bar-hours,
.chart-bar-col.hovered .chart-bar-hours {
  opacity: 1;
}

/* Session list */
.session-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
}

.session-task {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  color: var(--text-dim);
  font-size: 12px;
}

.session-hours {
  font-weight: 500;
  text-align: right;
}

.session-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}

.session-delete:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 14px;
}

.footer {
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

@media (max-width: 560px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .timer-wrap {
    width: 280px;
    height: 280px;
  }

  .time {
    font-size: 52px;
  }

  .session-row {
    grid-template-columns: 1fr auto;
  }

  .session-meta,
  .session-hours {
    text-align: left;
  }
}