/* Interval Timer styles. Skin colours and fonts arrive as CSS variables from js/app.js (setSkin). */

:root {
  color-scheme: dark;
  --bg: #0e1014; --card: #171a21; --card-2: #1f232c; --line: #2a2f3a;
  --text: #f2efe8; --dim: #8b909b;
  --work: #f5a854; --rest: #8ab8ff;
  --quiet: #3a404c; --ring: rgba(255,255,255,.08);
}
/* --sky, --work and --rest are set per skin by applySkin() in app.js (colours live in js/skins.js) */
body { --sky: #0c1434; --work-light: color-mix(in srgb, var(--work) 65%, white); --work-deep: color-mix(in srgb, var(--work) 78%, black); }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
/* Glass cards so the sky shows through */
.glass { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  margin: 0; color: var(--text);
  background: var(--sky);
  font: 16px/1.5 system-ui, sans-serif; font-family: var(--font), system-ui, sans-serif; /* --font comes from the skin */
  user-select: none; font-variant-numeric: tabular-nums;
}
main { max-width: 440px; margin: 0 auto; padding: calc(56px + env(safe-area-inset-top)) 18px 40px; min-height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
svg.icon { width: 26px; height: 26px; fill: currentColor; display: block; }

/* Preset cards + the "+" card that saves the current settings */
.presets { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.preset { flex: 1 1 120px; min-width: 0; position: relative; text-align: left; border-radius: 18px; padding: 14px 14px 12px;
          transition: border-color .15s, background .15s, box-shadow .15s; }
.preset.on { border-color: var(--work); background: color-mix(in srgb, var(--work) 16%, transparent);
             box-shadow: 0 0 28px color-mix(in srgb, var(--work) 22%, transparent); }
.preset .name { font-weight: 600; font-size: 17px; display: block; }
.preset .spec { color: var(--dim); font-size: 13px; display: block; margin: 1px 0 10px; white-space: nowrap; overflow: hidden; }
.preset.on .spec { color: var(--text); opacity: .75; }
.preset .bar { height: 8px; }
.preset .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%;
             background: transparent; color: var(--dim); font-size: 18px; line-height: 1; }
.preset.add { flex: 0 0 56px; display: flex; align-items: center; justify-content: center; color: var(--dim);
              border-style: dashed; font-size: 28px; font-weight: 300; padding: 0; }

/* Timeline strip: one block per segment; the part still to come is dimmed */
.bar { display: flex; gap: 2px; border-radius: 999px; overflow: hidden; height: 10px; position: relative; }
.bar > i { display: block; flex: 1 1 0; background: var(--quiet); }
.bar > i.work { background: var(--work); }
.bar > i.rest { background: var(--rest); }
.bar > i.lead, .bar > i.fade { background: rgba(255,255,255,.14); }
.bar > s { position: absolute; top: 0; bottom: 0; right: 0; background: var(--bg); opacity: .72; }
.bar > b { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: #fff;
           border-radius: 2px; box-shadow: 0 0 10px #fff; }

/* Settings */
.card { border-radius: 20px; padding: 2px 16px; margin-top: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
       padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.row:last-child { border-bottom: 0; }
.row label { color: var(--dim); font-size: 15px; display: flex; align-items: center; gap: 10px; }
.row label .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--work); }
.row label .dot.rest { background: var(--rest); }
.step { display: flex; align-items: center; background: rgba(255,255,255,.08); border-radius: 12px; padding: 3px; }
.step button { width: 42px; height: 38px; border-radius: 9px; border: 0; background: transparent; font-size: 22px; line-height: 1; }
.step button:active { background: rgba(255,255,255,.12); }
.step .val { display: flex; align-items: baseline; justify-content: center; width: 62px; gap: 2px; }
.step input { width: 44px; text-align: right; background: transparent; color: var(--text);
              border: 0; font: inherit; font-size: 20px; font-weight: 500; padding: 0; }
.step input:focus { outline: none; }
.step .unit { color: var(--dim); font-size: 13px; }
select { background: rgba(255,255,255,.08); color: var(--text); border: 0; border-radius: 12px;
         padding: 10px 12px; font: inherit; font-size: 15px; max-width: 56%; }
.switch { position: relative; width: 48px; height: 28px; margin: 0; appearance: none; background: rgba(255,255,255,.08);
          border-radius: 999px; border: 1px solid rgba(255,255,255,.1); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
                 border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.switch:checked { background: var(--work-deep); border-color: var(--work-deep); }
.switch:checked::after { transform: translateX(20px); background: #fff; }

/* Start: total time + one big round play button */
.go { display: flex; flex-direction: column; align-items: center; margin-top: 20px; }
.go b { font-size: 44px; font-weight: 500; letter-spacing: -0.01em; line-height: 1; }
.play { border: 0; color: #1a1206; display: flex; align-items: center; justify-content: center; transition: transform .1s; }
/* Button styles, chosen per skin (js/skins.js "button") */
body[data-btn="glow"] .play { border-radius: 50%; background: linear-gradient(135deg, var(--work-light), var(--work-deep));
                              box-shadow: 0 12px 36px color-mix(in srgb, var(--work-deep) 35%, transparent); }
body[data-btn="ring"] .play { border-radius: 50%; background: transparent; border: 3px solid var(--work); color: var(--work); }
body[data-btn="soft"] .play { border-radius: 34%; background: var(--work); color: #2a1a22; }
body[data-btn="flat"] .play { border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--work); color: var(--work); }
.play:active { transform: scale(.95); }
.play:disabled { opacity: .5; box-shadow: none; }
#start { margin-top: 20px; width: 96px; height: 96px; }
#start svg.icon { width: 40px; height: 40px; margin-left: 5px; }
.msg { color: var(--dim); text-align: center; min-height: 1.5em; margin-top: 14px; font-size: 14px; }

/* Player */
/* Fills the screen; drag left/right anywhere on it to scrub */
#player { display: flex; flex-direction: column; align-items: center; padding-top: 2vh;
          min-height: calc(100dvh - 96px); touch-action: none; }
#skin { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border: 0;
        border-radius: 50%; background: transparent; color: var(--dim); display: flex; align-items: center; justify-content: center; }
#skin:active { color: var(--text); }
#phase { font-size: 15px; letter-spacing: .3em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
#phase.work { color: var(--work); }
#phase.rest { color: var(--rest); }
.ring { position: relative; width: min(300px, 36vh); height: min(300px, 36vh); margin: 16px 0 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 16; stroke-linecap: round; }
.ring .track { stroke: var(--ring); }
.ring .arc { stroke: var(--work); transition: stroke .3s; }
.ring .arc.rest { stroke: var(--rest); }
.ring .arc.quiet { stroke: var(--dim); }
.ring .head { fill: #fff; stroke: none; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column;
                align-items: center; justify-content: center; }
#clock { font-size: min(88px, 10.5vh); font-weight: var(--clock-weight, 200); letter-spacing: -0.02em; line-height: 1; }
#clock .d { display: inline-block; width: var(--digit, .6em); text-align: center; } /* one cell per digit: no jitter */
/* the clock sits exactly in the middle of the ring; the round count hangs below it */
#round { position: absolute; left: 0; right: 0; top: 67%; text-align: center; color: var(--dim);
         font-size: 20px; font-weight: 300; letter-spacing: .05em; }
#player .bar { width: 100%; margin: 20px 0 8px; height: 12px; }
.times { width: 100%; display: flex; justify-content: space-between; color: var(--dim);
         font-size: 15px; font-weight: 300; letter-spacing: .04em; }
#player .controls { flex: 1; min-height: 140px; display: flex; align-items: center; justify-content: center; width: 100%; }
#pause { width: 120px; height: 120px; }
#pause svg.icon { width: 50px; height: 50px; }
#pause #icon-play { margin-left: 6px; }
[hidden] { display: none !important; }
