/* Augen-Pause — augenschonendes Salbeigrün-Design */
:root {
  --sage: #4d7c6f;
  --sage-deep: #3a6155;
  --sage-soft: #6f9d90;
  --sage-pale: #e4efeb;

  --bg: #f3f6f4;
  --bg-soft: #e9efec;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --text: #20302b;
  --text-soft: #54675f;
  --text-mute: #7d8c86;
  --border: #d9e4df;
  --ring-track: #dfe9e4;
  --shadow: 0 6px 24px rgba(46, 74, 64, 0.08);
  --shadow-soft: 0 2px 8px rgba(46, 74, 64, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --focus: #2f7d68;
}

[data-theme="dark"] {
  --bg: #131a18;
  --bg-soft: #18211e;
  --surface: #1c2623;
  --surface-2: #212d29;
  --text: #e6efec;
  --text-soft: #aebbb6;
  --text-mute: #87968f;
  --border: #2c3a35;
  --ring-track: #2a3833;
  --sage-pale: #25332e;
  --shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.3);
  --focus: #7fbfad;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--sage);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--sage); display: inline-flex; }
[data-theme="dark"] .brand-mark { color: var(--sage-soft); }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background-color .2s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }

/* Main */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.card-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-soft);
}

/* Timer */
.timer-card { text-align: center; box-shadow: var(--shadow); }
.timer-card .card-title { color: var(--sage-deep); }
[data-theme="dark"] .timer-card .card-title { color: var(--sage-soft); }

.ring-wrap {
  position: relative;
  width: min(260px, 72vw);
  aspect-ratio: 1 / 1;
  margin: 4px auto 18px;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 12;
}
.ring-progress {
  fill: none;
  stroke: var(--sage);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 552.92;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .5s linear, stroke .3s ease;
}
.ring-progress.is-paused { stroke: var(--sage-soft); }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.countdown {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1;
}
.countdown-label {
  margin-top: 8px;
  font-size: .85rem;
  color: var(--text-mute);
  max-width: 70%;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: .98rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s ease, background-color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
  background: var(--sage);
  color: #fff;
  box-shadow: 0 4px 14px rgba(77, 124, 111, .35);
}
.btn-primary:hover { background: var(--sage-deep); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--sage-pale); color: var(--sage-deep); }
[data-theme="dark"] .btn-ghost:hover { color: var(--sage-soft); }

.btn-light {
  background: rgba(255,255,255,.9);
  color: var(--sage-deep);
}
.btn-light:hover { background: #fff; }

.hint {
  margin: 16px 0 0;
  font-size: .85rem;
  color: var(--text-mute);
}

/* Stats */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat {
  flex: 1 1 90px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  text-align: center;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--sage-deep);
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .stat-value { color: var(--sage-soft); }
.stat-label {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--text-mute);
}

/* Settings */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-soft);
}
.field-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.field-out {
  min-width: 72px;
  text-align: right;
  font-weight: 700;
  color: var(--sage-deep);
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .field-out { color: var(--sage-soft); }

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 6px;
  background: var(--ring-track);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sage);
  border: 3px solid var(--surface);
  cursor: pointer;
}

.field-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.field-switch > label { margin-bottom: 0; }

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 30px;
  background: var(--ring-track);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .25s ease;
}
.switch[aria-checked="true"] { background: var(--sage); }
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .25s ease;
}
.switch[aria-checked="true"] .switch-knob { transform: translateX(22px); }

/* Footer */
.app-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--text-mute);
  margin-top: 6px;
}
.app-footer p { margin: 0; }

/* Pausen-Screen */
.break-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #3a6155 0%, #4d7c6f 55%, #5d8c7e 100%);
  color: #fff;
  text-align: center;
  padding: 24px;
  animation: fadeIn .4s ease;
}
.break-screen[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.break-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.breath-circle {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 70%);
  animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(.85); opacity: .5; }
  50% { transform: scale(1.5); opacity: 1; }
}

.break-content { position: relative; z-index: 1; max-width: 420px; }
.break-title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .5px;
}
.break-sub {
  margin: 0 0 24px;
  font-size: 1rem;
  opacity: .92;
}
.break-count {
  font-size: clamp(4.5rem, 26vw, 8rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.break-actions { margin-top: 30px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--sage-deep);
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: .92rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 300;
  max-width: 90vw;
  text-align: center;
  animation: toastIn .3s ease;
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Focus */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .breath-circle { display: none; }
  .break-screen { animation: none; }
}

/* Schmale Geräte */
@media (max-width: 380px) {
  .card { padding: 18px; }
  .btn { padding: 11px 16px; font-size: .92rem; }
  .controls { gap: 8px; }
}
