/* ============================================================
   Pomodoro — a small, tactile desk instrument
   Newsreader handles the human voice; IBM Plex Sans handles the
   machine. Both are local Google Fonts assets and work offline.
   ============================================================ */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/newsreader-variable.ttf") format("truetype");
}

/* ---------- tokens: day ---------- */
:root {
  color-scheme: light;
  --desk:       #b8afa0;
  --desk-deep:  #958b7d;
  --case:       #ece5d8;
  --case-high:  #f8f3e9;
  --case-low:   #d5ccbd;
  --well:       #dedccd;
  --well-deep:  #c9c7b9;
  --ink:        #282622;
  --ink-soft:   #514d46;
  --ink-faint:  #686258;
  --rule:       #c5bcad;
  --rule-firm:  #9f9586;
  --primary:      #294a63;
  --primary-hi:   #3b6079;
  --primary-low:  #193246;
  --primary-on:   #fffaf3;
  --secondary:    #4b7698;
  --secondary-hi: #638cac;
  --secondary-low: #315775;
  --secondary-on: #fffaf3;
  --secondary-text: #315775;
  --secondary-wash: rgba(75, 118, 152, .12);
  --status:       #294a63;
  --warning:    #a13c33;
  --shadow:     rgba(44, 37, 29, .23);
  --shadow-deep: rgba(44, 37, 29, .38);
  --shine:      rgba(255, 255, 255, .72);

  --grain: .045;
  --grain-blend: multiply;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino,
           Charter, Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 48rem;
  --gutter: clamp(1rem, 4vw, 2.6rem);
}

/* ---------- tokens: night ---------- */
[data-theme="night"] {
  color-scheme: dark;
  --desk:       #242321;
  --desk-deep:  #11110f;
  --case:       #343330;
  --case-high:  #403e3a;
  --case-low:   #22211f;
  --well:       #20211e;
  --well-deep:  #151613;
  --ink:        #eee9df;
  --ink-soft:   #c5beb2;
  --ink-faint:  #a49c90;
  --rule:       #504d47;
  --rule-firm:  #6b665d;
  --primary:      #365e7a;
  --primary-hi:   #45728f;
  --primary-low:  #244257;
  --primary-on:   #f8f3e9;
  --secondary:    #85b2d0;
  --secondary-hi: #9bc3dd;
  --secondary-low: #557f9e;
  --secondary-on: #172632;
  --secondary-text: #85b2d0;
  --secondary-wash: rgba(133, 178, 208, .12);
  --status:       #85b2d0;
  --warning:    #ef8e84;
  --shadow:     rgba(0, 0, 0, .42);
  --shadow-deep: rgba(0, 0, 0, .65);
  --shine:      rgba(255, 255, 255, .1);

  --grain: .035;
  --grain-blend: screen;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: clamp(.75rem, 3.5vw, 2.5rem);
  background:
    radial-gradient(circle at 50% -20%, rgba(255,255,255,.32), transparent 45%),
    linear-gradient(135deg, var(--desk), var(--desk-deep));
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fine material grain; deliberately less visible than the old paper texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: var(--grain-blend);
  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='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.no-grain::before { display: none; }

button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- instrument body ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(100%, var(--measure));
  min-height: calc(100dvh - clamp(1.5rem, 7vw, 5rem));
  margin: 0 auto;
  padding: clamp(1.15rem, 3.8vw, 2rem) var(--gutter) 1.25rem;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, var(--case-high), var(--case) 48%, var(--case-low));
  border: 1px solid var(--rule-firm);
  border-radius: 18px;
  box-shadow:
    0 2px 0 var(--shine) inset,
    0 -2px 0 rgba(0,0,0,.08) inset,
    0 3px 5px var(--shadow),
    0 20px 55px var(--shadow);
}

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.25rem;
  padding: 0 .2rem 1rem;
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 0 var(--shine);
}

.wordmark {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.masthead-tools { display: flex; align-items: center; gap: .55rem; flex: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-firm);
  border-radius: 50%;
  background: linear-gradient(var(--case-high), var(--case-low));
  box-shadow: 0 1px 0 var(--shine) inset, 0 2px 2px var(--shadow);
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--secondary-low); color: var(--secondary-text); }
.icon-btn:active { transform: translateY(1px); box-shadow: 0 1px 1px var(--shadow); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }

/* ---------- views ---------- */
.view { flex: 1 0 auto; }
#timerView { display: flex; flex-direction: column; }

