/* Pomodoro — a tiling-window-manager style focus timer.
   Layout borrows from Omarchy/Hyprland: a status bar, gapped tiles with
   rounded borders, workspaces, and keyboard-first navigation. */

/* ---------------------------------------------------------------- themes */

:root {
    /* tokyo-night (default) */
    --bg: #16161e;
    --bg-glow-1: #7aa2f7;
    --bg-glow-2: #bb9af7;
    --tile: #1a1b26;
    --tile-2: #20212e;
    --border: #2a2b3d;
    --fg: #c0caf5;
    --fg-dim: #7f88b0;
    --fg-faint: #6c76a3;
    --accent: #7aa2f7;
    --accent-2: #bb9af7;
    --green: #9ece6a;
    --yellow: #e0af68;
    --red: #f7768e;
    --cyan: #7dcfff;

    /* geometry */
    --gap: 10px;
    --radius: 12px;
    --radius-sm: 8px;
    --bar-h: 40px;
    --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

[data-theme="catppuccin"] {
    --bg: #11111b; --bg-glow-1: #cba6f7; --bg-glow-2: #89b4fa;
    --tile: #181825; --tile-2: #1e1e2e; --border: #313244;
    --fg: #cdd6f4; --fg-dim: #a6adc8; --fg-faint: #7f849c;
    --accent: #cba6f7; --accent-2: #f5c2e7;
    --green: #a6e3a1; --yellow: #f9e2af; --red: #f38ba8; --cyan: #89dceb;
}

[data-theme="everforest"] {
    --bg: #1e2326; --bg-glow-1: #a7c080; --bg-glow-2: #83c092;
    --tile: #272e33; --tile-2: #2e383c; --border: #3d484d;
    --fg: #d3c6aa; --fg-dim: #9da9a0; --fg-faint: #8d968b;
    --accent: #a7c080; --accent-2: #83c092;
    --green: #a7c080; --yellow: #dbbc7f; --red: #e67e80; --cyan: #7fbbb3;
}

[data-theme="gruvbox"] {
    --bg: #1d2021; --bg-glow-1: #fabd2f; --bg-glow-2: #fe8019;
    --tile: #282828; --tile-2: #32302f; --border: #3c3836;
    --fg: #ebdbb2; --fg-dim: #bdae93; --fg-faint: #a89984;
    --accent: #fabd2f; --accent-2: #fe8019;
    --green: #b8bb26; --yellow: #fabd2f; --red: #fb4934; --cyan: #8ec07c;
}

[data-theme="rose-pine"] {
    --bg: #16141f; --bg-glow-1: #ebbcba; --bg-glow-2: #c4a7e7;
    --tile: #1f1d2e; --tile-2: #26233a; --border: #33304a;
    --fg: #e0def4; --fg-dim: #a6a2c0; --fg-faint: #8b86a8;
    --accent: #ebbcba; --accent-2: #c4a7e7;
    --green: #9ccfd8; --yellow: #f6c177; --red: #eb6f92; --cyan: #9ccfd8;
}

[data-theme="nord"] {
    --bg: #242933; --bg-glow-1: #88c0d0; --bg-glow-2: #81a1c1;
    --tile: #2e3440; --tile-2: #363d4c; --border: #3f4757;
    --fg: #eceff4; --fg-dim: #b8c1d1; --fg-faint: #929db3;
    --accent: #88c0d0; --accent-2: #81a1c1;
    --green: #a3be8c; --yellow: #ebcb8b; --red: #bf616a; --cyan: #8fbcbb;
}

[data-theme="latte"] {
    --bg: #dce0e8; --bg-glow-1: #8839ef; --bg-glow-2: #1e66f5;
    --tile: #eff1f5; --tile-2: #e6e9ef; --border: #ccd0da;
    --fg: #4c4f69; --fg-dim: #6c6f85; --fg-faint: #7c7f93;
    --accent: #8839ef; --accent-2: #ea76cb;
    --green: #40a02b; --yellow: #df8e1d; --red: #d20f39; --cyan: #179299;
}

/* ------------------------------------------------------------ foundation */

* { box-sizing: border-box; }

/* Author display rules outrank the UA's [hidden] rule, so state it here. */
[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 450;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
}

/* Wallpaper: soft mesh of the theme's accents, like a WM desktop backdrop. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(75% 70% at 12% 8%, color-mix(in srgb, var(--bg-glow-1) 26%, transparent), transparent 100%),
        radial-gradient(70% 65% at 88% 92%, color-mix(in srgb, var(--bg-glow-2) 22%, transparent), transparent 100%),
        radial-gradient(60% 60% at 75% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 100%);
    transition: background .35s ease;
    pointer-events: none;
}

#shell {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--gap);
    gap: var(--gap);
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ------------------------------------------------------------ status bar */

.bar {
    flex: 0 0 auto;
    height: var(--bar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    padding: 0 6px 0 10px;
    background: var(--tile);
    background: color-mix(in srgb, var(--tile) 82%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.bar-left, .bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
}

.bar-right { justify-content: flex-end; }

/* The mark doubles as the way back to the site — the only link home, and
   the one thing zen view keeps, so it stays put at every width. */
.bar-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: 14px;
    margin-right: 4px;
    text-decoration: none;
    transition: opacity .18s ease;
}

.bar-logo .bar-home { font-size: 11px; color: var(--fg-dim); white-space: nowrap; }

@media (hover: hover) {
    .bar-logo:hover { opacity: .75; }
}

.workspaces {
    display: flex;
    gap: 4px;
}

.ws {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--fg-faint);
    font: inherit;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.ws:hover { color: var(--fg-dim); background: color-mix(in srgb, var(--fg) 6%, transparent); }

.ws[aria-selected="true"] {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

.ws .ws-num { opacity: .65; }
.ws[aria-selected="true"] .ws-num { opacity: .8; }
.ws .ws-name { letter-spacing: .02em; }

.bar-title {
    flex: 0 1 auto;
    min-width: 0;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.bar-title .dot {
    color: var(--accent);
    margin-right: 6px;
}

.bar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 70%, transparent);
    color: var(--fg-dim);
    font: inherit;
}

button.bar-item {
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease;
}

button.bar-item:hover { color: var(--fg); border-color: var(--accent); }
.bar-item .swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.bar-item.is-muted {
    color: var(--fg-faint);
    border-style: dashed;
}

/* ------------------------------------------------------------ tiling area */

.desktop {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr);
    gap: var(--gap);
}

.stack {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    overflow: hidden;
}

.workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    animation: tile-in .28s cubic-bezier(.2, .8, .3, 1);
}

