@font-face {
  font-family: 'Archivo Expanded';
  src: url(assets/fonts/archivo-expanded-800.woff2) format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url(assets/fonts/plus-jakarta-sans.woff2) format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --pink: #d91c72;
  --pink-hi: #ff4f9a;
  --accent: var(--pink);
  --accent-hi: var(--pink-hi);
  --ink: rgba(52, 10, 40, .9);
  --ink-soft: rgba(52, 10, 40, .55);
  --line: rgba(255, 255, 255, .75);
  --line-soft: rgba(255, 220, 236, .18);
  --muted: #f2bcd4;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --display: 'Archivo Expanded', 'Arial Black', system-ui, sans-serif;
  --text: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --edge: clamp(16px, 3.5vw, 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 500 15px/1.45 var(--text);
  color: #fff;
  background: #4a1038;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* The accent follows the timer mode so a glance tells you whether you're on a break. */
body[data-mode=short] { --accent: #b02fa0; --accent-hi: #e05ccf; }
body[data-mode=long] { --accent: #7c3aed; --accent-hi: #a878ff; }

#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 5;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: 0 4px 4px 0;
  transform-origin: left; transform: scaleX(0);
  transition: transform .25s linear, background-color .4s;
}

/* Clear mode */
.top, .corner, .modes, .dots, .controls, #task-title .i { transition: opacity .8s ease; }
body.idle { cursor: none; }
body.idle :is(.top, .corner, .modes, .dots, .controls, #task-title .i) { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .top, .corner, .modes, .dots, .controls, #task-title .i, #progress { transition: none; }
}

#time { transition: opacity .3s; }
body.paused #time, body.paused #mini-time { opacity: .6; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
#i-pause path { fill: currentColor; stroke: none; }

/* ---------- background */
.bg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.shade {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 50% 50%, rgba(60, 8, 44, .28), transparent 75%),
    linear-gradient(to bottom, rgba(60, 8, 44, .35), transparent 22%, transparent 72%, rgba(60, 8, 44, .4));
}
/* Gradient backgrounds, drawn in CSS so they need no file or network. Aurora is the default. */
[data-gradient=aurora] {
  background:
    radial-gradient(50% 65% at 10% 18%, #ff6fae 0%, transparent 62%),
    radial-gradient(45% 55% at 90% 10%, #ffa48f 0%, transparent 60%),
    radial-gradient(55% 60% at 75% 90%, #c0156a 0%, transparent 66%),
    radial-gradient(40% 50% at 28% 82%, #ffb3d2 0%, transparent 62%),
    linear-gradient(135deg, #7a1459 0%, #d9407e 55%, #ff8aa8 100%);
}
[data-gradient=dusk] {
  background:
    radial-gradient(50% 60% at 18% 20%, #9b4dff 0%, transparent 60%),
    radial-gradient(45% 55% at 86% 24%, #ff4f9a 0%, transparent 60%),
    radial-gradient(60% 60% at 60% 96%, #2a0d4f 0%, transparent 70%),
    linear-gradient(160deg, #3b0f5c 0%, #6b1a6e 50%, #b0306e 100%);
}
[data-gradient=peach] {
  background:
    radial-gradient(50% 60% at 14% 14%, #ffc3a0 0%, transparent 60%),
    radial-gradient(45% 55% at 86% 18%, #ff7eb3 0%, transparent 60%),
    radial-gradient(55% 60% at 70% 92%, #d8406f 0%, transparent 66%),
    linear-gradient(135deg, #ee8466 0%, #e2527b 55%, #a83372 100%);
}
[data-gradient=midnight] {
  background:
    radial-gradient(45% 55% at 82% 18%, #c0156a 0%, transparent 60%),
    radial-gradient(50% 60% at 14% 82%, #5a1fb0 0%, transparent 62%),
    linear-gradient(150deg, #120720 0%, #2a0b33 55%, #4a0d3a 100%);
}
body[data-gradient] .shade { background: radial-gradient(ellipse 55% 45% at 50% 50%, rgba(80, 8, 52, .26), transparent 75%); }
.swatch { display: block; width: 100%; height: 100%; }

/* ---------- top corners */
.top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  padding: calc(var(--edge) + env(safe-area-inset-top, 0px)) var(--edge) 0;
  pointer-events: none;
  text-shadow: 0 1px 16px rgba(0, 0, 0, .25);
}
.brand { font: 800 clamp(1.6rem, 3vw, 2.3rem)/1 var(--display); letter-spacing: -.045em; }
.brand::after {
  content: ''; display: inline-block; width: .26em; height: .26em; margin-left: .08em;
  border-radius: 50%; background: var(--accent-hi); transition: background-color .4s;
}
#quote {
  margin: 0; max-width: 22ch; text-align: right;
  font-weight: 700; font-size: clamp(1rem, 1.7vw, 1.45rem); line-height: 1.25; letter-spacing: -.01em;
  text-wrap: balance;
}

/* ---------- centre */
main {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 96px var(--edge);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 2px 28px rgba(10, 6, 20, .3);
}
.home-view, .focus-view { display: flex; flex-direction: column; align-items: center; }
body:not([data-view=home]) .home-view,
body:not([data-view=focus]) .focus-view,
body:not([data-view=ambient]) .mini,
body[data-view=ambient] #quote { display: none; }

.numerals { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }

#greeting { font-weight: 700; font-size: clamp(1.5rem, 3.4vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
#clock { font: 800 clamp(5rem, 19vw, 15rem)/.95 var(--display); letter-spacing: -.045em; margin-top: 8px; font-variant-numeric: tabular-nums; }
#date { font-weight: 700; font-size: clamp(1rem, 1.6vw, 1.25rem); margin-top: 12px; }

#task-title {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: clamp(1.25rem, 2.6vw, 2.1rem); letter-spacing: -.02em;
  max-width: min(90vw, 36ch); margin-bottom: 20px;
}
#task-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#task-title.empty { opacity: .75; font-weight: 600; }
#task-title .i { width: 22px; height: 22px; opacity: .8; }
#task-title:hover .i { opacity: 1; }

.modes { position: relative; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pill {
  position: relative; z-index: 1;
  min-width: 128px; padding: 9px 22px;
  border: 2px solid var(--line); border-radius: 999px;
  font-weight: 700; font-size: 1rem;
  transition: background-color .2s, border-color .4s;
}
.pill:hover { background: rgba(255, 255, 255, .14); }
.pill.active, .pill.active:hover { background: transparent; border-color: var(--accent); }
/* One filled blob slides between the mode pills. */
#mode-thumb {
  position: absolute; top: 0; left: 0; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: background-color .4s, box-shadow .4s;
}
#mode-thumb.ready { transition: transform .5s var(--spring), width .5s var(--spring), background-color .4s, box-shadow .4s; }

.dots { display: flex; gap: 6px; margin-top: 12px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); box-shadow: 0 0 6px rgba(10, 6, 20, .35); }
.dots i.on { background: #fff; box-shadow: 0 0 8px var(--accent-hi); }
.dots i.new { animation: pop .6s var(--spring); }
@keyframes pop { 0% { scale: .2; } 60% { scale: 1.8; } 100% { scale: 1; } }

#time { font-size: clamp(5.5rem, 20vw, 15.5rem); line-height: .95; margin: 8px 0 16px; }

.controls { display: flex; align-items: center; gap: 16px; }
.btn-primary {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 12px 40px; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .12);
  transition: background-color .4s, box-shadow .4s, translate .3s var(--spring);
}
.btn-primary:hover { translate: 0 -2px; box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .12); }
.controls .btn-primary { min-width: 128px; }
.btn-primary.small { padding: 7px 28px; font-size: .9rem; }
.icon-plain { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; transition: background-color .2s, rotate .5s var(--spring); }
.icon-plain .i { width: 30px; height: 30px; stroke-width: 2.25; }
.icon-plain:hover { background: rgba(255, 255, 255, .14); rotate: -40deg; }

/* ---------- ambient card */
.mini {
  position: fixed; top: calc(var(--edge) + env(safe-area-inset-top, 0px)); right: var(--edge);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 34px 20px; border-radius: 28px;
  background: var(--ink-soft);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#mini-mode { font-weight: 600; }
#mini-time { font-size: 3.2rem; line-height: 1; }

/* ---------- bottom corners */
.corner {
  position: fixed; bottom: calc(var(--edge) + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 10px;
}
.corner.left { left: var(--edge); }
.corner.right { right: var(--edge); }
.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background-color .2s, translate .3s var(--spring);
}
.icon-btn:hover { background: var(--ink); translate: 0 -3px; }
.icon-btn.active { background: var(--accent); }
.icon-btn .live {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-hi); box-shadow: 0 0 0 2px rgba(52, 10, 40, .9);
  animation: beat 1.6s ease-in-out infinite;
}
.icon-btn.active .live { background: #fff; box-shadow: none; }
@keyframes beat { 0%, 100% { scale: 1; } 15% { scale: 1.4; } 30% { scale: 1; } 45% { scale: 1.25; } }

.seg {
  display: flex; gap: 2px; padding: 2px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--ink-soft);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.seg button { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; transition: background-color .3s; }
.seg button:hover { background: rgba(255, 255, 255, .12); }
.seg button[aria-pressed=true] { background: var(--accent); box-shadow: 0 0 14px var(--accent-hi); transition: background-color .4s; }
.seg .i { width: 18px; height: 18px; }

/* ---------- panels */
.panel {
  position: fixed; z-index: 10;
  background: var(--ink);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 32px;
  box-shadow: 0 24px 64px rgba(40, 4, 28, .45);
  overflow-y: auto;
  animation: pop-in .45s var(--spring);
  transform-origin: bottom left;
}
.pop {
  left: var(--edge); bottom: calc(var(--edge) + 56px + env(safe-area-inset-bottom, 0px));
  width: min(480px, calc(100vw - 2 * var(--edge)));
  max-height: calc(100vh - 2 * var(--edge) - 72px);
  padding: 24px;
}
.modal {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 160px);
  padding: 40px clamp(20px, 5vw, 56px) 36px;
  animation-name: pop-center;
  transform-origin: center;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@keyframes pop-center { from { opacity: 0; transform: translate(-50%, -46%) scale(.92); } }

.panel > * + * { margin-top: 12px; }
.panel h2 { font-weight: 700; font-size: 1.35rem; letter-spacing: -.015em; }
.panel h3 { font-weight: 600; font-size: .9rem; color: var(--muted); margin-top: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.modal-title { font: 800 clamp(1.6rem, 4vw, 2.3rem)/1.1 var(--display) !important; letter-spacing: -.04em !important; text-align: center; }
.summary { text-align: center; font-size: 1.05rem; }
.summary b { font-weight: 700; }
.close { position: absolute; top: 20px; left: 20px; margin: 0 !important; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; transition: background-color .2s, rotate .4s var(--spring); }
.close:hover { background: rgba(255, 255, 255, .1); rotate: 90deg; }
.close .i { width: 26px; height: 26px; }

.panel input:not([type=checkbox]):not([type=range]) {
  width: 100%; min-width: 0;
  padding: 11px 18px; border-radius: 999px;
  border: 1.5px solid var(--line-soft); background: rgba(255, 255, 255, .06);
  transition: border-color .2s, background-color .2s;
}
.panel input:focus-visible { outline: none; border-color: var(--accent-hi); }
.panel input::placeholder { color: rgba(255, 255, 255, .45); }
input[type=checkbox], input[type=range] { accent-color: var(--accent); }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  display: grid; place-items: center; flex-shrink: 0;
  width: 20px; height: 20px; margin: 0; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .5); border-radius: 50%;
  transition: background-color .15s, border-color .15s;
}
input[type=checkbox]:hover { border-color: #fff; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
  content: ''; width: 5px; height: 10px; margin-top: -2px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.grid label.check input[type=checkbox] { border-radius: 6px; }

.row { display: flex; gap: 8px; }
.row > button { flex-shrink: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); font-weight: 600; font-size: .9rem;
  transition: background-color .2s;
}
.chip:hover { background: rgba(255, 255, 255, .2); }
.chip .i { width: 14px; height: 14px; }
.chip.wide { width: 100%; justify-content: center; padding: 10px; }

/* audio tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.tabs button { padding: 7px 18px; border-radius: 999px; font-weight: 700; color: var(--muted); transition: background-color .25s, color .25s; }
.tabs button:hover { color: #fff; }
.tabs button[aria-selected=true] { background: var(--accent); color: #fff; }
.pane > * + * { margin-top: 12px; }

/* music */
#spotify-slot { margin-top: 16px; }
#spotify-slot iframe { display: block; width: 100%; height: 152px; border: 0; border-radius: 16px; background: rgba(0, 0, 0, .25); }
.empty-player {
  display: grid; place-items: center; height: 152px; padding: 16px; text-align: center;
  border: 1.5px dashed var(--line-soft); border-radius: 16px; color: var(--muted);
}
.playlists { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.playlists button {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); font-weight: 600; font-size: .85rem;
  transition: background-color .2s, box-shadow .2s;
}
.playlists button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlists button:hover { background: rgba(255, 255, 255, .15); }
.playlists button[aria-pressed=true] { background: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: inset 0 0 0 2px var(--accent-hi); }

/* sound tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 4px; margin-top: 16px !important; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; }
.tile-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; color: var(--muted); font-size: .82rem; font-weight: 600; line-height: 1.2; }
.tile-btn .emoji {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  font-size: 1.7rem; line-height: 1;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 2px transparent;
  transition: background-color .15s, box-shadow .15s, translate .3s var(--spring);
}
.tile-btn:hover .emoji { background: rgba(255, 255, 255, .13); translate: 0 -3px; }
.tile.bounce .emoji { animation: pop .6s var(--spring); }
.tile.on .tile-btn { color: #fff; }
.tile.on .emoji {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent-hi);
}
.tile input[type=range] { width: 76px; height: 4px; }
.tile-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; opacity: 0; }
.tile-x .i { width: 14px; height: 14px; }
.tile:hover .tile-x, .tile-x:focus-visible { opacity: .7; }
.tile-x:hover { opacity: 1; background: rgba(255, 255, 255, .1); }

/* task rows */
.progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); border-radius: 999px; transition: width .6s var(--spring); }
.rows { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; margin-top: 20px !important; }
.rows li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 20px;
  border: 1.5px solid var(--line-soft);
}
.rows li { transition: border-color .15s, background-color .15s; }
.rows li:hover { background: rgba(255, 255, 255, .03); }
.rows li.pinned { border-color: var(--accent-hi); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rows li.done .grow { text-decoration: line-through; opacity: .5; }
.rows .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.rows .muted { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.rows li button:not(.chip) { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; opacity: .65; }
.rows li button:not(.chip):hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.rows li button.on { opacity: 1; color: var(--accent-hi); }
.rows .i { width: 18px; height: 18px; }
.rows.compact li { padding: 8px 10px; gap: 8px; }
.rows.compact .grow { font-size: .9rem; }
.rows.empty-note { color: var(--muted); }
#task-form { margin-top: 20px; }

.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px !important; }
.thumbs button { border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; outline-offset: 2px; }
.thumbs button.active { outline: 2px solid var(--accent-hi); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px !important; }
.grid label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.grid label.span { grid-column: 1 / -1; }
.grid label.check { flex-direction: row; align-items: center; gap: 10px; color: #fff; }
.hint { font-size: .8rem; color: var(--muted); }
.hint a { color: inherit; }

#toast {
  position: fixed; z-index: 20; top: calc(16px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 999px; background: var(--ink); font-weight: 600; font-size: .9rem;
  animation: toast-in .45s var(--spring);
}
@keyframes toast-in { from { opacity: 0; translate: 0 -16px; scale: .9; } }

.confetti {
  position: fixed; z-index: 30; pointer-events: none;
  width: 12px; height: 12px; border-radius: 3px;
  font: 700 24px/1 var(--text); text-align: center;
  filter: drop-shadow(0 2px 4px rgba(60, 8, 44, .35));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  #mode-thumb.ready, .btn-primary, .icon-btn, .icon-plain, .close, .progress span { transition-duration: .01s !important; }
}

@media (max-width: 640px) {
  #quote { display: none; }
  .pill { min-width: 0; padding: 7px 14px; font-size: .9rem; }
  .modes { gap: 8px; }
  .grid { grid-template-columns: 1fr; }
  .thumbs { grid-template-columns: repeat(3, 1fr); }
  .playlists { grid-template-columns: repeat(2, 1fr); }
  .mini { left: var(--edge); right: var(--edge); top: 80px; }
  .modal { max-height: calc(100vh - 120px); }
  .corner { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .seg button { width: 32px; height: 32px; }
}
