/* Mission Alarm styles. Self-contained (system fonts, no external requests). Light and dark via prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f4efe6;
  --ink: #16223b;
  --ink-2: #3b4661;
  --muted: #5b6475;
  --line: #e5ddcf;
  --btn: #16223b;
  --btn-ink: #ffffff;
  --focus: #16223b;
  --accent: #e8542f;
  --amber: #f2a93b;
  --deep: #a8361a;
  --tint: #fff1ea;
  --ok: #1f7a4f;
  --bad: #b3261e;
  --ring-a: #b8321a;
  --ring-b: #962714;
  --shadow: 0 1px 2px rgba(22, 34, 59, 0.06), 0 10px 28px rgba(22, 34, 59, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1522;
    --surface: #172033;
    --surface-2: #1d2841;
    --ink: #eef1f7;
    --ink-2: #c9d0dd;
    --muted: #9aa4b6;
    --line: #2b3752;
    --btn: #eef1f7;
    --btn-ink: #0f1522;
    --focus: #f3d38a;
    --deep: #ffab8a;
    --tint: #2a1f26;
    --ok: #5fd39a;
    --bad: #ff8f84;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--font); overflow-x: hidden; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
a:hover { color: var(--deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--btn); color: var(--btn-ink); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 10px; }
.muted { color: var(--muted); }
.fine { margin: 6px 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--muted); }
.fine:empty { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: 650 1rem/1.15 var(--font); cursor: pointer; text-decoration: none; text-align: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 44px; padding: 7px 13px; font-size: 0.92rem; border-radius: 11px; }
.btn-big { min-height: 56px; font-size: 1.08rem; border-radius: 16px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1160px; margin: 0 auto; padding: 10px 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 650; font-size: 0.98rem; min-height: 44px; }
.brand svg { width: 24px; height: 24px; color: var(--accent); }
.brand b { font-weight: 650; color: var(--muted); }
@media (max-width: 400px) { #shareTop { padding: 7px 11px; } .share-long { display: none; } }

/* Intro */
.app { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.intro { padding: 2px 0 14px; }
h1 { margin: 0; font-weight: 800; }
.h1-big { display: block; font: 800 clamp(2.3rem, 10vw, 4rem)/0.98 var(--display); letter-spacing: -0.02em; }
.h1-sub { display: block; margin-top: 6px; font: 650 clamp(1.05rem, 4vw, 1.35rem)/1.3 var(--font); color: var(--ink-2); }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 62ch; font-size: 0.95rem; line-height: 1.5; }
.lede b { color: var(--ink); font-weight: 650; }