.workspace > .tile { flex: 0 0 auto; }
.workspace > .tile.grow { flex: 1 1 0; }

.workspace[hidden] { display: none; }

@keyframes tile-in {
    from { opacity: 0; transform: translateY(6px) scale(.99); }
    to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- tiles */

.tile {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--tile);
    background: color-mix(in srgb, var(--tile) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.tile.is-focused {
    border-color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
                0 10px 40px -18px color-mix(in srgb, var(--accent) 60%, transparent);
}

.tile-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 55%, transparent);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--fg-faint);
}

.tile-head .lamp {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fg-faint);
    flex: 0 0 auto;
}

.tile.is-focused .tile-head .lamp { background: var(--accent); }
.tile-head .title {
    color: var(--fg-dim);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.tile-head .spacer { flex: 1 1 auto; }
.tile-head .meta { color: var(--fg-faint); }

.tile-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tile-body::-webkit-scrollbar { width: 8px; }
.tile-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

/* ------------------------------------------------------------ timer tile */

.tile-timer .tile-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 20px;
}

.mode-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 60%, transparent);
}

.mode-switch button {
    padding: 6px 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--fg-faint);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}

.mode-switch button:hover { color: var(--fg-dim); }

.mode-switch button[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
}

.dial {
    position: relative;
    width: min(52vh, 100%, 430px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.dial svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* let the ring's glow spill instead of being clipped to a visible square */
    overflow: visible;
    transform: rotate(-90deg);
}

.dial .track {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.dial .progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 55%, transparent));
    transition: stroke-dashoffset .3s linear, stroke .35s ease;
}

.dial.is-break .progress { stroke: var(--green); }
.dial.is-break .readout .digits { color: var(--green); }

.readout {
    position: relative;
    text-align: center;
    line-height: 1;
}

.readout .digits {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(3rem, 11vh, 5.25rem);
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    transition: color .35s ease, opacity .3s ease;
}

.is-paused .readout .digits { opacity: .62; }

.readout .label {
    display: block;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--fg-faint);
}

.rounds {
    display: flex;
    align-items: center;
    gap: 7px;
}

.rounds .pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--fg-faint);
    transition: background-color .25s ease, border-color .25s ease, transform .25s ease;
}

.rounds .pip.done { background: var(--accent); border-color: var(--accent); }
.rounds .pip.current { border-color: var(--accent); transform: scale(1.35); }

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 80%, transparent);
    color: var(--fg-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .1s ease;
}

.key-btn:hover { color: var(--fg); border-color: var(--fg-faint); }
.key-btn:active { transform: translateY(1px); }

.key-btn.primary {
    min-width: 132px;
    justify-content: center;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

.key-btn.primary:hover {
    background: color-mix(in srgb, var(--accent) 85%, var(--fg));
    border-color: color-mix(in srgb, var(--accent) 85%, var(--fg));
    color: var(--bg);
}

.key-btn kbd {
    padding: 1px 5px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font: inherit;
    font-size: 10px;
    opacity: .6;
}

.focus-input {
    width: min(420px, 100%);
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 60%, transparent);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    transition: border-color .2s ease;
}

.focus-input::placeholder { color: var(--fg-faint); }
.focus-input:focus { outline: none; border-color: var(--accent); }

/* --------------------------------------------------------------- widgets */

.field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}

