/* ── Basis ───────────────────────────────────────────────────────────── */

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

:root {
  --clr-focus: #D85A30;
  --clr-short: #1D9E75;
  --clr-long:  #378ADD;

  --bg: #141a26;
  --bg-muted: #202d42;
  --panel: #202d42;
  --panel2: #3b4556;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --border: rgba(148,163,184,.5);
  --accent: #f2cc83;
  --accent2: #f7d89a;
  --danger: #e34242;
  --ok: #22c55e;

  --theme-btn-bg: var(--bg-muted);
  --theme-btn-hover: var(--panel2);
}

body.theme-light {
  --bg: #f7ecd4;
  --bg-muted: #faefdc;
  --panel: #fff7e7;
  --panel2: #f2cc83;
  --text: #111827;
  --text-muted: #4b5563;
  --border: rgba(148,119,81,.6);
  --accent: #296117;
  --accent2: #3b7f22;
  --danger: #b91c1c;
  --ok: #296117;

  --theme-btn-bg: var(--panel);
  --theme-btn-hover: #f3ead7;
}

html, body {
  min-height: 100vh;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

/* ── Topbar ──────────────────────────────────────────────────────────── */

.topbar {
  width: 100%;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.home-link:hover {
  color: var(--text);
}

.home-link img {
  border-radius: 4px;
}

.theme-card-btn {
  border: 1px solid var(--border);
  background: var(--theme-btn-bg);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 54px;
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
  font-family: inherit;
}

.theme-card-btn:hover {
  background: var(--theme-btn-hover);
  transform: translateY(-1px);
}

.theme-card-label {
  font-size: 11px;
  line-height: 1.15;
  color: var(--text-muted);
  display: block;
}

/* ── App ─────────────────────────────────────────────────────────────── */

#app {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1rem 2.5rem;
}

/* Tabs */
.mode-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 2rem;
}

.tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s;
}

.tab:hover {
  background: var(--bg-muted);
}

.tab.active[data-mode="focus"] {
  background: #FAECE7;
  color: #993C1D;
  border-color: #D85A30;
}

.tab.active[data-mode="short"] {
  background: #E1F5EE;
  color: #0F6E56;
  border-color: #1D9E75;
}

.tab.active[data-mode="long"] {
  background: #E6F1FB;
  color: #185FA5;
  border-color: #378ADD;
}

/* Ring */
.ring-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 2rem;
}

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

#track {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

#progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

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

#time-display {
  font-size: 48px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}

#mode-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2rem;
}

.btn-main {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-main:hover {
  background: var(--bg-muted);
}

.btn-main svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
}

#btn-start {
  width: 64px;
  height: 64px;
}

#btn-start svg {
  width: 26px;
  height: 26px;
}

/* Sessions */
.sessions {
  text-align: center;
  margin-bottom: 1.5rem;
}

.tomatoes {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 6px;
}

.tomato {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  transition: background 0.3s;
}

.tomato.done {
  background: #D85A30;
  border-color: #993C1D;
}

.sessions-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Settings */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.setting-card {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.setting-card label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.setting-card input[type="number"] {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

.setting-card input[type="number"]::-webkit-inner-spin-button {
  opacity: 0.4;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .topbar {
    padding: 10px 12px;
  }

  .theme-card-btn {
    min-width: 132px;
    padding: 10px 10px;
  }

  .theme-card-label {
    font-size: 10px;
  }
}