/* ---------- timer ---------- */
.stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 27rem;
  margin: clamp(1.25rem, 4vh, 2.25rem) auto 1.5rem;
  padding: clamp(1.65rem, 5vw, 3rem) clamp(1rem, 5vw, 3rem) 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(155deg, var(--case), var(--case-high));
  border: 1px solid var(--rule-firm);
  border-radius: 13px;
  box-shadow:
    0 1px 0 var(--shine) inset,
    0 -1px 0 rgba(0,0,0,.08) inset,
    0 5px 12px var(--shadow);
}

/* Two restrained screw heads keep the object metaphor physical, not theatrical. */
.stage::before,
.stage::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--rule-firm);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--case-high), var(--case-low));
  box-shadow: 0 1px 1px var(--shadow), 0 0 0 1px var(--shine) inset;
}
.stage::before { left: 13px; }
.stage::after { right: 13px; }

.phase {
  position: relative;
  z-index: 1;
  margin: 0 0 -1px;
  padding: .28rem .8rem;
  border: 1px solid var(--rule-firm);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: var(--case);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
body.is-running .phase { color: var(--status); }

.clock {
  width: min(100%, 31rem);
  min-height: 9.6rem;
  padding: .65rem 1rem .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-firm);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255,255,255,.1), transparent 40%),
    var(--well);
  box-shadow:
    0 2px 8px var(--shadow-deep) inset,
    0 -1px 0 var(--shine) inset,
    0 1px 0 var(--shine);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(4.5rem, 17vw, 8.4rem);
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.055em;
  line-height: .9;
  text-shadow: 0 1px 0 var(--shine);
  user-select: none;
}
.clock .d { display: inline-block; min-width: .56em; text-align: center; }
.clock .sep { display: inline-block; min-width: .22em; text-align: center; opacity: .48; }
body.is-paused .clock { color: var(--ink-faint); }
body.is-paused .clock .sep { animation: blink 1.4s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.progress {
  appearance: none;
  position: relative;
  width: min(25rem, 78%);
  height: 7px;
  margin-top: 1.3rem;
  overflow: hidden;
  border: 1px solid var(--rule-firm);
  border-radius: 999px;
  background: var(--well-deep);
  box-shadow: 0 1px 2px var(--shadow) inset, 0 1px 0 var(--shine);
}
.progress::-webkit-progress-bar {
  background: transparent;
}
.progress::-webkit-progress-value {
  border-right: 1px solid var(--secondary-low);
  background: linear-gradient(var(--secondary-hi), var(--secondary));
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset;
  transition: width .95s linear;
}
.progress::-moz-progress-bar {
  border-right: 1px solid var(--secondary-low);
  background: linear-gradient(var(--secondary-hi), var(--secondary));
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset;
}
body:not(.is-running):not(.is-paused) .progress::-webkit-progress-value { background: var(--ink-faint); border-color: var(--ink-soft); }
body:not(.is-running):not(.is-paused) .progress::-moz-progress-bar { background: var(--ink-faint); border-color: var(--ink-soft); }

.cycle { margin-top: 1.05rem; display: flex; flex-direction: column; align-items: center; gap: .45rem; }
.dots { display: flex; gap: .55rem; }
.dots i {
  display: block;
  width: 9px;
  height: 9px;
  border: 1px solid var(--rule-firm);
  border-radius: 50%;
  background: var(--case-low);
  box-shadow: 0 1px 1px var(--shadow) inset, 0 1px 0 var(--shine);
}
.dots i.on { border-color: var(--ink-soft); background: var(--ink-soft); }
.dots i.now { border-color: var(--secondary-low); background: var(--secondary); box-shadow: 0 0 0 2px var(--case), 0 0 0 3px var(--secondary); }

.cycle-note,
.up-next {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .08em;
}
.cycle-note { margin: 0; }
.up-next { min-height: 1.2em; margin: 1rem 0 0; }

/* ---------- buttons ---------- */
.controls { margin-top: 1.65rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }

.btn {
  min-height: 2.75rem;
  padding: .58rem 1.25rem;
  border: 1px solid var(--rule-firm);
  border-radius: 7px;
  background: linear-gradient(var(--case-high), var(--case-low));
  box-shadow: 0 1px 0 var(--shine) inset, 0 3px 0 var(--rule-firm), 0 5px 7px var(--shadow);
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .055em;
  transition: color .12s, border-color .12s, background-color .12s, transform .08s, box-shadow .08s;
}
.btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shine) inset, 0 1px 0 var(--rule-firm), 0 2px 3px var(--shadow); }

