/* ---------- Tokens ---------- */
:root {
  --bg: #101217;
  --surface: #181b22;
  --surface-2: #222630;
  --border: #2b303b;
  --text: #ecebe8;
  --muted: #8d93a0;
  --accent: #6cc7b9;
  --accent-ink: #0c2420;
  --break: #f0b46a;
  --danger: #e57373;
  --radius: 18px;
  --tap: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-2: #eeebe4;
    --border: #e1ddd3;
    --text: #1d1f24;
    --muted: #6c707a;
    --accent: #2f8f82;
    --accent-ink: #ffffff;
    --break: #c77d22;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eeebe4;
  --border: #e1ddd3;
  --text: #1d1f24;
  --muted: #6c707a;
  --accent: #2f8f82;
  --accent-ink: #ffffff;
  --break: #c77d22;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  transition: opacity .4s var(--ease);
}
.brand { font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.topbar-actions { display: flex; gap: 4px; }

/* Fokus zamanı: diqqəti yayındıran hər şey gizlənir */
.app[data-screen="focus"] .topbar { opacity: 0; pointer-events: none; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
  animation: fade .35s var(--ease);
}
.screen.center { justify-content: center; text-align: center; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Setup ---------- */
.streak-line { color: var(--muted); font-size: 15px; min-height: 22px; }
.question { font-size: 26px; font-weight: 650; line-height: 1.2; margin-top: 12px; }
.goal-input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  outline: none;
  transition: border-color .2s;
}
.goal-input:focus { border-color: var(--accent); }
.field-label, .card-label {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-width: 64px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.chip[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }

.setup-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 24px; }
.tip { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: transform .1s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { color: var(--danger); }
.btn-xl { min-height: 64px; font-size: 20px; border-radius: 18px; }
.btn-round { width: 60px; height: 60px; padding: 0; border-radius: 50%; font-weight: 650; }
.btn-round-lg { width: 80px; height: 80px; font-size: 22px; }
.icon-btn {
  position: relative;
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: transparent; font-size: 20px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.badge {
  position: absolute; top: 4px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--break); color: #1d1300;
  font-size: 11px; font-weight: 700; line-height: 18px;
}
.link-btn { background: none; border: 0; color: var(--accent); padding: 6px 0; cursor: pointer; font-size: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Focus ---------- */
.phase-label { margin: 0; text-align: center; color: var(--accent); font-weight: 650; text-transform: uppercase; letter-spacing: .1em; font-size: 14px; }
.phase-label.break { color: var(--break); }
.goal-display { margin: 0; text-align: center; font-size: 22px; font-weight: 600; min-height: 1.2em; overflow-wrap: anywhere; }

.ring-wrap { position: relative; width: min(78vw, 320px); aspect-ratio: 1; margin: 8px auto; }
.ring-wrap.small { width: min(56vw, 220px); }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-track { stroke: var(--surface-2); }
.ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 678.58;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .9s linear;
}
.ring-progress.break { stroke: var(--break); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.time { font-size: clamp(48px, 15vw, 68px); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring-wrap.small .time { font-size: 44px; }
.time-sub { color: var(--muted); font-size: 14px; min-height: 20px; }
.paused .time { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

.controls { display: flex; justify-content: center; align-items: center; gap: 24px; }

.focus-tools { display: flex; justify-content: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 15px;
}
.tool b { color: var(--text); font-weight: 650; }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* ---------- Done ---------- */
.celebrate { font-size: 72px; animation: pop .6s var(--ease); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.done-title { margin: 0; font-size: 30px; }
.done-sub { margin: 0 0 16px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.screen.center .stack { margin-top: 0; }

/* ---------- Cards / lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card .card-label { margin: 0 0 6px; }
.suggestion-text { font-size: 20px; font-weight: 600; }

.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.inbox-list li { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.inbox-list input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.inbox-list li.done span { text-decoration: line-through; color: var(--muted); }
.inbox-list span { flex: 1; overflow-wrap: anywhere; }

/* ---------- Sheets ---------- */
.sheet {
  width: 100%; max-width: 480px;
  margin: auto auto 0;
  padding: 0; border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--text);
  max-height: 88dvh;
}
.sheet[open] { animation: up .3s var(--ease); }
.sheet::backdrop { background: rgb(0 0 0 / .55); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 24px; } }
.sheet-body { padding: 24px 20px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet h3 { margin: 0; font-size: 22px; }
.muted { color: var(--muted); margin: 0; font-size: 15px; }
.confirm-text { margin: 0; font-size: 19px; font-weight: 600; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.row .btn { flex: 1; }
.row.wrap .btn { flex: 1 1 auto; }

.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; border-bottom: 1px solid var(--border);
}
.setting input[type="number"] {
  width: 84px; height: 40px; text-align: center;
  border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg);
}
.setting input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 28px; font-weight: 650; }
.stat span { color: var(--muted); font-size: 13px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar i { width: 100%; max-width: 32px; border-radius: 6px; background: var(--accent); min-height: 3px; opacity: .85; }
.bar.today i { opacity: 1; }
.bar small { color: var(--muted); font-size: 12px; }

.session-list { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.session-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.session-list li span:first-child { overflow-wrap: anywhere; }
.session-list .meta { color: var(--muted); white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .25s var(--ease);
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
