/* Aufrecht — dark theme lock, one accent hue, tinted neutrals. */

:root {
  color-scheme: dark;

  --bg:          hsl(222 18% 7%);
  --bg-elev:     hsl(222 16% 9.5%);
  --surface:     hsl(222 15% 12%);
  --surface-hi:  hsl(222 14% 15%);
  --line:        hsl(222 12% 19%);
  --line-soft:   hsl(222 12% 15%);

  --fg:          hsl(220 16% 93%);
  --fg-dim:      hsl(220 10% 66%);
  --fg-mute:     hsl(220 8% 46%);

  --accent:      hsl(162 52% 52%);
  --accent-dim:  hsl(162 38% 38%);
  --accent-soft: hsl(162 40% 16%);
  --accent-ink:  hsl(165 60% 8%);

  --neutral-ring: hsl(220 12% 34%);
  --warm:        hsl(38 46% 58%);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-full: 999px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --pad: clamp(18px, 4vw, 40px);
  --font: "Outfit", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(120% 70% at 50% -20%, hsl(162 30% 14% / 0.55), transparent 60%);
  background-repeat: no-repeat;
}

h1, h2, h3, p, figure { margin: 0; }
button, input { font: inherit; color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--surface); color: var(--fg);
  padding: 10px 14px; border-radius: var(--r-sm); z-index: 60;
}
.skip:focus { left: 12px; }

:where(button, input, a, [role="switch"]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── Top bar ─────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px var(--pad) 6px;
  max-width: 1000px; margin: 0 auto;
}

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

.brand-mark {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 4px hsl(162 52% 52% / 0.12);
}

.brand-name {
  font-size: 0.95rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-dim);
}

.topbar-right { display: flex; align-items: center; gap: 6px; }

.session-clock {
  font-size: 0.85rem; color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}
.session-clock .sep { margin: 0 5px; opacity: 0.5; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--fg-mute);
  cursor: pointer;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { color: var(--fg); background: var(--surface); }
}

/* ── Layout ──────────────────────────────────────────── */

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--pad) 72px;
  display: flex; flex-direction: column; gap: 20px;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.panel h2 {
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-mute);
}

/* ── Stage / dial ────────────────────────────────────── */

.stage {
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(18px, 5vw, 48px) 0 8px;
  text-align: center;
}

.dial {
  position: relative;
  width: min(340px, 78vw);
  aspect-ratio: 1;
}

.dial-rings { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track, .ring-value { fill: none; stroke-linecap: round; }

.ring-track.ring-session { stroke: var(--line); stroke-width: 1.5; }
.ring-value.ring-session { stroke: var(--fg-mute); stroke-width: 1.5; opacity: 0.6; }

.ring-track.ring-phase { stroke: var(--line); stroke-width: 7; }
.ring-value.ring-phase {
  stroke: var(--neutral-ring); stroke-width: 7;
  transition: stroke 400ms var(--ease-out);
}

.dial[data-phase="stand"] .ring-value.ring-phase { stroke: var(--accent); }
.dial[data-phase="move"]  .ring-value.ring-phase { stroke: hsl(162 62% 70%); }
.dial[data-phase="break"] .ring-value.ring-phase { stroke: var(--warm); }
.dial[data-phase="done"]  .ring-value.ring-phase { stroke: var(--accent-dim); }

.dial-body {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 0 16%;
}

.phase-name {
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--fg-mute);
  transition: color 300ms var(--ease-out);
}
.dial[data-phase="stand"] .phase-name,
.dial[data-phase="move"] .phase-name { color: var(--accent); }

.phase-time {
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  font-weight: 300; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}

.phase-next {
  font-size: 0.8rem; color: var(--fg-mute); line-height: 1.4;
  max-width: 22ch;
}

.phase-hint {
  margin-top: 22px;
  max-width: 42ch;
  color: var(--fg-dim);
  font-size: 0.95rem; line-height: 1.55;
  min-height: 3em;
}

.controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ── Schnellstart ────────────────────────────────────── */