.btn-primary {
  min-width: 9rem;
  border-color: var(--primary-low);
  background: linear-gradient(var(--primary-hi), var(--primary));
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 3px 0 var(--primary-low), 0 5px 7px var(--shadow);
  color: var(--primary-on);
}
.btn-primary:hover { border-color: var(--primary-low); color: var(--primary-on); filter: brightness(1.04); }
.btn-primary:active { box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 1px 0 var(--primary-low), 0 2px 3px var(--shadow); }

.btn-secondary {
  border-color: var(--secondary-low);
  background:
    linear-gradient(var(--secondary-wash), var(--secondary-wash)),
    linear-gradient(var(--case-high), var(--case-low));
  color: var(--secondary-text);
}
.btn-secondary:hover { border-color: var(--secondary); color: var(--secondary-text); }

.btn-quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-faint);
}
.btn-quiet:hover { border-color: var(--rule); background: rgba(255,255,255,.09); color: var(--ink); }
.btn-quiet:active { transform: translateY(1px); box-shadow: none; }
.btn-sm { min-height: 2.4rem; padding: .38rem .75rem; font-size: .76rem; }

:where(button, input, select, a):focus-visible { outline: 3px solid var(--secondary); outline-offset: 3px; }

/* ---------- quote ---------- */
.quote {
  position: relative;
  width: min(100%, 32rem);
  margin: 0 auto;
  padding: 1.3rem 2.15rem 1rem;
  border: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  box-shadow: 0 1px 0 var(--shine) inset;
  text-align: center;
}
.quote::before {
  content: "“";
  position: absolute;
  top: .68rem;
  left: .45rem;
  color: var(--secondary);
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1;
}
.quote blockquote {
  min-height: 3.1em;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.13rem;
  font-style: italic;
  line-height: 1.5;
  text-wrap: pretty;
}
.quote figcaption {
  margin-top: .45rem;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.quote-again {
  display: block;
  margin: .4rem auto 0;
  min-height: 2rem;
  padding: .25rem .45rem;
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .68;
  transition: opacity .15s;
}
.quote:hover .quote-again, .quote-again:focus-visible { opacity: 1; }
.quote-again:hover { color: var(--secondary-text); }
@media (hover: none) { .quote-again { opacity: .85; } }

/* ---------- settings ---------- */
.settings { padding-top: 1.65rem; }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin: 0 .1rem 1.4rem; }
.settings-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -.025em;
}

#settingsForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "intervals flow"
    "alerts appearance"
    "alerts storage"
    "actions actions";
  gap: 1rem;
  align-items: start;
}
#settingsForm .group:nth-of-type(1) { grid-area: intervals; }
#settingsForm .group:nth-of-type(2) { grid-area: flow; }
#settingsForm .group:nth-of-type(3) { grid-area: alerts; align-self: stretch; }
#settingsForm .group:nth-of-type(4) { grid-area: appearance; }
#settingsForm .group:nth-of-type(5) { grid-area: storage; }
#settingsForm .group:nth-of-type(1),
#settingsForm .group:nth-of-type(2) { align-self: stretch; }

.group {
  min-width: 0;
  margin: 0;
  padding: 1.15rem 1.25rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255,255,255,.045);
  box-shadow: 0 1px 0 var(--shine) inset;
}
.group legend {
  padding: 0 .45rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
}

.field { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; }
.field > label { color: var(--ink-soft); line-height: 1.3; }
.input-wrap { display: flex; align-items: center; gap: .5rem; flex: none; }

.input-wrap input[type="number"],
.input-wrap input[type="text"],
.input-wrap select {
  min-height: 2.5rem;
  padding: .42rem .6rem;
  border: 1px solid var(--rule-firm);
  border-radius: 5px;
  background: var(--well);
  box-shadow: 0 1px 3px var(--shadow) inset, 0 1px 0 var(--shine);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.input-wrap input[type="number"] { width: 4.8rem; text-align: right; }
.input-wrap input[type="text"] { width: 12rem; }
.input-wrap select { min-width: 8rem; padding-right: 1.8rem; }

.input-wrap input[type="range"] {
  width: 9rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.input-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid var(--rule-firm);
  border-radius: 999px;
  background: var(--well-deep);
  box-shadow: 0 1px 2px var(--shadow) inset, 0 1px 0 var(--shine);
}
.input-wrap input[type="range"]::-moz-range-track {
  height: 4px;
  border: 1px solid var(--rule-firm);
  border-radius: 999px;
  background: var(--well-deep);
  box-shadow: 0 1px 2px var(--shadow) inset, 0 1px 0 var(--shine);
}
.input-wrap input[type="range"]::-moz-range-progress {
  height: 4px;
  border: 1px solid var(--secondary-low);
  border-radius: 999px 0 0 999px;
  background: var(--secondary);
}
.input-wrap input[type="range"]::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -6px;
  appearance: none;
  border: 1px solid var(--rule-firm);
  border-radius: 50%;
  background: linear-gradient(var(--case-high), var(--case-low));
  box-shadow: 0 1px 0 var(--shine) inset, 0 2px 3px var(--shadow);
}
.input-wrap input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 1px solid var(--rule-firm);
  border-radius: 50%;
  background: linear-gradient(var(--case-high), var(--case-low));
  box-shadow: 0 1px 0 var(--shine) inset, 0 2px 3px var(--shadow);
}

