@font-face { font-family: "BC"; src: url("fonts/bc-600.woff2") format("woff2"); font-weight: 600; font-display: block; }
@font-face { font-family: "BC"; src: url("fonts/bc-800.woff2") format("woff2"); font-weight: 800; font-display: block; }

:root {
  --bg: #1c1c1e;
  --bg2: #2a2a2d;
  --bg3: #3a3a3e;
  --line: #333337;
  --text: #f4f4f4;
  --muted: #8a8a8f;
  --accent: #9cf04a;
  --c-prep: #f2e33a;
  --c-work: #9cf04a;
  --c-rest: #ff4a3d;
  --c-cyclerest: #f2e33a;
  --c-cool: #3fa9f5;
  --c-done: #3fa9f5;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "BC", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-transform: inherit; }
svg { fill: currentColor; }
[hidden] { display: none !important; }
input, select { font: inherit; }

.view { display: none; position: fixed; inset: 0 0 calc(var(--tab-h) + var(--safe-bot)) 0; flex-direction: column; }
.view.active { display: flex; }
#view-edit { bottom: 0; z-index: 5; background: var(--bg); }

/* ---------- Timer ---------- */
.run-head { padding: calc(var(--safe-top) + 10px) 16px 6px; text-align: center; background: var(--bg); }
.run-name { color: var(--c-prep); font-size: 22px; font-weight: 800; letter-spacing: .5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-total { font-size: 24px; font-weight: 800; color: var(--c-prep); font-variant-numeric: tabular-nums; }

.phase { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #111; background: var(--c-prep); min-height: 0; transition: background-color .25s; }
.phase-label { font-size: clamp(40px, 14vw, 72px); font-weight: 800; line-height: 1; }
.phase-time { font-size: min(36vw, 26vh); font-weight: 800; line-height: .9; font-variant-numeric: tabular-nums; letter-spacing: -1px; }

.next { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #111; background: var(--c-work); padding: 8px 0 10px; transition: background-color .25s; }
.next-label { font-size: 22px; font-weight: 800; }
.next-time { font-size: 56px; font-weight: 800; line-height: .95; font-variant-numeric: tabular-nums; }

.controls { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 8px 10px; }
.counter { text-align: center; }
.counter-num { font-size: 64px; font-weight: 800; line-height: 1; }
.counter-label { font-size: 16px; font-weight: 800; white-space: nowrap; }
.c-blue { color: var(--c-cool); }
.c-yellow { color: var(--c-prep); }

.play-wrap { display: grid; grid-template-columns: auto auto auto; grid-template-rows: auto auto; align-items: center; column-gap: 4px; justify-items: center; }
.play { width: 104px; height: 104px; border-radius: 50%; background: var(--c-prep); color: #111; display: grid; place-items: center; box-shadow: inset 0 0 0 5px var(--c-prep), inset 0 0 0 9px #111; }
.play svg { width: 52px; height: 52px; }
.play:active { transform: scale(.96); }
.play-label { grid-column: 1 / 4; margin-top: 4px; font-size: 20px; font-weight: 800; color: var(--c-prep); }
.mini { width: 36px; height: 36px; border-radius: 50%; background: var(--bg2); color: var(--muted); display: grid; place-items: center; }
.mini svg { width: 22px; height: 22px; }
.mini:active { background: var(--bg3); color: var(--text); }

.wake-hint { position: absolute; left: 12px; right: 12px; top: calc(var(--safe-top) + 70px); background: #000c; color: #fff; text-transform: none; font-size: 15px; padding: 10px 12px; border-radius: 10px; font-family: -apple-system, system-ui, sans-serif; font-weight: 500; }

/* ---------- Gemeinsame Leisten ---------- */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(var(--safe-top) + 12px) 16px 12px; border-bottom: 1px solid var(--line); }
.bar h1 { margin: 0; font-size: 26px; font-weight: 800; }
.bar-btn { font-size: 24px; font-weight: 800; }
.bar-btn:last-child { justify-self: end; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.accent-bg { background: var(--accent) !important; color: #111 !important; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 24px; }

.btn-wide { display: block; width: 100%; padding: 16px; background: var(--bg3); border-radius: 14px; font-size: 24px; font-weight: 800; margin: 4px 0 16px; }
.btn-wide:active { filter: brightness(1.2); }
.btn-wide.danger { background: transparent; color: var(--c-rest); border: 2px solid var(--c-rest); margin-top: 28px; }
.btn-small { padding: 10px 16px; border-radius: 10px; background: var(--bg3); font-size: 20px; font-weight: 800; }

/* ---------- Liste ---------- */
.card { border-bottom: 1px solid var(--line); padding: 14px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.card-name { color: var(--accent); font-size: 30px; font-weight: 800; line-height: 1.1; margin-bottom: 6px; }
.card-grid { display: grid; grid-template-columns: auto auto auto auto; column-gap: 10px; row-gap: 2px; font-size: 21px; font-weight: 800; }
.card-grid .v { text-align: right; font-variant-numeric: tabular-nums; }
.card-total { margin-top: 6px; font-size: 18px; color: var(--muted); }
.card-side { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.check { width: 44px; height: 44px; border-radius: 50%; background: var(--bg3); color: #777; display: grid; place-items: center; }
.check svg { width: 26px; height: 26px; }
.card.sel .check { background: var(--accent); color: #111; }
.edit-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.edit-btn svg { width: 24px; height: 24px; }

/* ---------- Editor ---------- */
.name-field { display: block; margin-bottom: 14px; }
.name-field span { display: block; color: var(--muted); font-size: 18px; margin-bottom: 4px; }
.name-field input { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 24px; font-weight: 800; text-transform: uppercase; -webkit-user-select: text; user-select: text; }
.section-title { text-align: center; color: var(--muted); background: var(--bg2); margin: 8px -16px; padding: 10px; font-size: 24px; font-weight: 800; }
.irow { display: grid; grid-template-columns: 28px 1fr auto 18px; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dot { width: 22px; height: 22px; border-radius: 50%; }
.irow-title { font-size: 26px; font-weight: 800; line-height: 1.05; }
.irow-sub { font-size: 17px; color: var(--muted); }
.irow-val { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chev { color: var(--muted); font-size: 26px; }
.ed-sum { margin-top: 14px; text-align: center; color: var(--muted); font-size: 22px; }

/* ---------- Einstellungen ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.row-text { flex: 1; }
.row-title { font-size: 26px; font-weight: 800; }
.row-sub { font-size: 15px; color: var(--muted); text-transform: none; font-family: -apple-system, system-ui, sans-serif; font-weight: 400; margin-top: 2px; }
.select { margin-left: auto; background: var(--bg2); color: var(--accent); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 22px; font-weight: 800; text-transform: uppercase; }
.range { flex: 1; accent-color: var(--accent); height: 30px; }
.vol-ico { width: 26px; height: 26px; flex: 0 0 auto; }
.note { color: var(--muted); font-size: 15px; text-transform: none; font-family: -apple-system, system-ui, sans-serif; font-weight: 400; line-height: 1.4; }

.switch { position: relative; width: 64px; height: 36px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 1; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 18px; background: var(--bg3); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #555; transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(28px); background: #333; }

/* ---------- Tabbar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-bot)); padding-bottom: var(--safe-bot); display: grid; grid-template-columns: repeat(3, 1fr); background: #111; border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 14px; font-weight: 800; }
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--text); }

/* ---------- Sheet ---------- */
.sheet { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; z-index: 20; }
.sheet[hidden] { display: none; }
.sheet-card { width: 100%; background: var(--bg2); border-radius: 18px 18px 0 0; padding: 18px 16px calc(var(--safe-bot) + 18px); }
.sheet-title { text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.sheet-body { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; }
.sheet-body select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 34px; font-weight: 800; }
.sheet-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.sheet-btns .btn-small { padding: 14px; }

/* iOS 26 legt einen Weichzeichner über alles, was unter der Statusleiste liegt,
   und meldet die Höhe dort nicht immer korrekt. Daher als installierte App mindestens 56px Abstand. */
@media (display-mode: standalone) {
  :root { --safe-top: max(env(safe-area-inset-top, 0px), 56px); }
}

@media (max-height: 700px) {
  .next-time { font-size: 44px; }
  .counter-num { font-size: 52px; }
  .play { width: 88px; height: 88px; }
}