.quickstart {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.quickstart[hidden] { display: none; }

.quick-label {
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-mute); margin-right: 4px;
}

.quick {
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--fg-dim);
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.quick:active { transform: scale(0.97); }

.quick-custom {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 2px 2px 2px 12px;
}
.quick-custom input {
  width: 62px;
  background: transparent; border: 0;
  font-size: 0.82rem; color: var(--fg);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.quick-custom input::-webkit-outer-spin-button,
.quick-custom input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quick-custom input::placeholder { color: var(--fg-mute); }
.quick-suffix { font-size: 0.78rem; color: var(--fg-mute); margin-right: 8px; }
.quick-go { border-color: transparent; background: var(--surface); color: var(--fg-dim); }

@media (hover: hover) and (pointer: fine) {
  .quick:hover { border-color: var(--fg-mute); color: var(--fg); }
  .quick-go:hover { background: var(--surface-hi); border-color: transparent; }
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 12px 24px;
  font-size: 0.95rem; font-weight: 500;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--fg-dim); border-color: var(--line); }
.btn-quiet { border-color: transparent; color: var(--fg-mute); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: hsl(162 54% 58%); }
  .btn-ghost:hover { color: var(--fg); border-color: var(--fg-mute); }
  .btn-quiet:hover { border-color: var(--line); }
}

/* ── Timeline ────────────────────────────────────────── */

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; }

.key {
  font-size: 0.75rem; color: var(--fg-mute);
  display: inline-flex; align-items: center; gap: 6px;
}
.key::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--neutral-ring);
}
.key[data-k="stand"]::before { background: var(--accent); }
.key[data-k="move"]::before { background: hsl(162 62% 70%); }
.key[data-k="break"]::before { background: var(--warm); }

.timeline {
  position: relative;
  display: flex; gap: 2px;
  height: 44px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}

.tl-block {
  position: relative;
  background: var(--neutral-ring);
  opacity: 0.42;
  transition: opacity 300ms var(--ease-out);
}
.tl-block[data-k="stand"] { background: var(--accent); }
.tl-block[data-k="move"] { background: hsl(162 62% 70%); }
.tl-block[data-k="break"] { background: var(--warm); }
.tl-block.is-past { opacity: 0.22; }
.tl-block.is-now { opacity: 1; }

.tl-cursor {
  position: absolute; top: -3px; bottom: -3px; left: 0; width: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 400ms linear;
  pointer-events: none;
}

.timeline-scale {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem; color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
}

/* ── Stats ───────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stat { display: flex; flex-direction: column; gap: 10px; }

.stat-value {
  font-size: 2.1rem; font-weight: 300; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit {
  font-size: 0.9rem; color: var(--fg-mute); margin-left: 7px; letter-spacing: 0;
}

.stat-sub { font-size: 0.8rem; color: var(--fg-mute); line-height: 1.45; }

.goalbar {
  height: 5px; border-radius: var(--r-full);
  background: var(--surface); overflow: hidden;
}
.goalbar span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: var(--r-full);
  transition: width 500ms var(--ease-out);
}

.spark {
  display: flex; align-items: flex-end; gap: 6px;
  height: 52px;
}
.spark div {
  flex: 1;
  min-height: 3px;
  border-radius: 3px 3px 2px 2px;
  background: var(--surface-hi);
  position: relative;
}
.spark div.has-value { background: var(--accent-dim); }
.spark div.is-goal { background: var(--accent); }
.spark div.is-today { outline: 1px solid var(--line); outline-offset: 2px; }

.note p {
  margin-top: 10px;
  color: var(--fg-dim);
  font-size: 0.92rem; line-height: 1.65;
  max-width: 65ch;
}

/* ── Colophon und Unterstützung ───────────── */

.colophon {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 14px 20px;
  padding: 4px 2px 0;
}

.colophon p {
  color: var(--fg-mute);
  font-size: 0.85rem; line-height: 1.6;
  max-width: 48ch;
}