.unit { min-width: 4.2rem; color: var(--ink-faint); font-size: .7rem; letter-spacing: .05em; }
.check {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-height: 2.75rem;
  padding: .38rem 0;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.45;
}
.check input[type="checkbox"] {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin: .18rem 0 0;
  appearance: none;
  border: 1px solid var(--rule-firm);
  border-radius: 4px;
  background: var(--well);
  box-shadow: 0 1px 2px var(--shadow) inset, 0 1px 0 var(--shine);
  cursor: pointer;
}
.check input[type="checkbox"]:checked {
  border-color: var(--secondary-low);
  background-color: var(--secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.2 8.2 3 3.1 6.7-7' fill='none' stroke='%23fffaf3' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 2px var(--shadow);
}
[data-theme="night"] .check input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.2 8.2 3 3.1 6.7-7' fill='none' stroke='%23172632' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check:hover { color: var(--ink); }

.note { max-width: 38rem; margin: .5rem 0 .2rem; color: var(--ink-faint); font-size: .84rem; line-height: 1.5; }
.note.warn { color: var(--warning); }
.row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .9rem; }
.reset-zone { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px dotted var(--rule); }
.reset-zone .note { margin: 0 0 .55rem; }

.settings-foot {
  grid-area: actions;
  position: sticky;
  bottom: .5rem;
  z-index: 2;
  margin-top: .35rem;
  padding: .65rem .75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .7rem;
  border: 1px solid var(--rule-firm);
  border-radius: 9px;
  background: linear-gradient(145deg, var(--case-high), var(--case));
  box-shadow: 0 5px 14px var(--shadow);
}
.dirty-flag { margin-right: auto; color: var(--status); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- colophon ---------- */
.colophon {
  margin-top: 1.5rem;
  padding: .8rem .25rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  box-shadow: 0 1px 0 var(--shine) inset;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: .69rem;
  letter-spacing: .035em;
}
.colophon kbd {
  padding: .05em .35em;
  border: 1px solid var(--rule-firm);
  border-radius: 3px;
  background: var(--case-high);
  box-shadow: 0 2px 0 var(--rule-firm);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: .9em;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 20;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: .65rem 1rem;
  transform: translateX(-50%);
  border: 1px solid var(--rule-firm);
  border-radius: 7px;
  background: var(--ink);
  box-shadow: 0 8px 24px var(--shadow-deep);
  color: var(--case-high);
  font-family: var(--sans);
  font-size: .78rem;
}

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  body { padding: 0; background: var(--case); }
  .shell {
    min-height: 100dvh;
    padding-top: calc(1.15rem + env(safe-area-inset-top));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .stage { min-height: 25rem; }
  .clock { min-height: 8.25rem; font-size: clamp(4rem, 21vw, 6.3rem); }
  .colophon .keys { display: none; }
}

@media (max-width: 760px) {
  #settingsForm {
    display: block;
  }
  #settingsForm .group { margin-bottom: 1rem; }
  #settingsForm .settings-foot { margin-top: .5rem; }
  .btn-sm { min-height: 2.75rem; }
}

@media (max-width: 430px) {
  .stage { padding-inline: .8rem; }
  .controls { gap: .55rem; }
  .btn { padding-inline: .9rem; }
  .btn-primary { min-width: 7.5rem; }
  .settings-foot { flex-wrap: wrap; }
  .settings-head h2 { font-size: 1.8rem; }
  .group { padding-inline: 1rem; }
  .field { gap: .75rem; }
  .input-wrap input[type="text"] { width: min(11rem, 45vw); }
  .input-wrap input[type="range"] { width: min(8rem, 34vw); }
}

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