.field:last-child { border-bottom: 0; }
.field.is-disabled { opacity: .55; }
.field.is-disabled .toggle { cursor: not-allowed; }
.field .name { color: var(--fg-dim); font-size: 13px; font-weight: 500; }
.field .hint { display: block; color: var(--fg-faint); font-size: 11px; font-weight: 450; }

.stepper {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 70%, transparent);
}

.stepper button {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--fg-dim);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.stepper button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

.stepper .value {
    min-width: 58px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

.stepper .value .unit { color: var(--fg-faint); font-size: 11px; margin-left: 2px; }

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 80%, transparent);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--fg-faint);
    transform: translateY(-50%);
    transition: transform .2s cubic-bezier(.2, .8, .3, 1), background-color .2s ease;
}

.toggle[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 25%, transparent);
    border-color: var(--accent);
}

.toggle[aria-pressed="true"]::after {
    transform: translate(16px, -50%);
    background: var(--accent);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.preset {
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 55%, transparent);
    color: var(--fg-dim);
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, transform .12s ease;
}

.preset:hover { border-color: var(--accent); color: var(--fg); transform: translateY(-1px); }

.preset[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--fg);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.preset .p-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}

.preset .p-spec {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--fg-faint);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 8px;
}

.theme-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 55%, transparent);
    color: var(--fg-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease;
}

.theme-chip:hover { color: var(--fg); border-color: var(--fg-faint); }
.theme-chip[aria-pressed="true"] { border-color: var(--accent); color: var(--fg); }

.theme-chip .dots { display: flex; gap: 3px; flex: 0 0 auto; }
.theme-chip .dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: block;
}

.queue {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--tile-2) 40%, transparent);
    font-size: 12px;
    color: var(--fg-dim);
    transition: border-color .2s ease, color .2s ease;
}

.queue li .idx { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--fg-faint); }
.queue li .dur { margin-left: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--fg-faint); }
.queue li.is-focus { border-left-color: var(--accent); }
.queue li.is-break { border-left-color: var(--green); }
.queue li.is-current {
    color: var(--fg);
    border-color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.queue li.is-done { opacity: .45; }

/* ------------------------------------------------------------- zen view */

/* Everything but the clock steps back: the stack, the panel tabs and the
   keybinding strip go away, and the timer loses its tile chrome so it sits
   directly on the wallpaper. */

#shell.is-zen .stack,
#shell.is-zen .workspaces,
#shell.is-zen .tile-timer > .tile-head { display: none; }

#shell.is-zen .desktop { grid-template-columns: minmax(0, 1fr); }

#shell.is-zen .tile-timer {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

#shell.is-zen .tile-timer .tile-body { gap: 26px; }

#shell.is-zen .dial { width: min(62vh, 100%, 560px); }

#shell.is-zen .bar {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
}

#shell.is-zen .bar-logo { color: var(--fg-faint); }

/* On a desktop the key strip stays — it carries the shortcuts — but loses
   its panel so it reads as a caption. (On touch there are no shortcuts to
   show, so it is hidden altogether.) */
#shell.is-zen .keys {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
}

#zenToggle[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

/* ---------------------------------------------------------- keybind strip */

.keys {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--tile);
    background: color-mix(in srgb, var(--tile) 72%, transparent);
    backdrop-filter: blur(12px);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--fg-faint);
    overflow-x: auto;
    scrollbar-width: none;
}

.keys::-webkit-scrollbar { display: none; }

.keys .bind { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.keys kbd {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--tile-2);
    background: color-mix(in srgb, var(--tile-2) 80%, transparent);
    color: var(--fg-dim);
    font: inherit;
    font-size: 10px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 980px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    #shell {
        height: auto;
        min-height: 100%;
    }

    .desktop { grid-template-columns: 1fr; }

    /* Auto-height stacking: growing to fill would collapse a basis-0 tile. */
    .workspace > .tile.grow { flex: 0 0 auto; }

    .stack { overflow: visible; }

    .tile-timer { min-height: min(76vh, 620px); }

    .tile-body { overflow: visible; }

    .bar-title { display: none; }

    .bar-left, .bar-right { min-width: 0; }

    /* The page scrolls at this size, so the bar — and with it the link home,
       the theme and the zen toggle — rides along instead of scrolling away. */
    .bar {
        position: sticky;
        top: var(--gap);
        z-index: 5;
    }
}

@media (max-width: 640px) {
    :root { --gap: 8px; }

    .ws .ws-name { display: none; }
    .ws { padding: 0 11px; }

    #barRound { display: none; }

    /* The bar is full at this width — the swatch alone says which theme it is,
       and it was pushing the clock off the edge. */
    #themeName { display: none; }

    /* No keyboard to shortcut with, and it sits below the fold anyway. */
    .keys { display: none; }

    .controls { flex-wrap: wrap; justify-content: center; }
    .key-btn kbd { display: none; }

    .dial { width: min(56vw + 90px, 100%); }
    .preset-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 360px) {
    /* Last thing to give, so the link home and both tabs keep their room —
       a phone shows the time in its own status bar anyway. */
    #barClock { display: none; }

    .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