/* Banners (challenge link, missed alarm) */
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--accent); box-shadow: var(--shadow); }
.banner p { margin: 0; }
.banner-warn { border-color: var(--amber); }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Layout: phones stack setup, mission, "when it rings"; wide screens put the mission panel on the right. */
.play { display: grid; gap: 18px; align-items: start; grid-template-areas: "setup" "panel" "info"; }
.setup, .armed { grid-area: setup; }
.panel { grid-area: panel; }
.info { grid-area: info; }
@media (min-width: 900px) { .play { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); grid-template-areas: "setup panel" "info panel"; grid-template-rows: auto 1fr; gap: 24px; } }
.card { position: relative; padding: 18px; border-radius: 26px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
@media (min-width: 900px) { .card { padding: 26px; } }
.card-title, .panel-title { margin: 0; font: 750 0.78rem/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Setup card */
.setup { background: linear-gradient(180deg, var(--tint) 0%, var(--surface) 62%); }
.setup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.now { margin: 0; font: 650 0.95rem/1.2 var(--font); font-variant-numeric: tabular-nums; }
.seg { display: grid; gap: 6px; margin: 0; padding: 4px; border: 0; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.seg-2 { grid-template-columns: 1fr 1fr; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input, .mtile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 6px; border-radius: 10px; font-weight: 650; font-size: 0.95rem; color: var(--ink-2); text-align: center; line-height: 1.2; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(22, 34, 59, 0.18); }
@media (prefers-color-scheme: dark) { .seg input:checked + span { background: #3a4868; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); } }
.seg input:focus-visible + span, .mtile input:focus-visible + .mtile-in { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg input:disabled + span { cursor: not-allowed; }
.mode { margin-bottom: 14px; }
.when-row { margin: 0; }
.time-in {
  display: block; width: 100%; min-height: 84px; padding: 4px 14px; border-radius: 18px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: 800 clamp(2.6rem, 13vw, 3.8rem)/1 var(--display); font-variant-numeric: tabular-nums;
  text-align: center; letter-spacing: -0.01em; -webkit-appearance: none; appearance: none;
}
.time-in::-webkit-date-and-time-value { text-align: center; }
.time-in::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; width: 26px; height: 26px; }
.time-in:focus-visible, .text-in:focus-visible, .answer:focus-visible, .tbox input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.timer-in { display: flex; align-items: center; justify-content: center; gap: 6px; }
.tbox { position: relative; flex: 1 1 0; max-width: 170px; }
.tbox input {
  width: 100%; min-height: 84px; padding: 4px 8px 18px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 800 clamp(2.4rem, 12vw, 3.4rem)/1 var(--display); font-variant-numeric: tabular-nums; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.tbox input::-webkit-inner-spin-button, .tbox input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tbox span { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font: 700 0.72rem/1 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.colon { font: 800 2.4rem/1 var(--display); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.chip { min-height: 44px; min-width: 44px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font: 650 0.9rem/1 var(--font); cursor: pointer; touch-action: manipulation; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--ink); }
.when { margin: 10px 0 4px; text-align: center; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.summary { margin: 0 0 14px; text-align: center; font-size: 0.92rem; line-height: 1.5; }
.change { display: inline-block; padding: 11px 6px; margin: -11px 0; font-weight: 650; }
.go { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.go .btn { padding-left: 12px; padding-right: 12px; }
@media (max-width: 359px) { .go { grid-template-columns: 1fr; } }

/* Armed card */
.armed { text-align: center; background: linear-gradient(180deg, var(--tint) 0%, var(--surface) 70%); }
.kicker { margin: 0; font: 750 0.78rem/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--deep); }
.count { margin: 6px 0 2px; font: 800 clamp(3.4rem, 17vw, 5.4rem)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.armed-line { margin: 0 0 6px; font-weight: 650; color: var(--ink-2); }
.mock { margin: 8px auto 4px; max-width: 40ch; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 650; color: var(--deep); }
.checks { list-style: none; margin: 14px 0 16px; padding: 0; display: grid; gap: 8px; text-align: left; }
.checks li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--line); box-shadow: inset 0 0 0 1.5px var(--muted); }
.dot.on { background: #2f9e6b; box-shadow: none; }
.dot.off { background: #d0643a; box-shadow: none; }
.armed .go { grid-template-columns: 1fr 1fr; }
.armed .go .btn { white-space: nowrap; }
/* Phones: no moon icon, so "Bedside clock" stays on one line next to "Cancel alarm". */
@media (max-width: 420px) { .armed .go .btn svg { display: none; } .armed .go .btn { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 339px) { .armed .go { grid-template-columns: 1fr; } }

/* When it rings */
.info { box-shadow: none; }
.ramp { height: 46px; margin: 14px 0 0; border-radius: 6px 6px 0 0; background: linear-gradient(90deg, #ffd27a 0%, var(--accent) 34%, var(--ring-b) 100%); clip-path: polygon(0 88%, 34% 0, 100% 0, 100% 100%, 0 100%); }
.steps { list-style: none; margin: 0; padding: 8px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-top: 2px solid var(--line); }
.steps li { font-size: 0.82rem; line-height: 1.3; color: var(--muted); }
.steps b { display: block; font: 800 1rem/1.2 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.info .fine { margin-top: 12px; }

/* Mission settings panel */
.panel { padding: 18px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); min-width: 0; }
.panel-title { margin-bottom: 12px; }
.bare { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 16px; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > legend, .field-label { display: block; padding: 0; margin: 0 0 6px; font-weight: 650; font-size: 0.95rem; }
.missions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mtile { position: relative; display: block; cursor: pointer; min-width: 0; }
.mtile-in {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; height: 100%;
  min-height: 96px; padding: 12px 6px 10px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg); text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.mtile-in svg { width: 28px; height: 28px; margin-bottom: 4px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mtile-in svg .lit { fill: var(--amber); stroke: var(--ink-2); }
.mname { font-weight: 700; line-height: 1.2; font-size: 0.95rem; }
.msub { font-size: 0.76rem; line-height: 1.25; color: var(--muted); }
.mtile:hover .mtile-in { border-color: var(--accent); }
.mtile input:checked + .mtile-in { border-color: var(--accent); background: var(--tint); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mtile input:checked + .mtile-in svg { stroke: var(--ink); }
.text-in { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 400 1rem/1.3 var(--font); }
.preview { margin-top: 8px; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; }
.check input { width: 26px; height: 26px; margin: 9px 0 0; accent-color: var(--deep); cursor: pointer; }
.check .field-label { margin: 0; padding: 0; min-height: 44px; display: flex; align-items: center; cursor: pointer; line-height: 1.3; }
.check .fine { margin-top: 0; }
.locked { margin-top: 12px; color: var(--deep); font-weight: 650; }
body[data-phase="armed"] .panel .bare { opacity: 0.6; }

/* Text sections */
.learn { max-width: 760px; margin: 44px auto 0; }
.learn section { margin-bottom: 34px; }
.learn h2 { font: 800 clamp(1.4rem, 4.5vw, 1.75rem)/1.2 var(--display); margin: 0 0 12px; }
.learn h3 { font-size: 1.05rem; line-height: 1.35; margin: 22px 0 6px; }
.learn p { margin: 0 0 10px; color: var(--ink-2); }
.learn ol, .learn ul { margin: 0 0 12px; padding-left: 1.3em; color: var(--ink-2); }
.learn li { margin-bottom: 10px; padding-left: 4px; }
.learn b { color: var(--ink); }

.more-toys { max-width: 1160px; margin: 8px auto 0; padding: 28px 16px 0; }
.more-toys h2 { font: 800 1.3rem/1.2 var(--display); margin: 0 0 12px; }
.more-toys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.more-toys a { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 14px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--ink); }
.more-toys a:hover { border-color: var(--accent); color: var(--ink); }
.more-toys img { grid-row: 1 / 3; display: block; width: 112px; height: 63px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.more-toys b { align-self: end; font-weight: 750; }
.more-toys span { align-self: start; font-size: 0.88rem; line-height: 1.35; color: var(--muted); }

.foot { max-width: 1160px; margin: 20px auto 0; padding: 24px 16px 40px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; color: var(--muted); font-size: 0.92rem; }
.foot p { margin: 0; }
.foot a { color: var(--ink-2); display: inline-block; padding: 12px 0; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--btn); color: var(--btn-ink); padding: 10px 16px; border-radius: 12px; font-weight: 650; font-size: 0.95rem;
  transition: opacity 0.2s, transform 0.2s; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- Ringing overlay */
body.is-overlay { overflow: hidden; }
.ring {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--ring-a); color: #fff;
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
@media (prefers-reduced-motion: no-preference) {
  .ring:not(.is-done) { animation: ringbg 1.2s ease-in-out infinite alternate; }
  .ring:not(.is-done) .bell { animation: shake 0.5s linear infinite; }
}
@keyframes ringbg { to { background-color: var(--ring-b); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.ring.is-done { background: #1f6b47; }
.ring.is-done .ring-top, .ring.is-done .vol-row, .ring.is-done .ring-note { display: none; }
.ring.is-done .ring-in { justify-content: center; }
.ring-in { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.ring-top { display: flex; align-items: center; gap: 14px; }
.bell { width: 64px; height: 64px; flex: none; transform-origin: 50% 60%; }
.bell-b { fill: var(--amber); }
.bell-l { stroke: #fff; stroke-width: 8; stroke-linecap: round; }
.bell-body { fill: #fff; }
.bell-face { fill: var(--ring-a); }
.bell-h { stroke: #fff; stroke-width: 7; stroke-linecap: round; fill: none; }
.ring-kicker { margin: 0; font: 750 0.8rem/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: #ffe2d6; font-variant-numeric: tabular-nums; }
.ring-title { margin: 2px 0 0; font: 800 clamp(1.45rem, 6vw, 2rem)/1.15 var(--display); }
.ring-title:focus { outline: none; }
.vol-row em { display: block; margin: 0 0 6px; font: 700 0.82rem/1.2 var(--font); font-style: normal; color: #ffe2d6; font-variant-numeric: tabular-nums; }
.vol { position: relative; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.28); overflow: hidden; }
.vol span { position: absolute; inset: 0; background: #ffd27a; transform-origin: 0 50%; transform: scaleX(0.12); transition: transform 0.3s linear; }
.ring-note { margin: 0; padding: 10px 12px; border-radius: 14px; background: #fff; color: #16223b; font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ring-note .btn { background: #16223b; color: #fff; border-color: #16223b; }

.mission { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.m-step { margin: 0 0 6px; font: 750 0.78rem/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--deep); }
.m-panel { margin: 0; }
.m-q { margin: 4px 0 12px; white-space: nowrap; font: 800 clamp(1.6rem, 9vw, 3.2rem)/1.1 var(--display); font-variant-numeric: tabular-nums; text-align: center; letter-spacing: -0.01em; }
.m-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.answer { width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: 700 1.35rem/1.2 var(--font); font-variant-numeric: tabular-nums; }
#typeA { font-size: 1.1rem; font-weight: 500; }
.answer.is-bad { border-color: var(--bad); }
.m-phrase { margin: 4px 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font: 600 1.2rem/1.5 var(--font); overflow-wrap: anywhere; -webkit-user-select: none; user-select: none; }
.m-phrase .ok { color: var(--ok); }
.m-phrase .nx { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.m-phrase .er { background: var(--bad); color: #fff; border-radius: 3px; }
.m-mem-status { margin: 2px 0 10px; text-align: center; font: 750 1.1rem/1.3 var(--font); }
.m-mem-status:focus { outline: none; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.tile {
  aspect-ratio: 1; min-height: 64px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: 750 1rem/1 var(--font); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, transform 0.12s, border-color 0.12s;
}
.tile:disabled { cursor: default; opacity: 1; }
.tile.lit { background: var(--amber); border-color: #b56f00; color: #2b1407; }
.tile.hit { background: var(--accent); border-color: var(--deep); color: #fff; }
.tile.miss { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .tile.lit, .tile.hit { transform: scale(1.06); } }
.tiles.is-watching .tile { cursor: default; }
.m-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.m-digits { margin: 4px 0 12px; font: 800 clamp(2.2rem, 11vw, 3rem)/1.1 var(--display); letter-spacing: 0.18em; text-align: center; font-variant-numeric: tabular-nums; }
#digitsReady { width: 100%; margin-bottom: 10px; }
.m-fb { margin: 10px 0 0; min-height: 1.5em; font-weight: 700; text-align: center; }
.m-fb.is-bad { color: var(--bad); }
.m-fb.is-ok { color: var(--ok); }
@media (prefers-reduced-motion: no-preference) { .mission.is-shake { animation: nudge 0.35s ease; } }
@keyframes nudge { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } }

.ring-foot { margin-top: auto; padding-top: 4px; }
/* Big screens: the alarm sits in the middle, snooze right under the mission. */
@media (min-width: 700px) and (min-height: 640px) { .ring-in { justify-content: center; } .ring-foot { margin-top: 0; } }
.snooze { width: 100%; min-height: 56px; background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, 0.75); font-size: 1.05rem; }
.snooze:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }
.snooze:disabled { opacity: 1; border-style: dashed; border-color: rgba(255, 255, 255, 0.55); color: #ffe2d6; }
.giveup { width: 100%; min-height: 44px; margin-top: 8px; background: transparent; color: #ffe2d6; border: 0; text-decoration: underline; text-underline-offset: 3px; font-size: 0.95rem; }
.giveup:hover { color: #fff; border: 0; }
.ring :focus-visible { outline-color: #fff; }
.ring .mission :focus-visible { outline-color: var(--focus); }

.done { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 24px 18px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.done-mark { width: 56px; height: 56px; }
.done-mark circle { fill: #2f9e6b; }
.done-mark path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.done-title { margin: 8px 0 4px; font: 800 1.6rem/1.2 var(--display); }
.done-title:focus { outline: none; }
.done-time { margin: 6px 0; font: 800 clamp(3rem, 14vw, 4.2rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.done-unit { display: block; margin-top: 4px; font: 650 1rem/1.3 var(--font); color: var(--muted); }
.done-line { margin: 8px 0 2px; color: var(--ink-2); }
.done-best { margin: 0 0 14px; font-weight: 700; color: var(--deep); min-height: 1.2em; }
.done-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------------- Bedside clock */
.bedside { position: fixed; inset: 0; z-index: 80; background: #000; color: #8d94a1; display: flex; align-items: center; justify-content: center; text-align: center; }
.bed-hit { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; cursor: pointer; }
.bed-hit:focus-visible { outline: 2px solid #4b5160; outline-offset: -8px; }
.bed-in { position: relative; pointer-events: none; padding: 16px; }
.bed-clock { margin: 0; font: 700 clamp(4.5rem, 24vw, 12rem)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: #8d94a1; }
.bed-line { margin: 10px 0 0; font: 600 1rem/1.4 var(--font); color: #7d8594; }
.bed-tip { margin: 26px 0 0; font-size: 0.88rem; color: #7d8594; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.sound-fix { margin-top: 6px; }