.support {
  display: inline-flex; align-items: center; gap: 9px;
  flex-shrink: 0;
  padding: 9px 16px 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--bg-elev);
  color: var(--fg-dim);
  font-size: 0.88rem; font-weight: 500;
  text-decoration: none;
  transition: color 200ms var(--ease-out), background-color 200ms var(--ease-out),
              border-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.support svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  color: var(--accent-dim);
  transition: color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .support:hover {
    color: var(--fg);
    background: var(--accent-soft);
    border-color: var(--accent-dim);
    transform: translateY(-1px);
  }
  .support:hover svg { color: var(--accent); }
}

.support:active { transform: translateY(0); }

@media (max-width: 560px) {
  .colophon { flex-direction: column; align-items: flex-start; }
}

/* ── Focus mode ──────────────────────────────────────── */

body.focus .timeline-panel,
body.focus .grid,
body.focus .note,
body.focus .colophon,
body.focus .session-clock { display: none; }
body.focus .stage { min-height: 72dvh; justify-content: center; }

/* ── Settings sheet ──────────────────────────────────── */

.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: hsl(222 20% 4% / 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
}
.scrim.is-open { opacity: 1; }

.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100vw);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 320ms var(--ease-drawer);
}
.sheet.is-open { transform: translateX(0); }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head h2 { font-size: 1.05rem; font-weight: 500; }

.sheet-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.two > div { display: flex; flex-direction: column; gap: 8px; }
.field[hidden] { display: none; }

.field label, .field legend, .field .lbl {
  font-size: 0.88rem; color: var(--fg-dim); padding: 0;
}

.hint { font-size: 0.78rem; color: var(--fg-mute); line-height: 1.5; }
.hint.shortcuts kbd {
  font: inherit; font-size: 0.72rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; margin: 0 1px;
}
.warn { font-size: 0.78rem; color: var(--warm); line-height: 1.5; }

.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 2px 0; }

.chips { display: flex; gap: 8px; }
.chip {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px;
  background: var(--surface); border: 1px solid transparent;
  border-radius: var(--r-sm); cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.chip small { font-size: 0.72rem; color: var(--fg-mute); }
.chip:active { transform: scale(0.97); }
.chip.is-active { border-color: var(--accent); background: var(--accent-soft); }
.chip.is-active small { color: var(--fg-dim); }

.stepper {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 4px;
}
.stepper button {
  width: 34px; height: 34px;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--fg-dim); font-size: 1.15rem; cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.stepper button:active { transform: scale(0.94); }
.stepper input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; text-align: center;
  font-size: 1rem; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.compact { padding: 8px 10px; }
.stepper.compact input { text-align: left; }
.suffix { font-size: 0.8rem; color: var(--fg-mute); padding-right: 8px; white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .stepper button:hover { background: var(--surface-hi); color: var(--fg); }
  .chip:hover { border-color: var(--line); }
}

.segmented {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface); border-radius: var(--r-sm);
}
.segmented button {
  flex: 1; padding: 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--fg-dim);
  font-size: 0.88rem; cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.segmented button.is-active { background: var(--surface-hi); color: var(--fg); }

.switch {
  position: relative;
  width: 46px; height: 26px; flex: none;
  border: 0; border-radius: var(--r-full);
  background: var(--surface-hi);
  cursor: pointer;
  transition: background-color 200ms var(--ease-out);
}
.switch span {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--fg-mute);
  transition: transform 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.switch[aria-checked="true"] { background: var(--accent-soft); }
.switch[aria-checked="true"] span { background: var(--accent); transform: translateX(20px); }

.slider-row { display: flex; align-items: center; gap: 12px; }

input[type="range"] {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--surface-hi); border-radius: var(--r-full);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: 0; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}

/* ── Toast ───────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 12px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 11px 20px;
  font-size: 0.88rem; color: var(--fg-dim);
  opacity: 0;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

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

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .phase-hint { font-size: 0.9rem; }
  .sheet { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 120ms !important;
  }
  .btn:active, .icon-btn:active, .chip:active, .stepper button:active { transform: none; }
  .sheet { transition-property: opacity; }
}
