/* ============================================================
   ATHLETENHALLE GYM TIMER — athletic dark, warm yellow
   ============================================================ */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-italic.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-latin-800-italic.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 900; font-display: swap; src: url(/fonts/barlow-condensed-latin-900-italic.woff2) format('woff2'); }

:root {
  --bg: #060607;
  --card: #121214;
  --card-2: #1b1b1e;
  --line: #ffffff10;
  --text: #f4f4f5;
  --dim: #8a8a93;
  --accent: #fff103;
  --accent-ink: #0a0a0a;
  --red: #ff4d3d;
  --radius: 24px;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --phase: var(--accent);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* subtle film grain for depth */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { position: relative; z-index: 1; }
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.keepalive-video { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; background: #000; pointer-events: none; z-index: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(var(--safe-t) + 12px) 16px 12px;
  background: linear-gradient(var(--bg) 65%, #0000);
}
.topbar h1 { margin: 0; font: italic 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; text-align: center; }
.wordmark { display: flex; align-items: center; justify-content: center; font: italic 900 17px/1 var(--display); letter-spacing: .2em; color: #fff; text-align: center; }
.brand-logo { height: 26px; width: auto; max-width: 170px; object-fit: contain; }
.brand-logo + span { display: none; }
.done-logo { display: block; width: min(64vw, 260px); height: auto; margin: 0 auto 34px; }
.topbar > :last-child { justify-self: end; }
.topbar-right { display: flex; gap: 10px; justify-self: end; }
.round-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--text);
  box-shadow: inset 0 0 0 1px #ffffff12;
  transition: transform .12s, background .12s;
}
.round-btn svg { width: 21px; height: 21px; }
.round-btn:active { transform: scale(.9); background: var(--card-2); }

/* ---------- home ---------- */
.home, .editor { max-width: 720px; margin: 0 auto; padding: 4px 16px calc(var(--safe-b) + 28px); }

.hero { padding: 14px 4px 22px; }
.eyebrow { margin: 0 0 6px; color: var(--dim); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.display { margin: 0; font: italic 900 clamp(52px, 16vw, 92px)/.86 var(--display); text-transform: uppercase; letter-spacing: -.01em; }
.display em { font-style: inherit; color: var(--accent); }

.quick {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 12px;
  padding: 18px 18px 18px 22px; border-radius: var(--radius); text-align: left;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 14px 40px #fff10324;
  transition: transform .12s;
}
.quick:active { transform: scale(.98); }
.quick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.quick-text small { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.quick-text b { font: italic 900 34px/1 var(--display); text-transform: uppercase; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-text span { font-size: 14px; font-weight: 600; opacity: .7; }
.quick-play { width: 58px; height: 58px; border-radius: 50%; background: var(--accent-ink); color: var(--accent); display: grid; place-items: center; flex: none; }
.quick-play svg { width: 24px; height: 24px; margin-left: 3px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.mode-card {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column;
  min-height: 148px; padding: 18px;
  background: var(--card); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .15s, box-shadow .15s;
}
.mode-card::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 100% 0%, #fff10314, transparent 60%); opacity: 0; transition: opacity .2s; }
.mode-card:active { transform: scale(.97); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mode-card:active::after { opacity: 1; }
.mode-card.wide { grid-column: span 2; min-height: 120px; }
.mode-tag {
  position: absolute; right: -6px; top: 4px; z-index: -1;
  font: italic 900 64px/1 var(--display); letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 1.5px #ffffff17;
  white-space: nowrap;
}
.mode-icon { color: var(--accent); height: 30px; }
.mode-icon svg { height: 30px; width: 30px; }
.mode-icon.double svg { width: 56px; }
.mode-title { margin-top: auto; padding-top: 16px; font: italic 900 32px/.95 var(--display); text-transform: uppercase; letter-spacing: .005em; }
.mode-sub { color: var(--dim); font-size: 13px; margin-top: 5px; }

.section { margin-top: 30px; }
.section-head h2::before { content: ''; display: block; width: 28px; height: 3px; background: var(--accent); margin-bottom: 8px; }
.section-head h2 { margin: 0 4px 12px; font: italic 900 26px/1 var(--display); text-transform: uppercase; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.fav-main { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; }
.fav-icon { color: var(--accent); flex: none; }
.fav-icon svg { width: 24px; height: 24px; }
.fav-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fav-text b { font: italic 800 21px/1.05 var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-text small { color: var(--dim); font-size: 13px; margin-top: 3px; }
.hist-time { font: italic 800 22px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--text); }
.play-mini { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.play-mini svg { width: 17px; height: 17px; margin-left: 2px; }
.empty { color: var(--dim); font-size: 15px; line-height: 1.45; margin: 0 4px; }
.empty svg { display: inline; width: 16px; height: 16px; vertical-align: -3px; color: var(--accent); }
.wake-note { text-align: center; color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-top: 30px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e8893a; margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); flex: none; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.subtle { color: var(--dim); }
.icon-btn.tiny { width: 30px; height: 30px; color: var(--dim); }
.icon-btn.tiny svg { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: .25; }
.icon-btn:active { background: #ffffff12; }

/* ---------- editor ---------- */
.page-editor .editor { padding-bottom: calc(var(--safe-b) + 124px); }
.summary { position: relative; overflow: hidden; padding: 22px 20px 20px; text-align: center; }
.sum-total { font: italic 900 88px/.9 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sum-sub { color: var(--dim); margin-top: 8px; font-size: 14px; font-weight: 600; }
.timeline { display: flex; gap: 3px; height: 12px; margin-top: 18px; }
.timeline span { min-width: 3px; border-radius: 3px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.center { justify-content: center; flex-wrap: wrap; padding: 6px 16px 4px; }
.chip { flex: none; padding: 10px 15px; border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 1px #ffffff1a; }
.chip:active { background: var(--accent); color: var(--accent-ink); }

.group { margin-top: 14px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 8px 10px 8px 18px; }
.row + .row { border-top: 1px solid var(--line); }
.row-label { font-size: 16px; font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; }
.row-label small { flex-basis: 100%; color: var(--dim); font-size: 12px; font-weight: 500; margin-top: 2px; }
.row-label .dot { width: 10px; height: 10px; margin-right: 10px; box-shadow: none; }
.stepper { display: flex; align-items: center; gap: 2px; }
.step { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--card-2); color: var(--text); transition: transform .1s, background .1s; }
.step svg { width: 18px; height: 18px; }
.step:active { transform: scale(.88); background: var(--accent); color: var(--accent-ink); }
.val { min-width: 84px; height: 44px; padding: 0 8px; border-radius: 12px; font: italic 800 32px/44px var(--display); font-variant-numeric: tabular-nums; text-align: center; }
.val:active { background: #ffffff10; }
.val .off { color: var(--dim); font: 600 15px var(--ui); text-transform: uppercase; letter-spacing: .08em; }
.val.small { min-width: 70px; font-size: 26px; background: var(--card-2); height: 40px; line-height: 40px; }

.start-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 18px 16px calc(var(--safe-b) + 14px); background: linear-gradient(#0000, var(--bg) 45%); }
.start-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; max-width: 688px; margin: 0 auto; height: 66px; border-radius: 22px;
  background: var(--accent); color: var(--accent-ink);
  font: italic 900 32px/1 var(--display); text-transform: uppercase; letter-spacing: .04em;
  box-shadow: 0 12px 40px #fff1032e, inset 0 -3px 0 #0000001f;
  transition: transform .12s;
}
.start-btn svg { width: 22px; height: 22px; }
.start-btn:active { transform: scale(.97); }

/* interval builder */
.block { margin-top: 14px; padding: 4px 0 14px; }
.block-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 18px; }
.block-name, .step-name, .text-input, .name-input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; padding: 6px 0;
}
.block-name { font: italic 900 28px/1 var(--display); text-transform: uppercase; }
.block-name:focus, .step-name:focus { box-shadow: 0 2px 0 var(--accent); }
.block-tools { display: flex; }
.block .row { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps { padding: 6px 0; }
.step-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; }
.color-dot { width: 8px; height: 44px; border-radius: 4px; flex: none; }
.step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.step-name { font-size: 16px; font-weight: 700; padding: 2px 0; width: 100%; }
.kind-pill { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: 3px 8px; border-radius: 6px; margin-top: 3px; background: #fff1031f; color: var(--accent); }
.kind-pill.rest { background: #5b8fd924; color: #7aa8e6; }
.step-tools { display: flex; flex-direction: column; }
.block-add { display: flex; gap: 8px; padding: 6px 16px 0; }
.ghost-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 15px; border-radius: 14px; background: var(--card-2); color: var(--text); font-weight: 700; font-size: 14px; }
.ghost-btn svg { width: 16px; height: 16px; color: var(--accent); }
.ghost-btn:active { background: #2a2a2e; }
.ghost-btn.wide { width: 100%; height: 56px; font-size: 16px; }
.ghost-btn.danger { color: var(--red); margin-top: 14px; }
.ghost-btn.danger svg { color: var(--red); }
.add-block { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; height: 62px; border-radius: var(--radius); border: 1.5px dashed #ffffff26; color: var(--accent); font: italic 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.add-block svg { width: 20px; height: 20px; }

/* ---------- sheets ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: #000a; opacity: 0; transition: opacity .25s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto;
  max-width: 640px; margin: 0 auto;
  background: #0f0f11; border-radius: 28px 28px 0 0; padding-bottom: calc(var(--safe-b) + 18px);
  box-shadow: 0 -1px 0 #ffffff14, 0 -20px 60px #000c;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .85, .2, 1);
}
#sheet-root.open .sheet-backdrop { opacity: 1; }
#sheet-root.open .sheet { transform: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 18px 10px; position: sticky; top: 0; background: #0f0f11; z-index: 2; }
.sheet-head b { font: italic 900 24px/1 var(--display); text-transform: uppercase; }
.sheet-head > :last-child { justify-self: end; }
.link { color: var(--dim); font-size: 16px; font-weight: 600; padding: 6px 2px; }
.link.strong { color: var(--accent); font-weight: 800; }
.sheet-body { padding: 4px 16px 8px; }
.sheet-body .group:first-child { margin-top: 4px; }
.text-input { width: 100%; background: var(--card); border-radius: 16px; padding: 16px 18px; font: italic 800 26px/1 var(--display); text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--line); }
.name-input { text-align: right; font-size: 17px; font-weight: 600; max-width: 55%; }
.name-input::placeholder { color: #5a5a60; font-weight: 500; }
.tip { margin-top: 14px; padding: 14px 18px; }
.tip b { font: italic 800 19px/1 var(--display); text-transform: uppercase; }
.tip p { margin: 6px 0 0; color: var(--dim); font-size: 14px; line-height: 1.45; }

.wheels { position: relative; display: flex; justify-content: center; align-items: center; gap: 4px; height: 220px; margin: 6px 16px 12px; }
.wheel { position: relative; z-index: 1; height: 220px; width: 96px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-mask-image: linear-gradient(#0000, #000 35%, #000 65%, #0000); mask-image: linear-gradient(#0000, #000 35%, #000 65%, #0000); }
.wheels.single .wheel { width: 150px; }
.wheel::-webkit-scrollbar { display: none; }
.wheel-pad { height: 88px; }
.wheel-item { height: 44px; line-height: 44px; text-align: center; font: italic 800 30px/44px var(--display); font-variant-numeric: tabular-nums; scroll-snap-align: center; color: #55555c; transition: color .1s; }
.wheel-item.sel { color: var(--accent); }
.wheel-unit { z-index: 1; color: var(--dim); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; width: 40px; }
.wheel-highlight { position: absolute; left: 0; right: 0; top: 88px; height: 44px; border-radius: 14px; background: #ffffff0d; box-shadow: inset 0 0 0 1px #fff10333; pointer-events: none; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 100px); transform: translate(-50%, 20px); z-index: 60; background: var(--accent); color: var(--accent-ink); padding: 12px 20px; border-radius: 999px; font: italic 800 19px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.15; box-shadow: 0 10px 30px #0008; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* switch */
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: #2a2a2e; position: relative; transition: background .2s; flex: none; margin: 0; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s, background .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); background: var(--accent-ink); }
.toggle-row { cursor: pointer; }
.range { width: 150px; accent-color: var(--accent); }

/* ============================================================
   RUN SCREEN — the whole screen is the phase colour
   ============================================================ */
.page-run { overflow: hidden; }
.page-run::before { display: none; }
.run {
  --ink: #0a0a0a;
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 10px) 18px calc(var(--safe-b) + 18px);
  overflow: hidden; color: var(--ink);
}
.run-bg { position: absolute; inset: 0; z-index: -2; background: var(--phase); transition: background-color .35s, filter .3s; }
/* darkens from the top as time runs out — readable from across the gym */
.run-drain { position: absolute; inset: 0; z-index: -1; background: #00000047; transform-origin: top; transform: scaleY(0); will-change: transform; }
.run.flash .run-bg { animation: flash .6s ease-out; }
@keyframes flash { 0% { filter: brightness(1.8); } 100% { filter: none; } }
.run.final .run-bg { animation: beat 1s ease-out infinite; }
@keyframes beat { 0% { filter: brightness(1.35); } 60%, 100% { filter: none; } }
.run.is-paused .run-bg, .run.is-paused .run-drain { filter: grayscale(1) brightness(.55); }
.run.is-paused { --ink: #fff; }

.run-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.run .round-btn { background: #0000001f; color: var(--ink); box-shadow: none; }
.run .round-btn:active { background: #00000038; }
.run-title { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.run-title b { font: italic 900 20px/1 var(--display); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wake-pill { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.wake-pill .dot { background: var(--ink); box-shadow: none; }
.wake-pill.warn { opacity: 1; }
.wake-pill.warn .dot { background: #ff2d2d; }

.run-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; text-align: center; }
.meta { font: italic 800 clamp(22px, 7vw, 40px)/1 var(--display); text-transform: uppercase; letter-spacing: .04em; min-height: 1em; opacity: .75; }
.meta i { font-style: normal; margin: 0 .35em; opacity: .4; }
.phase { font: italic 900 clamp(48px, 19vw, 120px)/.86 var(--display); text-transform: uppercase; letter-spacing: -.005em; max-width: 100%; overflow-wrap: anywhere; margin-top: .1em; }
.phase.long { font-size: clamp(40px, 13vw, 96px); }
.clock { display: flex; flex-direction: column; align-items: center; }
.time { font: italic 900 min(46vw, 34dvh, 300px)/.8 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: .06em 0 0; padding-right: .06em; }
.time.long { font-size: min(34vw, 26dvh, 230px); }
.time.pulse { animation: pulse .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pulse { 0% { transform: scale(1.14); } 100% { transform: none; } }
.time-sub { margin-top: 10px; font: italic 800 clamp(18px, 5.4vw, 28px)/1 var(--display); text-transform: uppercase; letter-spacing: .06em; opacity: .55; font-variant-numeric: tabular-nums; min-height: 1em; }
.paused-tag { margin-top: 18px; font: italic 900 22px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; background: #fff; color: #000; padding: 8px 14px; border-radius: 10px; display: none; }
.is-paused .paused-tag { display: block; }

.next { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 520px; margin: 0 auto 12px; padding: 12px 16px; border-radius: 18px; background: #0000001f; font-weight: 700; }
.next.empty { visibility: hidden; }
.next i { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: 0 0 0 2px #0000002a; }
.next span { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.next b { flex: 1; min-width: 0; font: italic 900 24px/1 var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.next em { font: italic 800 24px/1 var(--display); font-variant-numeric: tabular-nums; }

.counter-btn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; align-items: center; text-align: left; width: 100%; max-width: 520px; margin: 0 auto 12px; padding: 12px 20px; border-radius: 22px; background: var(--ink); color: var(--phase); transition: transform .1s; }
.counter-btn:active { transform: scale(.96); }
.counter-n { grid-row: span 2; font: italic 900 64px/1 var(--display); font-variant-numeric: tabular-nums; min-width: 1.1ch; }
.counter-l { font: italic 900 22px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; align-self: end; }
.counter-split { font-size: 13px; font-weight: 700; opacity: .75; font-variant-numeric: tabular-nums; align-self: start; min-height: 1.3em; margin-top: 3px; }

.laps { max-height: 22dvh; overflow-y: auto; width: 100%; max-width: 520px; margin: 0 auto 10px; }
.lap { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 8px 4px; border-top: 1.5px solid #00000026; font: italic 800 22px/1.1 var(--display); text-transform: uppercase; font-variant-numeric: tabular-nums; }
.lap .dim { opacity: .5; }

.total { width: 100%; max-width: 520px; margin: 0 auto 16px; }
.total.hidden { visibility: hidden; height: 0; margin: 0; }
.total-bar { height: 6px; background: #00000026; border-radius: 3px; overflow: hidden; }
.total-bar span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 3px; }
.total-row { display: flex; justify-content: space-between; margin-top: 6px; font: italic 800 17px/1 var(--display); font-variant-numeric: tabular-nums; opacity: .65; }

.controls { display: flex; align-items: center; justify-content: center; gap: clamp(22px, 10vw, 60px); }
.ctl { flex: none; width: 66px; height: 66px; border-radius: 50%; background: #00000024; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .1s; }
.ctl svg { width: 25px; height: 25px; }
.ctl small { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.ctl.main { width: 96px; height: 96px; background: var(--ink); color: var(--phase); box-shadow: 0 10px 30px #00000040; }
.is-paused .ctl.main { background: #fff; color: #000; }
.ctl.main svg { width: 40px; height: 40px; }
.ctl:active { transform: scale(.88); }

.lock-shield { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px; padding-bottom: calc(var(--safe-b) + 34px); color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.locked .lock-shield { display: flex; }
.locked .controls, .locked .run-top, .locked .counter-btn { opacity: .2; }
.run .round-btn.big { width: 76px; height: 76px; background: var(--ink); color: var(--phase); }
.round-btn.big svg { width: 30px; height: 30px; }
.holding { animation: hold .8s linear forwards; }
@keyframes hold { to { transform: scale(1.25); box-shadow: 0 0 0 14px #00000030; } }

/* finish */
.done { position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; padding: 24px; background: var(--bg); color: var(--text); }
.finished .done { display: flex; animation: fade .4s; }
@keyframes fade { from { opacity: 0; transform: scale(1.04); } }
.done-card { width: 100%; max-width: 440px; text-align: center; }
.done-emoji { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 0 60px #fff10355; animation: pop .55s cubic-bezier(.2, 1.6, .4, 1); }
.done-emoji svg { width: 50px; height: 50px; stroke-width: 3; }
@keyframes pop { from { transform: scale(.2) rotate(-20deg); } }
.done h2 { margin: 22px 0 4px; font: italic 900 clamp(64px, 20vw, 110px)/.85 var(--display); text-transform: uppercase; }
.done h2 span { color: var(--accent); }
.done-sub { margin: 8px 0 26px; color: var(--dim); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; }
.done-stats { display: flex; justify-content: center; gap: 12px; margin-bottom: 30px; }
.done-stat { flex: 1; max-width: 170px; background: var(--card); border-radius: 18px; padding: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.done-stat b { display: block; font: italic 900 46px/1 var(--display); font-variant-numeric: tabular-nums; }
.done-stat span { color: var(--dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.done-actions { display: flex; flex-direction: column; gap: 10px; }

/* landscape phones: huge clock left, controls right */
@media (orientation: landscape) and (max-height: 560px) {
  .run { display: grid; grid-template-columns: 1fr minmax(260px, 36%); grid-template-rows: auto 1fr auto auto auto; column-gap: 24px; }
  .run-top { grid-column: 1 / -1; }
  .run-main { grid-row: 2 / 6; }
  .phase { font-size: 13dvh; }
  .phase.long { font-size: 10dvh; }
  .meta { font-size: 6dvh; }
  .time { font-size: min(44dvh, 30vw); }
  .time.long { font-size: min(34dvh, 23vw); }
  .time-sub { margin-top: 4px; font-size: 4.5dvh; }
  .next, .counter-btn, .laps, .total, .controls { grid-column: 2; }
  .next { grid-row: 2; align-self: start; margin-top: 10px; }
  .counter-btn { grid-row: 3; }
  .laps { grid-row: 3; }
  .total { grid-row: 4; }
  .controls { grid-row: 5; }
  .controls { gap: 18px; }
  .ctl { width: 56px; height: 56px; }
  .ctl.main { width: 78px; height: 78px; }
  .counter-n { font-size: 52px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .mode-card.wide { grid-column: span 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* interval list: Intervall → Pause, repeated */
.iv-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.iv { overflow: hidden; }
.iv-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 8px 14px; }
.iv-color { width: 10px; height: 34px; border-radius: 5px; flex: none; }
.iv-name { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); padding: 6px 0; font: italic 900 28px/1 var(--display); text-transform: uppercase; }
.iv-name::placeholder { color: var(--text); opacity: 1; }
.iv-name:focus::placeholder { color: #5a5a60; }
.iv-name:focus { box-shadow: 0 2px 0 var(--accent); }
.iv .row { border-top: 1px solid var(--line); min-height: 58px; }
.iv-rest { background: #5b8fd90d; }

/* Ferdi mode — low-key row at the bottom of the home screen */
.ferdi-toggle { display: flex; align-items: center; gap: 12px; width: 100%; margin: 30px 0 0; padding: 12px 14px 12px 18px; border-radius: 16px; text-align: left; background: transparent; box-shadow: inset 0 0 0 1px var(--line); transition: background .2s; }
.ferdi-toggle:active { background: var(--card); }
.ferdi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ferdi-text b { font: italic 800 18px/1 var(--display); text-transform: uppercase; color: var(--dim); letter-spacing: .04em; }
.ferdi-text small { margin-top: 3px; color: #5a5a60; font-size: 12px; font-weight: 600; }
.ferdi-switch { width: 44px; height: 26px; border-radius: 13px; background: #2a2a2e; position: relative; flex: none; transition: background .2s; }
.ferdi-switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #8a8a93; transition: transform .2s, background .2s; }
.ferdi-toggle.on .ferdi-text b { color: #ff3d6e; }
.ferdi-toggle.on .ferdi-switch { background: #ff3d6e; }
.ferdi-toggle.on .ferdi-switch i { transform: translateX(18px); background: #fff; }
.ferdi-badge { font: italic 900 13px/1 var(--display); text-transform: uppercase; letter-spacing: .1em; background: #ff3d6e; color: #0a0a0a; padding: 4px 8px; border-radius: 6px; }

/* language picker */
.select { appearance: none; -webkit-appearance: none; max-width: 60%; background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a8a93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--text); border: 0; border-radius: 12px; padding: 10px 34px 10px 14px; font: 600 15px var(--ui); cursor: pointer; }
.select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Ferdi pictures */
.ferdi-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; filter: grayscale(.6); opacity: .7; }
.ferdi-toggle.on .ferdi-avatar { filter: none; opacity: 1; box-shadow: 0 0 0 2px #ff3d6e; }
.ferdi-pic { width: min(64vw, 30dvh, 320px); aspect-ratio: 1; border-radius: 28px; overflow: hidden; margin-bottom: 1.2dvh; box-shadow: 0 14px 40px #0000004d, 0 0 0 4px var(--ink); transform: rotate(-2deg); flex: none; }
.ferdi-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ferdi-pic.pop { animation: ferdiPop .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes ferdiPop { 0% { transform: rotate(-8deg) scale(.7); } 100% { transform: rotate(-2deg) scale(1); } }
.run.ferdi .phase { font-size: clamp(40px, 14vw, 96px); }
.run.ferdi .phase.long { font-size: clamp(34px, 11vw, 80px); }
.run.ferdi .time { font-size: min(34vw, 22dvh, 220px); }
.run.ferdi .time.long { font-size: min(26vw, 17dvh, 170px); }
.run.ferdi .meta { font-size: clamp(18px, 5.5vw, 30px); }
.run.ferdi.is-paused .ferdi-pic { filter: grayscale(1); }
.ferdi-done { display: block; width: min(62vw, 280px); aspect-ratio: 1; object-fit: cover; margin: 0 auto; border-radius: 28px; box-shadow: 0 0 0 4px var(--accent), 0 0 60px #fff10340; animation: pop .55s cubic-bezier(.2, 1.6, .4, 1); }
@media (orientation: landscape) and (max-height: 560px) {
  .ferdi-pic { width: 34dvh; margin-bottom: 0; }
  .run.ferdi .time { font-size: min(30dvh, 20vw); }
}

.reset-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px auto 0; padding: 10px 14px; color: var(--dim); font-size: 13px; font-weight: 600; border-radius: 12px; }
.reset-link svg { width: 14px; height: 14px; }
.reset-link:active { background: var(--card); }
