@font-face {
  font-family: "Barlow Timer";
  src: url("./assets/BarlowCondensed-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Jersey Timer";
  src: url("./assets/Jersey10-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Lilita Timer";
  src: url("./assets/LilitaOne-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Baloo Timer";
  src: url("./assets/Baloo2-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "Crayon Chinese";
  src: url("./assets/ZCOOLKuaiLe-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #eef1e8;
  --surface: #e5eadd;
  --surface-raised: #f8faf3;
  --ink: #27382f;
  --muted: #56654f;
  --line: #d1dac9;
  --strong-line: #acbba5;
  --accent: #be4e31;
  --accent-ink: #a03d24;
  --on-accent: #fffcf3;
  --accent-wash: #f1e3d2;
  --focus: #9c4329;
  --digit: #27382f;
  --button-radius: 6px;
  --timer-font: "Barlow Timer", sans-serif;
  --ui-font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --stage-height: 450px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--strong-line) var(--page);
  background: var(--page);
}

body {
  position: relative;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font: 14px/1.6 var(--ui-font);
  -webkit-font-smoothing: antialiased;
  transition: color .25s var(--ease), background-color .3s var(--ease);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
}

button, input, summary { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input, summary { touch-action: manipulation; }
button { border: 0; }
a { color: inherit; text-decoration: none; text-underline-offset: .2em; }
button, input, a, summary { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
input { caret-color: var(--accent); }
::selection { color: var(--on-accent); background: var(--accent); }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--page); }
::-webkit-scrollbar-thumb { background: var(--strong-line); border: 2px solid var(--page); border-radius: 8px; }

svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { position: relative; z-index: 1; width: min(1240px, calc(100% - 96px)); margin-inline: auto; }

/* Each cast has its own small stage, always outside the timer and controls. */
.theme-scenery { position: fixed; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; user-select: none; }
.scenery-cast { position: absolute; inset: 0; display: none; }
html[data-theme="shinchan"] .scenery-cast[data-scenery-theme="shinchan"],
html[data-theme="doraemon"] .scenery-cast[data-scenery-theme="doraemon"],
html[data-theme="stardew"] .scenery-cast[data-scenery-theme="stardew"] { display: block; }
html:is([data-theme="minimal"], [data-theme="arcade"]) .theme-scenery { display: none; }
html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .app-shell { background: var(--page); }
.scenery-friend { position: absolute; display: flex; align-items: flex-end; justify-content: center; width: 88px; height: 110px; opacity: .9; filter: saturate(.9); animation-duration: 28s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate; }
.scenery-friend img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
html[data-theme="shinchan"] .scenery-friend { animation-name: notebook-step; }
html[data-theme="shinchan"] .friend-one { top: 182px; left: max(8px, calc((100vw - 1240px) / 2 - 124px)); width: clamp(76px, calc((100vw - 1240px) / 2 - 28px), 96px); height: 110px; animation-duration: 27s; }
html[data-theme="shinchan"] .friend-two { top: 274px; left: max(16px, calc((100vw - 1240px) / 2 - 104px)); width: clamp(70px, calc((100vw - 1240px) / 2 - 38px), 86px); height: 103px; animation-duration: 31s; animation-delay: -10s; }
html[data-theme="doraemon"] .friend-one { top: 84px; left: max(8px, calc((100vw - 1240px) / 2 - 124px)); width: clamp(76px, calc((100vw - 1240px) / 2 - 28px), 100px); height: 112px; animation-name: pocket-drift; animation-duration: 32s; }
html[data-theme="doraemon"] .friend-two { top: 132px; right: max(12px, calc((100vw - 1240px) / 2 - 120px)); width: clamp(70px, calc((100vw - 1240px) / 2 - 34px), 94px); height: 100px; animation-name: pocket-orbit; animation-duration: 39s; animation-delay: -13s; }
html[data-theme="stardew"] .scenery-friend img { image-rendering: pixelated; }
html[data-theme="stardew"] .friend-one { bottom: 29px; left: max(14px, calc((100vw - 1240px) / 2 - 109px)); width: 66px; height: 72px; animation-name: junimo-hop; animation-duration: 29s; }
html[data-theme="stardew"] .friend-two { bottom: 23px; right: max(8px, calc((100vw - 1240px) / 2 - 124px)); width: clamp(80px, calc((100vw - 1240px) / 2 - 22px), 104px); height: 114px; animation-name: farmer-stroll; animation-duration: 36s; animation-delay: -16s; }
body:is([data-state="running"], [data-state="arming"], [data-page-hidden="true"]) .scenery-friend { animation-play-state: paused; }
.theme-scenery[data-offscreen="true"] .scenery-friend { animation-play-state: paused; }
.page-end { display: flex; align-items: center; justify-content: center; gap: 17px; min-height: 75px; padding-block: 22px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.page-end::before, .page-end::after { flex: 1; height: 1px; background: var(--line); content: ""; }
.page-end span { flex: 0 0 auto; white-space: nowrap; letter-spacing: .04em; }

.site-header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; stroke-width: 1.5; color: var(--accent); }
.brand-name { font-size: 24px; font-weight: 800; letter-spacing: -.04em; line-height: 1; white-space: nowrap; }
.brand-en { padding-left: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; }

.theme-switch {
  display: flex;
  align-items: center;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 33px;
  padding: 5px 13px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .15s, background-color .15s, border-color .15s;
}

.theme-option:hover { color: var(--ink); background: var(--surface-raised); }
.theme-option.is-active { color: var(--ink); border-color: var(--line); background: var(--surface-raised); box-shadow: 0 2px 4px #242c2b08; }
.theme-swatch { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #242c2b24; }
.swatch-minimal { background: #bccbab; }
.swatch-arcade { background: #e8c963; border-color: #bd9f47; border-radius: 1px; }
.swatch-shinchan { background: #e88d69; border-color: #bf6247; }
.swatch-doraemon { background: #6bb9dc; border-color: #3e8daf; }
.swatch-stardew { background: #86a468; border-color: #68834c; border-radius: 1px; }
.header-tools { display: flex; gap: 15px; flex-shrink: 0; }
.icon-button { display: inline-flex; min-height: 38px; padding: 7px 0; align-items: center; gap: 6px; background: transparent; color: var(--muted); font-size: 11px; }
.icon-button svg { width: 17px; height: 17px; }
.icon-button:hover { color: var(--accent-ink); }

.challenge-heading {
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

h1 { margin: 0; font-size: 31px; line-height: 1.35; font-weight: 750; letter-spacing: -.04em; text-wrap: balance; }
h1 span { color: var(--muted); }
.challenge-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.challenge-tag { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.tiny-cross { display: block; color: var(--accent); font-size: 22px; font-weight: 300; line-height: 1; }

.timer-stage {
  position: relative;
  height: var(--stage-height);
  border-block: 1px solid var(--line);
  isolation: isolate;
  transition: border-color .2s, background-color .2s;
}

.theme-art {
  position: absolute;
  z-index: 0;
  right: 24px;
  bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: 230px;
  height: 130px;
  opacity: .9;
  pointer-events: none;
  user-select: none;
}
.theme-art img { display: block; width: auto; max-width: 100%; height: auto; max-height: 100%; object-fit: contain; }
html[data-theme="minimal"] .theme-art,
html[data-theme="arcade"] .theme-art { display: none; }

.stage-topline {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
}

.round-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.status-dot { width: 6px; height: 6px; flex-shrink: 0; background: var(--muted); border-radius: 50%; }
.target-caption { color: var(--muted); white-space: nowrap; }
.target-caption strong { margin-inline: 5px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.relay-caption { position: absolute; top: 44px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 11px; line-height: 22px; }
#turn-count { padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: var(--surface); font-weight: 600; font-variant-numeric: tabular-nums; }

.timer-readout {
  position: absolute;
  inset: 52px 0 auto;
  height: 244px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--digit);
  font-family: var(--timer-font);
  font-size: clamp(224px, 24vw, 320px);
  font-weight: 600;
  line-height: .86;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  white-space: nowrap;
  user-select: none;
  text-rendering: geometricPrecision;
  transition: color .2s var(--ease);
}

#time-whole, #time-fraction { display: inline-block; width: 2ch; text-align: center; }
.time-dot { display: inline-block; width: .25em; flex-shrink: 0; text-align: center; }
.timer-readout.is-long { font-size: clamp(190px, 21vw, 286px); }
.timer-readout.is-long #time-whole { width: 3ch; }

.timer-underlay {
  position: absolute;
  top: 307px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 19px;
  color: var(--muted);
  line-height: 1.4;
}

.unit-label { font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.progress-track { position: absolute; top: 335px; left: 0; right: 0; height: 2px; overflow: hidden; background: var(--line); }
.progress-fill { height: 100%; width: 100%; transform: scaleX(1); transform-origin: left center; background: var(--accent); }

.play-prompt {
  position: absolute;
  top: 352px;
  left: 0;
  right: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

kbd { font: inherit; }
.play-prompt kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--strong-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
}

.play-actions { position: absolute; top: 390px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; }
.primary-button {
  display: inline-flex;
  min-width: 184px;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 31px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 9px #8f311413;
  transition: background-color .15s, box-shadow .15s, transform .15s var(--ease);
}

.primary-button svg { width: 18px; height: 18px; }
.primary-button:hover { background: #d94a29; transform: translateY(-1px); box-shadow: 0 5px 13px #8f311423; }
.primary-button:active { transform: translateY(1px); box-shadow: 0 1px 3px #8f311413; }
.primary-button:disabled { transform: none; box-shadow: none; }
.reset-button { display: inline-flex; align-items: center; justify-content: center; min-width: 104px; min-height: 44px; gap: 8px; padding: 9px 17px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 12px; box-shadow: none; }
.reset-button svg { width: 16px; height: 16px; }
.reset-button:hover { color: var(--ink); background: var(--surface-raised); box-shadow: 0 3px 9px #26382b0a; }

.timer-stage[data-status="running"] .status-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.timer-stage[data-status="running"] .round-status { color: var(--accent-ink); }
.timer-stage[data-status="running"] .primary-button:not(.secondary-button) { background: var(--ink); color: var(--page); }
.timer-stage[data-status="running"] .primary-button:not(.secondary-button):hover { background: var(--muted); }
.timer-stage[data-status="paused"] .status-dot { background: var(--accent); }
.timer-stage[data-status="paused"] .round-status { color: var(--accent-ink); }
.timer-stage[data-status="stopped"] .status-dot { background: var(--accent); }
.timer-stage[data-status="expired"] .timer-readout { color: var(--muted); }
.timer-stage[data-status="expired"] .status-dot { background: var(--accent); }
.timer-stage.is-wrong { animation: key-mismatch .28s var(--ease); }
.timer-stage.is-wrong .play-prompt kbd { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }
.timer-stage.is-silent-zero .timer-readout { color: var(--digit); }

.settings-strip {
  display: grid;
  grid-template-columns: minmax(255px, .9fr) minmax(280px, 1fr) minmax(290px, 1.1fr);
  align-items: center;
  gap: 28px;
  min-height: 107px;
  padding-block: 21px;
  border-bottom: 1px solid var(--line);
  transition: opacity .2s;
}

.duration-setting, .mode-setting { display: flex; align-items: center; gap: 15px; }
.duration-setting { position: relative; }
.duration-setting label, .setting-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.duration-field { display: flex; align-items: center; width: 159px; height: 39px; padding-left: 12px; border: 1px solid var(--strong-line); border-radius: var(--button-radius); background: var(--surface-raised); transition: border-color .15s, box-shadow .15s; }
.duration-field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-wash); }
.duration-field input { width: 76px; min-width: 0; border: 0; padding: 2px 0; outline: none; background: transparent; color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.duration-field input::placeholder { color: var(--muted); font-size: 13px; }
.duration-field input:focus-visible { outline: none; }
.duration-field > span { color: var(--muted); font-size: 11px; }
.confirm-button { align-self: stretch; margin-left: auto; width: 36px; display: grid; place-items: center; background: transparent; color: var(--accent-ink); border-left: 1px solid var(--line); border-radius: 0 var(--button-radius) var(--button-radius) 0; }
.confirm-button svg { width: 17px; height: 17px; }
.confirm-button:hover { color: var(--on-accent); background: var(--accent); }
.duration-field:has(.is-invalid) { border-color: var(--accent); }
.is-invalid { color: var(--accent-ink) !important; }
.field-error { position: absolute; left: 59px; top: calc(100% + 4px); color: var(--accent-ink); font-size: 11px; line-height: 1.3; white-space: nowrap; }
.field-error:empty { display: none; }
.mode-switch { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--surface); }
.mode-option { display: inline-flex; min-height: 31px; padding: 4px 12px; align-items: center; gap: 5px; border-radius: 3px; color: var(--muted); background: transparent; font-size: 11px; white-space: nowrap; }
.mode-option:hover { color: var(--ink); }
.mode-option.is-active { color: var(--ink); background: var(--surface-raised); box-shadow: 0 1px 4px #242c2b10; font-weight: 600; }
.same-key-badge { padding: 0 4px; border-radius: 2px; color: var(--accent-ink); background: var(--accent-wash); font-size: 11px; line-height: 17px; font-weight: 500; }
.rules-note { display: flex; align-items: center; gap: 10px; padding-left: 25px; border-left: 1px solid var(--line); }
.rules-note svg { width: 17px; height: 17px; color: var(--muted); }
.rules-note p { margin: 0; font-size: 12px; line-height: 1.7; }
.rules-note p span { color: var(--muted); font-size: 12px; }
body[data-state="running"] .settings-strip { border-bottom-color: var(--strong-line); }

.history-section { padding-top: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h2 { display: flex; align-items: baseline; gap: 15px; margin: 0; font-size: 12px; font-weight: 600; }
h2 > span { font-size: 11px; font-weight: 400; color: var(--muted); }
.text-button { min-height: 28px; padding: 3px 0; background: transparent; color: var(--muted); font-size: 11px; }
.text-button:hover { color: var(--accent-ink); }
.text-button:disabled { color: var(--muted); }
.history-empty { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 65px; }
.history-empty p { margin: 0; font-size: 11px; color: var(--muted); }
.empty-line { width: 50px; height: 1px; background: var(--line); }
.history-list { display: grid; grid-template-columns: 1fr; gap: 9px; list-style: none; margin: 11px 0 24px; padding: 0; }
.history-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 104px; padding: 11px 14px 10px; border: 1px solid var(--line); border-radius: 4px; background: transparent; }
.history-attempt { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; color: var(--muted); font-size: 11px; }
.attempt-index { font-size: 11px; font-variant-numeric: tabular-nums; }
.attempt-target { font-variant-numeric: tabular-nums; }
.history-value { display: block; margin-top: 3px; color: var(--ink); font-family: "Barlow Timer", sans-serif; font-size: 31px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; }
.history-caption { color: var(--muted); font-size: 11px; line-height: 1.6; }
.history-item.is-best { border-color: var(--accent); background: var(--accent-wash); }
.history-item.is-best .history-value, .history-item.is-best .history-caption { color: var(--accent-ink); }
.history-item.is-expired .history-value { color: var(--muted); }

.how-to { border-block: 1px solid var(--line); font-size: 11px; }
.how-to summary { display: flex; align-items: center; justify-content: space-between; min-height: 42px; list-style: none; cursor: pointer; color: var(--muted); }
.how-to summary::-webkit-details-marker { display: none; }
.how-to summary:hover { color: var(--ink); }
.details-plus { font-size: 19px; font-weight: 300; transition: transform .2s; }
.how-to[open] .details-plus { transform: rotate(45deg); }
.how-to-content { display: grid; grid-template-columns: 1fr 1fr; column-gap: 54px; row-gap: 15px; max-width: 1060px; padding: 8px 0 25px; }
.how-to-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.how-to-content strong { color: var(--ink); font-weight: 600; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 10; width: max-content; max-width: calc(100% - 32px); padding: 11px 18px; border: 1px solid var(--strong-line); border-radius: var(--button-radius); background: var(--ink); color: var(--page); font-size: 12px; box-shadow: 0 7px 25px #14191428; transform: translateX(-50%); text-align: center; animation: toast-in .25s var(--ease); }

.current-turns { padding-block: 21px 17px; border-bottom: 1px solid var(--line); }
.current-turn-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 10px 0 0; padding: 0; }
.turn-item { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-raised); }
.current-turn-list .turn-item { min-width: 0; }
.current-turn-list .turn-item:last-child { border-color: var(--accent); background: var(--accent-wash); }
.turn-index { color: var(--muted); font-size: 11px; line-height: 1.5; }
.turn-remaining { color: var(--ink); font: 600 30px/1.2 "Barlow Timer", sans-serif; font-variant-numeric: tabular-nums; }
.turn-consumed { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.game-history-item { min-width: 0; }
.game-history-details { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised); }
.game-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 10px; gap: 24px; align-items: center; min-height: 58px; padding: 11px 17px; list-style: none; cursor: pointer; }
.game-summary::-webkit-details-marker { display: none; }
.game-summary::after { width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .2s; content: ""; }
.game-summary:hover { background: var(--surface); }
.game-summary:focus-visible { outline-offset: -4px; }
.game-history-details[open] .game-summary::after { transform: rotate(225deg); }
.game-history-details[open] .game-summary { border-bottom: 1px solid var(--line); }
.game-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.game-target { color: var(--ink); font: 600 24px/1.2 "Barlow Timer", sans-serif; font-variant-numeric: tabular-nums; }
.game-turn-total { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-turn-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0; padding: 13px; }
.game-turn-list .turn-item { padding: 9px 12px; background: var(--page); }
.game-turn-list .turn-remaining { font-size: 26px; }
.rules-dialog { width: min(640px, calc(100% - 40px)); max-height: min(82dvh, 760px); margin: auto; padding: 0; border: 1px solid var(--strong-line); border-radius: 14px; color: var(--ink); background: var(--surface-raised); box-shadow: 0 19px 70px #18281e38; overflow: hidden; }
.rules-dialog::backdrop { background: #17261d80; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 79px; padding: 18px 25px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 20px; }
.dialog-close { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; padding: 7px; border-radius: 50%; color: var(--muted); background: var(--surface); }
.dialog-close:hover { color: var(--ink); background: var(--accent-wash); }
.rules-content { max-height: calc(82dvh - 80px); overflow-y: auto; overscroll-behavior: contain; padding: 25px; }
.rule-step { display: grid; grid-template-columns: 27px minmax(0, 1fr); align-items: start; gap: 13px; }
.rule-step + .rule-step { margin-top: 23px; }
.rule-number { display: flex; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 5px; color: var(--accent-ink); background: var(--accent-wash); font-size: 13px; font-weight: 700; line-height: 1; }
.rule-step h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.7; font-weight: 650; }
.rule-step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.rules-footnote { margin: 23px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.9; }

/* Arcade owns a harder silhouette, inset score lines and pixel numerals. */
html[data-theme="arcade"] {
  color-scheme: dark;
  --page: #153a32;
  --surface: #1b4439;
  --surface-raised: #214d40;
  --ink: #f0ecd3;
  --muted: #adc2ad;
  --line: #3c5e4f;
  --strong-line: #72866b;
  --accent: #efcf6c;
  --accent-ink: #f0d378;
  --on-accent: #20392a;
  --accent-wash: #3c5030;
  --focus: #f7df8f;
  --digit: #f6d77a;
  --button-radius: 1px;
  --timer-font: "Jersey Timer", sans-serif;
}

html[data-theme="arcade"] body::before { background-image: linear-gradient(#f5e4ac02 1px, transparent 1px); background-size: 100% 4px; }
html[data-theme="arcade"] .brand-mark { stroke-width: 2; }
html[data-theme="arcade"] .brand-name { color: #f6d77a; }
html[data-theme="arcade"] .brand-en { color: #c3cdaf; letter-spacing: .15em; }
html[data-theme="arcade"] .theme-switch { border-radius: 1px; padding: 3px; border-color: #78906b; background: #103228; }
html[data-theme="arcade"] .theme-option { border-radius: 0; }
html[data-theme="arcade"] .theme-option.is-active { color: #20392a; background: #e6e5cb; border-color: #f0ecd3; box-shadow: inset 0 0 0 1px #cad2b4; }
html[data-theme="arcade"] .theme-option:hover:not(.is-active) { background: #2d5443; }
html[data-theme="arcade"] .theme-swatch { border-radius: 0; }
html[data-theme="arcade"] h1 { font-weight: 800; letter-spacing: -.015em; }
html[data-theme="arcade"] h1 span { color: #f6d77a; }
html[data-theme="arcade"] .challenge-tag { color: #c5d0b6; }
html[data-theme="arcade"] .timer-stage { border: 1px solid #738567; outline: 1px solid #3b5d47; outline-offset: -6px; background: #10352b; }
html[data-theme="arcade"] .timer-stage::after { position: absolute; z-index: -1; inset: 7px; pointer-events: none; content: ""; background-image: repeating-linear-gradient(0deg, #08261b08 0 1px, transparent 1px 4px); }
html[data-theme="arcade"] .stage-topline { left: 23px; right: 23px; color: #d4dcbf; }
html[data-theme="arcade"] .status-dot { border-radius: 0; }
html[data-theme="arcade"] .timer-readout { top: 58px; height: 250px; font-size: clamp(234px, 26vw, 348px); font-weight: 400; letter-spacing: 0; text-shadow: 0 4px 0 #091f1859; }
html[data-theme="arcade"] .timer-readout.is-long { font-size: clamp(210px, 23vw, 308px); }
html[data-theme="arcade"] .time-dot { width: .22em; }
html[data-theme="arcade"] .unit-label { color: #d6ddbc; letter-spacing: .25em; }
html[data-theme="arcade"] .progress-track { left: 23px; right: 23px; height: 4px; padding: 1px; background: #0a271e; outline: 1px solid #537056; }
html[data-theme="arcade"] .play-prompt kbd { border-radius: 0; color: #e8e8c7; border-color: #8d9d7b; background: #264b38; }
html[data-theme="arcade"] .primary-button { color: #17392b; background: #efecd2; border: 1px solid #fffbe5; box-shadow: inset 0 0 0 2px #d5d9b9, 0 4px 9px #05201726; }
html[data-theme="arcade"] .primary-button:hover { color: #17392b; background: #f7d97e; border-color: #ffebb0; box-shadow: inset 0 0 0 2px #e8c865, 0 6px 12px #05201733; }
html[data-theme="arcade"] .primary-button:active { box-shadow: inset 0 0 0 2px #d8bd5d; }
html[data-theme="arcade"] .timer-stage[data-status="running"] .primary-button { background: #f6d77a; color: #17392b; border-color: #ffeab3; box-shadow: inset 0 0 0 2px #e0c16b; }
html[data-theme="arcade"] .duration-field { background: #102e24; border-color: #7f9372; border-radius: 0; }
html[data-theme="arcade"] .duration-field input { color: #f6d77a; }
html[data-theme="arcade"] .confirm-button { border-radius: 0; }
html[data-theme="arcade"] .confirm-button:hover { color: #17392b; }
html[data-theme="arcade"] .mode-switch { border-radius: 0; background: #103228; border-color: #698263; }
html[data-theme="arcade"] .mode-option { border-radius: 0; }
html[data-theme="arcade"] .mode-option.is-active { color: #17392b; background: #e6e5cb; box-shadow: inset 0 0 0 1px #c6cfb0; }
html[data-theme="arcade"] .same-key-badge { border-radius: 0; background: #3c5030; color: #f0d378; }
html[data-theme="arcade"] .mode-option.is-active .same-key-badge { color: #3d5234; background: #ccd2af; }
html[data-theme="arcade"] .rules-note { border-color: #536b50; }
html[data-theme="arcade"] .history-item { border-radius: 0; border-color: #537056; background: #12352a; }
html[data-theme="arcade"] .history-value { font-family: "Jersey Timer", sans-serif; font-size: 34px; line-height: 1.1; font-weight: 400; color: #f6d77a; }
html[data-theme="arcade"] .history-item.is-best { border-color: #e8ca70; background: #3b4e2e; }
html[data-theme="arcade"] .history-item.is-best .history-value { color: #ffe79c; }
html[data-theme="arcade"] .toast { border-radius: 0; background: #efecd2; color: #17392b; border-color: #fffbe5; box-shadow: inset 0 0 0 2px #d5d9b9, 0 7px 25px #05201755; }
html[data-theme="arcade"] .secondary-button { color: #f0ecd3; background: #31523c; border-color: #7f926a; box-shadow: inset 0 0 0 1px #456848; }
html[data-theme="arcade"] .secondary-button:hover { color: #f0ecd3; background: #3c6045; box-shadow: inset 0 0 0 1px #5a7a51; }
html[data-theme="arcade"] .timer-stage[data-status="running"] .secondary-button { color: #f0ecd3; background: #31523c; border-color: #7f926a; box-shadow: inset 0 0 0 1px #456848; }
html[data-theme="arcade"] .turn-item, html[data-theme="arcade"] .game-history-details { border-radius: 0; border-color: #537056; background: #12352a; }
html[data-theme="arcade"] .turn-remaining, html[data-theme="arcade"] .game-target { font-family: "Jersey Timer", sans-serif; font-weight: 400; color: #f6d77a; }
html[data-theme="arcade"] .turn-remaining { font-size: 34px; }
html[data-theme="arcade"] .current-turn-list .turn-item:last-child { border-color: #e8ca70; background: #3b4e2e; }
html[data-theme="arcade"] .rules-dialog { border: 1px solid #8b9a73; border-radius: 0; outline: 1px solid #537056; outline-offset: -6px; background: #153a32; }
html[data-theme="arcade"] .dialog-heading { background: #214736; border-color: #6b7d57; }
html[data-theme="arcade"] .dialog-close { border-radius: 0; background: #31523c; color: #f0ecd3; }
html[data-theme="arcade"] .rule-number { border-radius: 0; background: #e8ca70; color: #20392a; font-family: "Jersey Timer", sans-serif; font-size: 24px; font-weight: 400; }

/* Crayon notebook: marker type, paper ruling, yellow tabs and primary ink. */
html[data-theme="shinchan"] {
  color-scheme: light;
  --page: #faf0d5;
  --surface: #f2dfac;
  --surface-raised: #fff9e8;
  --ink: #39392e;
  --muted: #6c624d;
  --line: #d6c49b;
  --strong-line: #99845e;
  --accent: #bb4336;
  --accent-ink: #a03429;
  --on-accent: #fffbee;
  --accent-wash: #f4ddbe;
  --focus: #237098;
  --digit: #35392d;
  --button-radius: 9px;
  --timer-font: "Lilita Timer", sans-serif;
}
html[data-theme="shinchan"] .site-header { border-bottom: 2px solid #b5a178; }
html[data-theme="shinchan"] .brand-mark { color: #b94436; stroke-width: 2.2; }
html[data-theme="shinchan"] .brand-name { font: 30px/1 "Crayon Chinese", var(--ui-font); }
html[data-theme="shinchan"] .theme-switch { padding: 0; gap: 5px; border: 0; background: transparent; border-radius: 0; }
html[data-theme="shinchan"] .theme-option { border: 2px solid transparent; border-radius: 9px 6px 8px 5px; padding-inline: 10px; font-family: "Crayon Chinese", var(--ui-font); font-size: 13px; font-weight: 400; }
html[data-theme="shinchan"] .theme-option:hover { background: #f2dfac; }
html[data-theme="shinchan"] .theme-option.is-active { color: #38372b; border-color: #514a34; background: #f1d36b; box-shadow: none; }
html[data-theme="shinchan"] .theme-swatch { border-radius: 2px; }
html[data-theme="shinchan"] .icon-button { justify-content: center; gap: 7px; min-width: 37px; height: 37px; padding: 6px 8px; border: 1.5px solid #aa956e; border-radius: 9px 6px 9px 6px; background: #fff9e8; color: #514934; }
html[data-theme="shinchan"] .icon-button svg { stroke-width: 2; }
html[data-theme="shinchan"] .challenge-heading { min-height: 95px; }
html[data-theme="shinchan"] h1 { font: 38px/1.25 "Crayon Chinese", var(--ui-font); letter-spacing: .01em; color: #b34236; }
html[data-theme="shinchan"] h1 span { color: #276b92; }
html[data-theme="shinchan"] .challenge-tag { color: #685b42; }
html[data-theme="shinchan"] .tiny-cross { color: #246c91; font-weight: 700; }
html[data-theme="shinchan"] .timer-stage { height: 462px; border: 3px solid #454735; border-radius: 23px 13px 21px 15px; background-color: #fffae9; background-image: linear-gradient(90deg, transparent 32px, #c8674c24 33px, #c8674c24 34px, transparent 35px), repeating-linear-gradient(0deg, transparent 0 43px, #8197a01a 44px 45px); box-shadow: 0 7px 20px #6f54200a; }
html[data-theme="shinchan"] .timer-stage::before { position: absolute; top: -13px; left: 72px; width: 84px; height: 23px; border: 1px solid #a48c3e; background: #f2d56e; transform: rotate(-3deg); content: ""; }
html[data-theme="shinchan"] .stage-topline { top: 18px; left: 21px; right: 21px; }
html[data-theme="shinchan"] .round-status { min-height: 25px; padding: 2px 10px; border: 1px solid #af9762; border-radius: 5px 3px 6px 4px; background: #f5e5b9; }
html[data-theme="shinchan"] .relay-caption { top: 47px; font-family: "Crayon Chinese", var(--ui-font); font-size: 13px; }
html[data-theme="shinchan"] #turn-count { color: #276b92; border-color: #b4c8ca; background: #edf0d9; border-radius: 4px; }
html[data-theme="shinchan"] .timer-readout { top: 65px; height: 243px; font-size: clamp(232px, 24vw, 320px); font-weight: 400; letter-spacing: -.015em; transform: scaleX(.8); }
html[data-theme="shinchan"] .timer-readout.is-long { font-size: clamp(200px, 21vw, 282px); }
html[data-theme="shinchan"] #time-whole, html[data-theme="shinchan"] #time-fraction { width: 1.278em; }
html[data-theme="shinchan"] .timer-readout.is-long #time-whole { width: 1.917em; }
html[data-theme="shinchan"] .time-dot { width: .25em; color: #b94436; }
html[data-theme="shinchan"] .timer-underlay { top: 308px; }
html[data-theme="shinchan"] .unit-label { color: #276b92; letter-spacing: .16em; }
html[data-theme="shinchan"] .progress-track { top: 337px; left: 22px; right: 22px; height: 4px; border: 1px solid #8a845a; border-radius: 2px; background: #eee4c8; }
html[data-theme="shinchan"] .progress-fill { background: #d4ae39; }
html[data-theme="shinchan"] .play-prompt { top: 355px; }
html[data-theme="shinchan"] .play-prompt kbd { color: #276b92; border: 2px solid #6d8e9d; border-radius: 5px 3px 5px 3px; background: #f1f3df; }
html[data-theme="shinchan"] .play-actions { top: 396px; }
html[data-theme="shinchan"] .primary-button { border: 2px solid #6e3528; border-radius: 11px 7px 12px 7px; background: #bb4336; font: 16px/1.4 "Crayon Chinese", var(--ui-font); box-shadow: 0 4px 10px #7a3a2315; }
html[data-theme="shinchan"] .primary-button:hover { background: #a4342b; }
html[data-theme="shinchan"] .secondary-button { color: #4d442c; background: #f0d36c; border-color: #8b763b; font-size: 14px; box-shadow: none; }
html[data-theme="shinchan"] .secondary-button:hover { background: #f7e3a1; }
html[data-theme="shinchan"] .timer-stage[data-status="running"] .primary-button:not(.secondary-button) { background: #276b92; color: #fffbee; border-color: #254a5a; }
html[data-theme="shinchan"] .settings-strip { border-bottom: 2px solid #c9b98e; }
html[data-theme="shinchan"] .duration-field { border: 2px solid #8a7b54; border-radius: 7px 4px 7px 4px; background: #fff9e8; }
html[data-theme="shinchan"] .duration-field input { color: #276b92; font-family: "Lilita Timer", sans-serif; font-size: 21px; font-weight: 400; }
html[data-theme="shinchan"] .confirm-button { border-left: 1px solid #c6b37f; border-radius: 0 4px 4px 0; }
html[data-theme="shinchan"] .mode-switch { border: 2px solid #8a7b54; border-radius: 7px 4px 6px 4px; background: #eee0b7; }
html[data-theme="shinchan"] .mode-option { font: 14px/1.5 "Crayon Chinese", var(--ui-font); border-radius: 4px; }
html[data-theme="shinchan"] .mode-option.is-active { background: #f1d36b; color: #4d442c; box-shadow: none; }
html[data-theme="shinchan"] .same-key-badge { color: #fffbee; background: #276b92; border-radius: 3px; font: 11px/17px var(--ui-font); }
html[data-theme="shinchan"] h2 { font-family: "Crayon Chinese", var(--ui-font); font-size: 16px; font-weight: 400; }
html[data-theme="shinchan"] .turn-item { border: 2px solid #b7a16e; border-radius: 9px 4px 8px 5px; background: #fff9e8; }
html[data-theme="shinchan"] .turn-remaining { font: 28px/1.25 "Lilita Timer", sans-serif; color: #276b92; }
html[data-theme="shinchan"] .current-turn-list .turn-item:last-child { border-color: #b94738; background: #fff0d0; }
html[data-theme="shinchan"] .game-history-details { border: 2px solid #9e8e66; border-radius: 9px 5px 9px 5px; background: #fff9e8; }
html[data-theme="shinchan"] .game-summary { background: #f5e8c2; }
html[data-theme="shinchan"] .game-target { color: #276b92; font: 23px/1.3 "Lilita Timer", sans-serif; }
html[data-theme="shinchan"] .rules-dialog { border: 3px solid #454735; border-radius: 18px 11px 18px 12px; background: #fff9e8; }
html[data-theme="shinchan"] .dialog-heading { border-bottom: 2px solid #a48f60; background: #f2d56e; }
html[data-theme="shinchan"] .dialog-heading h2 { font-size: 25px; }
html[data-theme="shinchan"] .dialog-close { border: 1.5px solid #8b763b; border-radius: 7px; background: #fff5cf; color: #4d442c; }
html[data-theme="shinchan"] .rule-number { color: #fff9e8; background: #276b92; border-radius: 6px 3px 6px 3px; font-family: "Lilita Timer", sans-serif; }
html[data-theme="shinchan"] .rule-step h3 { font: 18px/1.4 "Crayon Chinese", var(--ui-font); color: #9d392d; }
html[data-theme="shinchan"] .theme-art { right: 23px; bottom: 15px; width: 252px; height: 100px; opacity: .95; }

/* A blue pocket machine: a white curved face, red collar and one golden bell. */
html[data-theme="doraemon"] {
  color-scheme: light;
  --page: #e4f3fa;
  --surface: #d5eaf2;
  --surface-raised: #fcfeff;
  --ink: #254759;
  --muted: #4d6877;
  --line: #b9d7e3;
  --strong-line: #7daabd;
  --accent: #08799e;
  --accent-ink: #086a8b;
  --on-accent: #fff;
  --accent-wash: #d8edf4;
  --focus: #b13732;
  --digit: #1377a1;
  --button-radius: 26px;
  --timer-font: "Baloo Timer", sans-serif;
}
html[data-theme="doraemon"] .site-header { border-bottom: 2px solid #afd2e2; }
html[data-theme="doraemon"] .brand-mark { color: #087ba6; stroke-width: 2.3; }
html[data-theme="doraemon"] .brand-name { color: #08769e; font-weight: 800; }
html[data-theme="doraemon"] .theme-switch { padding: 4px; border: 2px solid #afd2e2; border-radius: 30px; background: #fcfeff; }
html[data-theme="doraemon"] .theme-option { min-height: 34px; border-radius: 22px; font-weight: 650; }
html[data-theme="doraemon"] .theme-option.is-active { background: #f3d772; border-color: #dbbb52; color: #4b482d; box-shadow: none; }
html[data-theme="doraemon"] .theme-option:hover:not(.is-active) { background: #e2f1f8; }
html[data-theme="doraemon"] .icon-button { justify-content: center; min-width: 38px; height: 38px; padding: 7px 8px; border: 2px solid #7fb4ca; border-radius: 30px; background: #fcfeff; color: #096b91; }
html[data-theme="doraemon"] .icon-button svg { stroke-width: 2.1; }
html[data-theme="doraemon"] .challenge-heading { min-height: 100px; }
html[data-theme="doraemon"] h1 { color: #08749c; font-size: 34px; font-weight: 800; letter-spacing: -.025em; }
html[data-theme="doraemon"] h1 span { color: #254759; }
html[data-theme="doraemon"] .tiny-cross { color: #bb453b; }
html[data-theme="doraemon"] .timer-stage { --collar-top: 339px; --collar-inset: 29px; height: 480px; border: 3px solid #24546c; border-radius: 54px 54px 38px 38px; background: #087aa3; box-shadow: 0 9px 24px #3d819d0c; }
html[data-theme="doraemon"] .timer-stage::before { position: absolute; z-index: -1; inset: 12px 12px 134px; border: 2px solid #357089; border-radius: 39px 39px 47% 47% / 39px 39px 44px 44px; background: #fcfeff; content: ""; }
html[data-theme="doraemon"] .stage-topline { top: 26px; left: 31px; right: 31px; }
html[data-theme="doraemon"] .round-status { color: #31596e; }
html[data-theme="doraemon"] .status-dot { width: 7px; height: 7px; background: #c84e42; }
html[data-theme="doraemon"] .relay-caption { top: 49px; }
html[data-theme="doraemon"] #turn-count { color: #225f7b; background: #e2f2f8; border-color: #b2d5e3; border-radius: 20px; }
html[data-theme="doraemon"] .timer-readout { top: 78px; height: 241px; font-size: clamp(272px, 27vw, 360px); font-weight: 800; letter-spacing: -.015em; transform: scaleX(.75); }
html[data-theme="doraemon"] .timer-readout.is-long { font-size: clamp(228px, 23vw, 310px); }
html[data-theme="doraemon"] #time-whole, html[data-theme="doraemon"] #time-fraction { width: 1.166em; }
html[data-theme="doraemon"] .timer-readout.is-long #time-whole { width: 1.749em; }
html[data-theme="doraemon"] .time-dot { width: .2em; color: #c5443c; }
html[data-theme="doraemon"] .timer-underlay { top: 303px; color: #4d6877; }
html[data-theme="doraemon"] .progress-track { top: var(--collar-top); left: var(--collar-inset); right: var(--collar-inset); height: 12px; padding: 1px; border: 2px solid #6e3c35; border-radius: 10px; background: #d95643; overflow: visible; }
html[data-theme="doraemon"] .progress-fill { border-radius: 6px; background: #52b7df; }
html[data-theme="doraemon"] .progress-track::after { position: absolute; top: calc(50% - 2px); left: calc(50% - 12px); width: 24px; height: 24px; border: 2px solid #65532d; border-radius: 50%; background: #f4d267; box-shadow: inset 0 -5px 0 #e1b749; content: ""; }
html[data-theme="doraemon"] .play-prompt { top: 376px; color: #fff; }
html[data-theme="doraemon"] .play-prompt kbd { color: #155f7c; border: 1px solid #0c607e; border-bottom-width: 2px; border-radius: 8px; background: #fcfeff; }
html[data-theme="doraemon"] .play-actions { top: 417px; }
html[data-theme="doraemon"] .primary-button { color: #4b4325; background: #f4d267; border: 2px solid #806f33; border-radius: 28px; font-weight: 750; box-shadow: 0 4px 11px #0759761f; }
html[data-theme="doraemon"] .primary-button:hover { color: #4b4325; background: #ffe38b; box-shadow: 0 6px 14px #0759762b; }
html[data-theme="doraemon"] .secondary-button { color: #9c322e; background: #fff8f0; border: 2px solid #e7b6a8; box-shadow: none; }
html[data-theme="doraemon"] .secondary-button:hover { color: #8a2c27; background: #ffeddb; }
html[data-theme="doraemon"] .timer-stage[data-status="running"] .primary-button:not(.secondary-button) { color: #fff; background: #b73f36; border-color: #823c34; }
html[data-theme="doraemon"] .timer-stage[data-status="running"] .round-status { color: #086a8b; }
html[data-theme="doraemon"] .duration-field { border: 2px solid #7eafc4; border-radius: 24px; background: #fcfeff; }
html[data-theme="doraemon"] .duration-field input { color: #08749c; font-family: "Baloo Timer", sans-serif; font-size: 22px; font-weight: 750; }
html[data-theme="doraemon"] .confirm-button { border-radius: 0 24px 24px 0; border-color: #bedce7; }
html[data-theme="doraemon"] .mode-switch { padding: 4px; border: 2px solid #99c2d2; border-radius: 26px; background: #d7ebf4; }
html[data-theme="doraemon"] .mode-option { border-radius: 19px; }
html[data-theme="doraemon"] .mode-option.is-active { color: #fff; background: #08799e; box-shadow: none; }
html[data-theme="doraemon"] .same-key-badge { color: #4b4325; background: #f4d267; border-radius: 7px; }
html[data-theme="doraemon"] .turn-item { border: 2px solid #b1d3e2; border-radius: 18px; background: #fcfeff; }
html[data-theme="doraemon"] .turn-remaining { color: #08749c; font: 750 29px/1.2 "Baloo Timer", sans-serif; }
html[data-theme="doraemon"] .current-turn-list .turn-item:last-child { background: #fff9df; border-color: #d8b95a; }
html[data-theme="doraemon"] .game-history-details { border: 2px solid #9fc8d9; border-radius: 20px; background: #fcfeff; }
html[data-theme="doraemon"] .game-summary { border-radius: 17px; background: #fcfeff; }
html[data-theme="doraemon"] .game-target { color: #08749c; font: 750 24px/1.2 "Baloo Timer", sans-serif; }
html[data-theme="doraemon"] .rules-dialog { border: 3px solid #438da9; border-radius: 30px; background: #fcfeff; }
html[data-theme="doraemon"] .dialog-heading { background: #e1f3fa; border-bottom: 2px solid #aed4e3; }
html[data-theme="doraemon"] .dialog-heading h2 { color: #08749c; font-weight: 750; }
html[data-theme="doraemon"] .dialog-close { color: #9c322e; background: #fff; border: 2px solid #e7b6a8; border-radius: 50%; }
html[data-theme="doraemon"] .rule-number { color: #4b4325; background: #f4d267; border: 1px solid #d1ac44; border-radius: 50%; font-family: "Baloo Timer", sans-serif; font-weight: 800; }
html[data-theme="doraemon"] .rule-step h3 { color: #08749c; }
html[data-theme="doraemon"] .theme-art { top: calc(var(--collar-top) + 22px); right: 27px; bottom: auto; width: 200px; height: 100px; opacity: .97; }

/* Farm HUD: a sky field, honey-wood edges, green slots and a parchment score. */
html[data-theme="stardew"] {
  color-scheme: light;
  --page: #dfeddd;
  --surface: #d9e2c7;
  --surface-raised: #fff0c8;
  --ink: #4e3822;
  --muted: #65583c;
  --line: #b8be91;
  --strong-line: #9a824d;
  --accent: #476d39;
  --accent-ink: #35572c;
  --on-accent: #fff7df;
  --accent-wash: #e1e4b8;
  --focus: #3c642f;
  --digit: #70451e;
  --button-radius: 0;
  --timer-font: "Jersey Timer", sans-serif;
}
html[data-theme="stardew"] .site-header { border-bottom: 3px solid #81926a; }
html[data-theme="stardew"] .brand-mark { color: #597341; stroke-width: 2; }
html[data-theme="stardew"] .brand-name { color: #6d4827; letter-spacing: .02em; }
html[data-theme="stardew"] .theme-switch { padding: 3px; gap: 3px; border: 2px solid #987341; border-radius: 0; background: #e1c486; box-shadow: inset 0 0 0 1px #fff0bc; }
html[data-theme="stardew"] .theme-option { min-height: 31px; border: 1px solid transparent; border-radius: 0; color: #5a4b31; }
html[data-theme="stardew"] .theme-option:hover { background: #f0d9a0; }
html[data-theme="stardew"] .theme-option.is-active { color: #fff7df; background: #496e3b; border-color: #35532c; box-shadow: inset 0 0 0 1px #7f9c5d; }
html[data-theme="stardew"] .theme-swatch { border-radius: 0; }
html[data-theme="stardew"] .icon-button { min-width: 36px; height: 36px; justify-content: center; padding: 6px 8px; color: #624425; background: #f5dfaa; border: 2px solid; border-color: #fff0c3 #a07a44 #a07a44 #fff0c3; border-radius: 0; box-shadow: inset 0 0 0 1px #b99458; }
html[data-theme="stardew"] .challenge-heading { min-height: 106px; }
html[data-theme="stardew"] h1 { display: inline-block; padding: 7px 16px; color: #684525; background: #f6e6b9; border: 2px solid #ae8c50; box-shadow: inset 0 0 0 2px #fff3ce; font-size: 28px; font-weight: 750; letter-spacing: .01em; }
html[data-theme="stardew"] h1 span { color: #456335; }
html[data-theme="stardew"] .tiny-cross { color: #547541; }
html[data-theme="stardew"] .timer-stage { height: 460px; border: 6px solid #9a6b35; outline: 2px solid #eed297; outline-offset: -9px; background: #fff0c8; box-shadow: 0 6px 17px #5466420d; }
html[data-theme="stardew"] .timer-stage::before { position: absolute; left: 10px; top: 10px; width: 5px; height: 5px; background: #aa8446; content: ""; }
html[data-theme="stardew"] .stage-topline { top: 17px; left: 23px; right: 23px; }
html[data-theme="stardew"] .round-status { padding: 2px 8px; border: 1px solid #ccb177; background: #f4e2ac; color: #5f482a; }
html[data-theme="stardew"] .status-dot { border-radius: 0; background: #5a793e; }
html[data-theme="stardew"] .relay-caption { top: 46px; }
html[data-theme="stardew"] #turn-count { color: #35572c; background: #e0e5b7; border-color: #a7b478; border-radius: 0; }
html[data-theme="stardew"] .timer-readout { top: 58px; height: 250px; font-size: clamp(236px, 26vw, 348px); font-weight: 400; letter-spacing: 0; text-shadow: 0 3px 0 #b9914f38; }
html[data-theme="stardew"] .timer-readout.is-long { font-size: clamp(210px, 23vw, 308px); }
html[data-theme="stardew"] .time-dot { width: .22em; }
html[data-theme="stardew"] .timer-underlay { top: 307px; }
html[data-theme="stardew"] .unit-label { color: #72552d; letter-spacing: .22em; }
html[data-theme="stardew"] .progress-track { top: 336px; left: 23px; right: 23px; height: 6px; padding: 1px; border: 1px solid #9f7a3f; outline: 1px solid #efd79e; background: #dcc48b; }
html[data-theme="stardew"] .progress-fill { background: #608444; }
html[data-theme="stardew"] .play-prompt { top: 354px; }
html[data-theme="stardew"] .play-prompt kbd { border-radius: 0; border: 2px solid; border-color: #fff3cc #ae8b4e #ae8b4e #fff3cc; color: #5f4528; background: #f3dfa9; }
html[data-theme="stardew"] .play-actions { top: 394px; }
html[data-theme="stardew"] .primary-button { color: #50351d; background: #edc276; border: 3px solid; border-color: #fff0b6 #a16c31 #a16c31 #fff0b6; border-radius: 0; box-shadow: inset 0 0 0 1px #c28d43, 0 4px 10px #684e2610; }
html[data-theme="stardew"] .primary-button:hover { background: #f6d28c; box-shadow: inset 0 0 0 1px #c28d43, 0 6px 13px #684e2618; }
html[data-theme="stardew"] .secondary-button { color: #fff4d8; background: #8c5b30; border-color: #bb8b50 #644321 #644321 #bb8b50; box-shadow: inset 0 0 0 1px #a97940; }
html[data-theme="stardew"] .secondary-button:hover { color: #fff4d8; background: #794e28; }
html[data-theme="stardew"] .timer-stage[data-status="running"] .primary-button:not(.secondary-button) { color: #fff8e2; background: #496d39; border-color: #91aa69 #35532c #35532c #91aa69; box-shadow: inset 0 0 0 1px #63884a; }
html[data-theme="stardew"] .settings-strip { border-bottom: 2px solid #9cac7b; }
html[data-theme="stardew"] .duration-field { border: 2px solid; border-color: #9e7a43 #e4c790 #e4c790 #9e7a43; border-radius: 0; background: #fff2cf; }
html[data-theme="stardew"] .duration-field input { color: #70451e; font-family: "Jersey Timer", sans-serif; font-size: 24px; font-weight: 400; }
html[data-theme="stardew"] .confirm-button { color: #416331; border-color: #c4ad75; border-radius: 0; }
html[data-theme="stardew"] .mode-switch { border: 2px solid #b59961; border-radius: 0; background: #e0c68c; }
html[data-theme="stardew"] .mode-option { color: #5a472d; border-radius: 0; }
html[data-theme="stardew"] .mode-option.is-active { background: #fff0c8; color: #35572c; box-shadow: inset 0 0 0 1px #c8b576; }
html[data-theme="stardew"] .same-key-badge { border-radius: 0; color: #35572c; background: #e0e5b7; }
html[data-theme="stardew"] .turn-item { border: 2px solid; border-color: #a78046 #e4c78d #e4c78d #a78046; border-radius: 0; background: #fff0c8; }
html[data-theme="stardew"] .turn-remaining { color: #70451e; font: 34px/1.1 "Jersey Timer", sans-serif; }
html[data-theme="stardew"] .current-turn-list .turn-item:last-child { border-color: #71914e; background: #eaf0ce; }
html[data-theme="stardew"] .game-history-details { border: 3px solid #a87d40; border-radius: 0; background: #fff0c8; box-shadow: inset 0 0 0 1px #ffe9b0; }
html[data-theme="stardew"] .game-summary { background: #f1dba4; border-radius: 0; }
html[data-theme="stardew"] .game-target { color: #6e4823; font: 29px/1.1 "Jersey Timer", sans-serif; }
html[data-theme="stardew"] .rules-dialog { border: 6px solid #9a6b35; outline: 2px solid #eed297; outline-offset: -9px; border-radius: 0; background: #fff0c8; }
html[data-theme="stardew"] .dialog-heading { border-bottom: 3px solid #a87d40; background: #edce8a; }
html[data-theme="stardew"] .dialog-heading h2 { color: #684525; letter-spacing: .03em; }
html[data-theme="stardew"] .dialog-close { border: 2px solid; border-color: #fff0b6 #a16c31 #a16c31 #fff0b6; border-radius: 0; background: #f0d49a; color: #684525; }
html[data-theme="stardew"] .rule-number { color: #fff5d9; background: #52733e; border: 1px solid #35532c; border-radius: 0; font-family: "Jersey Timer", sans-serif; font-size: 25px; }
html[data-theme="stardew"] .rule-step h3 { color: #5c4728; }
html[data-theme="stardew"] .rules-footnote { border-color: #c8af78; }
html[data-theme="stardew"] .theme-art { right: 19px; bottom: 10px; width: 244px; height: 105px; opacity: .96; }
html[data-theme="stardew"] .toast { color: #fff0c8; border-color: #a87d40; background: #4e3822; border-radius: 0; }
html:is([data-theme="arcade"], [data-theme="stardew"]) #time-whole,
html:is([data-theme="arcade"], [data-theme="stardew"]) #time-fraction { width: .86em; }
html:is([data-theme="arcade"], [data-theme="stardew"]) .timer-readout.is-long #time-whole { width: 1.29em; }

@keyframes key-mismatch { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
@keyframes toast-in { from { opacity: 0; translate: 0 7px; filter: blur(2px); } to { opacity: 1; translate: 0 0; filter: blur(0); } }
@keyframes notebook-step { 0% { transform: translate3d(-3px, 0, 0) rotate(-.4deg); } 35% { transform: translate3d(0, -1px, 0); } 70% { transform: translate3d(4px, 0, 0) rotate(.4deg); } 100% { transform: translate3d(6px, -1px, 0); } }
@keyframes pocket-drift { 0% { transform: translate3d(-3px, 2px, 0) rotate(-1deg); } 45% { transform: translate3d(3px, -6px, 0); } 100% { transform: translate3d(1px, 3px, 0) rotate(1deg); } }
@keyframes pocket-orbit { 0% { transform: translate3d(3px, 1px, 0) rotate(1deg); } 50% { transform: translate3d(-2px, -9px, 0) rotate(-1deg); } 100% { transform: translate3d(-4px, 2px, 0) rotate(.5deg); } }
@keyframes junimo-hop { 0%, 30% { transform: translate3d(-3px, 0, 0); } 52% { transform: translate3d(1px, -3px, 0); } 75%, 100% { transform: translate3d(5px, 0, 0); } }
@keyframes farmer-stroll { 0%, 20% { transform: translate3d(4px, 0, 0); } 48% { transform: translate3d(0, -1px, 0); } 78%, 100% { transform: translate3d(-5px, 0, 0); } }

@media (max-width: 1439px) {
  .theme-scenery { position: absolute; z-index: 2; inset: auto 0 54px; height: 114px; }
  html[data-theme="shinchan"] .theme-scenery { --scene-pair-size: clamp(50px, calc(18vw - 60px), 72px); inset: 80px 0 auto; height: 95px; }
  html[data-theme="shinchan"] .friend-one { top: 4px; bottom: auto; left: calc(50% + 72px - var(--scene-pair-size)); right: auto; width: var(--scene-pair-size); height: 88px; }
  html[data-theme="shinchan"] .friend-two { top: 12px; bottom: auto; left: calc(50% + 80px); right: auto; width: calc(var(--scene-pair-size) * .9); height: 81px; }
  html[data-theme="doraemon"] .theme-scenery { --pocket-pal-size: clamp(50px, calc(14vw - 35px), 74px); inset: 80px 0 auto; height: 100px; }
  html[data-theme="doraemon"] .friend-one { top: 8px; bottom: auto; left: calc(50% + 18px); right: auto; width: var(--pocket-pal-size); height: 72px; }
  html[data-theme="doraemon"] .friend-two { top: 26px; bottom: auto; left: calc(50% + clamp(84px, 12vw, 150px)); right: auto; width: calc(var(--pocket-pal-size) * .94); height: 64px; }
  html[data-theme="stardew"] .friend-one { top: auto; bottom: 7px; left: max(22px, calc(50% - 240px)); right: auto; width: 64px; height: 65px; }
  html[data-theme="stardew"] .friend-two { top: auto; bottom: 0; left: auto; right: max(22px, calc(50% - 210px)); width: 94px; height: 104px; }
  html[data-theme="stardew"] .page-end { min-height: 0; padding-block: 123px 24px; }
}

@media (max-width: 1140px) {
  .app-shell { width: calc(100% - 64px); }
  .site-header { height: 116px; display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-content: center; }
  .theme-switch { grid-row: 2; grid-column: 1/-1; justify-self: center; }
  .brand-en { display: none; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"]) .theme-scenery { top: 116px; }
  .settings-strip { grid-template-columns: minmax(230px, .9fr) minmax(260px, 1fr) minmax(225px, .9fr); gap: 16px; }
  .duration-setting, .mode-setting { gap: 12px; }
  .duration-field { width: 146px; }
  .duration-field input { width: 65px; }
  .rules-note { padding-left: 16px; gap: 8px; }
  .mode-option { padding-inline: 10px; }
}

@media (max-width: 900px) {
  :root { --stage-height: 430px; }
  .app-shell { width: calc(100% - 48px); }
  .site-header { height: 116px; gap: 8px 16px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 22px; }
  .brand-mark { width: 26px; height: 26px; }
  html[data-theme] .theme-option { padding-inline: 7px; font-size: 11px; gap: 5px; }
  .header-tools { gap: 10px; }
  .tool-label { display: none; }
  .icon-button { padding-inline: 3px; }
  .challenge-heading { min-height: 88px; }
  h1 { font-size: 29px; }
  .timer-readout { top: 61px; height: 218px; font-size: clamp(208px, 30vw, 274px); }
  .timer-readout.is-long { font-size: clamp(176px, 26vw, 235px); }
  .timer-underlay { top: 283px; }
  .progress-track { top: 313px; }
  .play-prompt { top: 331px; }
  .play-actions { top: 371px; }
  .settings-strip { grid-template-columns: 1fr 1.15fr; min-height: 130px; row-gap: 15px; padding-block: 20px 17px; }
  .duration-setting, .mode-setting { gap: 16px; }
  .duration-field { width: 159px; }
  .duration-field input { width: 76px; }
  .mode-setting { justify-content: flex-end; }
  .rules-note { grid-column: 1/-1; justify-content: center; border-left: 0; padding-left: 0; gap: 7px; }
  .rules-note svg { width: 14px; height: 14px; }
  .rules-note p { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; text-align: center; }
  .rules-note br { display: none; }
  .field-error { top: calc(100% + 1px); }
  .current-turn-list, .game-turn-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theme-art { right: 17px; bottom: 17px; width: 158px; height: 96px; }
  html[data-theme="arcade"] .timer-readout { top: 58px; height: 226px; font-size: clamp(225px, 32.5vw, 296px); }
  html[data-theme="arcade"] .timer-readout.is-long { font-size: clamp(191px, 28vw, 254px); }
  html[data-theme="shinchan"] .timer-stage { height: 442px; }
  html[data-theme="shinchan"] .timer-readout { top: 67px; height: 218px; font-size: clamp(212px, 30vw, 282px); }
  html[data-theme="shinchan"] .timer-readout.is-long { font-size: clamp(176px, 25vw, 238px); }
  html[data-theme="shinchan"] .timer-underlay { top: 288px; }
  html[data-theme="shinchan"] .progress-track { top: 317px; }
  html[data-theme="shinchan"] .play-prompt { top: 335px; }
  html[data-theme="shinchan"] .play-actions { top: 376px; }
  html[data-theme="shinchan"] .theme-art { right: 19px; bottom: 15px; width: 165px; height: 100px; }
  html[data-theme="doraemon"] .timer-stage { --collar-top: 317px; height: 458px; }
  html[data-theme="doraemon"] .timer-readout { top: 75px; height: 222px; font-size: clamp(240px, 34vw, 314px); }
  html[data-theme="doraemon"] .timer-readout.is-long { font-size: clamp(202px, 29vw, 267px); }
  html[data-theme="doraemon"] .timer-underlay { top: 283px; }
  html[data-theme="doraemon"] .play-prompt { top: 354px; }
  html[data-theme="doraemon"] .play-actions { top: 395px; }
  html[data-theme="doraemon"] .theme-art { right: 20px; bottom: auto; width: 153px; height: 100px; }
  html[data-theme="stardew"] .timer-stage { height: 442px; }
  html[data-theme="stardew"] h1 { font-size: 26px; }
  html[data-theme="stardew"] .timer-readout { top: 60px; height: 225px; font-size: clamp(225px, 32.5vw, 296px); }
  html[data-theme="stardew"] .timer-readout.is-long { font-size: clamp(191px, 28vw, 254px); }
  html[data-theme="stardew"] .timer-underlay { top: 285px; }
  html[data-theme="stardew"] .progress-track { top: 315px; }
  html[data-theme="stardew"] .play-prompt { top: 334px; }
  html[data-theme="stardew"] .play-actions { top: 375px; }
  html[data-theme="stardew"] .theme-art { right: 17px; bottom: 10px; width: 165px; height: 99px; }
}

@media (min-width: 641px) and (max-width: 760px) {
  .site-header { gap: 10px; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 24px; height: 24px; }
  .header-tools { gap: 6px; }
  html[data-theme] .theme-option { padding-inline: 5px; }
  html[data-theme] .icon-button { min-width: 32px; padding-inline: 5px; }
  html[data-theme="shinchan"] .brand-name { font-size: 25px; }
  html:is([data-theme="shinchan"], [data-theme="stardew"]) .theme-art { right: 14px; bottom: 14px; width: 112px; height: 86px; }
  html[data-theme="doraemon"] .theme-art { right: 14px; bottom: auto; width: 112px; height: 86px; }
}

@media (max-width: 640px) {
  :root { --stage-height: 405px; }
  .app-shell { width: calc(100% - 36px); }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .theme-scenery { inset: auto 0 52px; height: 95px; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .scenery-friend { animation: none; transform: none; }
  html[data-theme="shinchan"] .friend-one { top: auto; bottom: 0; left: calc(50% - 78px); right: auto; width: 66px; height: 88px; }
  html[data-theme="shinchan"] .friend-two { top: auto; bottom: 0; left: calc(50% + 4px); right: auto; width: 59px; height: 82px; }
  html[data-theme="doraemon"] .friend-one { top: auto; bottom: 8px; left: calc(50% - 102px); right: auto; width: 56px; height: 76px; }
  html[data-theme="doraemon"] .friend-two { top: auto; bottom: 25px; left: calc(50% + 18px); right: auto; width: 64px; height: 65px; }
  html[data-theme="stardew"] .friend-one { top: auto; bottom: 6px; left: 32px; right: auto; width: 52px; height: 54px; }
  html[data-theme="stardew"] .friend-two { top: auto; bottom: 0; left: auto; right: 28px; width: 80px; height: 86px; }
  .page-end { gap: 12px; min-height: 73px; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .page-end { padding-block: 109px 24px; }
  .site-header { height: 150px; display: grid; grid-template-columns: 1fr auto; row-gap: 0; align-content: center; }
  .brand { gap: 8px; }
  .brand-name { font-size: 23px; }
  .brand-mark { width: 27px; height: 27px; }
  .theme-switch { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-row: 2; grid-column: 1/-1; justify-self: center; width: min(100%, 380px); margin-top: 12px; padding: 3px; gap: 3px; }
  html[data-theme] .theme-option { grid-column: span 2; min-height: 28px; padding: 4px 8px; font-size: 11px; }
  .theme-option:nth-child(n+4) { grid-column: span 3; }
  .theme-swatch { width: 7px; height: 7px; }
  .header-tools { gap: 9px; }
  html[data-theme] .icon-button { min-width: 32px; height: 32px; min-height: 32px; padding: 5px; }
  .icon-button svg { width: 17px; height: 17px; }
  .challenge-heading { min-height: 87px; gap: 10px; }
  h1 { font-size: 26px; }
  .challenge-tag { font-size: 11px; gap: 5px; white-space: nowrap; letter-spacing: 0; }
  .tiny-cross { font-size: 18px; }
  .stage-topline { top: 17px; font-size: 11px; }
  .round-status { gap: 6px; }
  .status-dot { width: 5px; height: 5px; }
  .target-caption strong { margin-inline: 2px; }
  .relay-caption { top: 43px; gap: 8px; }
  .timer-readout { top: 67px; height: 181px; font-size: clamp(158px, 43vw, 247px); letter-spacing: -.025em; }
  .timer-readout.is-long { font-size: clamp(112px, 35.5vw, 208px); }
  .timer-underlay { top: 250px; gap: 11px; }
  .unit-label { font-size: 11px; letter-spacing: .12em; }
  .progress-track { top: 279px; }
  .play-prompt { top: 296px; font-size: 12px; }
  .play-prompt kbd { height: 24px; min-width: 55px; font-size: 11px; }
  .play-actions { top: 336px; gap: 12px; }
  .primary-button { min-width: 177px; min-height: 47px; gap: 28px; padding-inline: 20px; font-size: 12px; }
  .reset-button { min-width: 94px; min-height: 44px; gap: 8px; padding-inline: 13px; font-size: 12px; }
  .settings-strip { grid-template-columns: 1fr; gap: 18px; padding-block: 23px 19px; min-height: auto; }
  .duration-setting, .mode-setting { justify-content: space-between; gap: 12px; }
  .duration-setting label, .setting-label { font-size: 12px; }
  .duration-field { width: 214px; height: 42px; padding-left: 14px; }
  .duration-field input { flex: 1; width: 128px; font-size: 17px; }
  .duration-field > span { margin-inline: 8px; }
  .confirm-button { width: 41px; }
  .field-error { left: auto; right: 0; top: calc(100% + 2px); }
  .mode-switch { width: 214px; }
  .mode-option { flex: 1; justify-content: center; min-height: 32px; font-size: 12px; }
  .rules-note { margin-top: -1px; justify-content: flex-start; align-items: flex-start; gap: 7px; }
  .rules-note svg { margin-top: 3px; flex-shrink: 0; }
  .rules-note p { display: block; text-align: left; font-size: 12px; }
  .rules-note p span { margin-left: 3px; font-size: 12px; }
  .current-turns { padding-block: 20px 15px; }
  .current-turn-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .turn-item { padding: 10px 12px; }
  .turn-remaining { font-size: 29px; }
  .history-section { padding-top: 19px; }
  h2 { font-size: 13px; gap: 11px; }
  h2 > span, .text-button { font-size: 11px; }
  .history-empty { min-height: 83px; gap: 10px; }
  .history-empty p { font-size: 12px; text-align: center; }
  .empty-line { width: 18px; }
  .history-list { grid-template-columns: 1fr; gap: 8px; margin-top: 11px; margin-bottom: 20px; }
  .game-summary { min-height: 61px; padding: 11px 12px; gap: 12px; }
  .game-date, .game-turn-total { font-size: 11px; }
  .game-target { font-size: 23px; }
  .game-turn-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .game-turn-list .turn-item { padding: 9px 11px; }
  .game-turn-list .turn-remaining { font-size: 26px; }
  .rules-dialog { width: calc(100% - 24px); max-height: 88dvh; border-radius: 12px; }
  .dialog-heading { min-height: 71px; padding: 15px 19px; }
  .dialog-heading h2 { font-size: 20px; }
  .rules-content { max-height: calc(88dvh - 72px); padding: 22px 19px; }
  .rule-step { grid-template-columns: 25px minmax(0, 1fr); gap: 10px; }
  .rule-step h3 { font-size: 14px; }
  .rule-step p { font-size: 12px; }
  .rules-footnote { font-size: 12px; }
  .toast { bottom: 17px; padding: 11px 15px; font-size: 12px; }
  html[data-theme="arcade"] .stage-topline { left: 15px; right: 15px; }
  html[data-theme="arcade"] .progress-track { left: 15px; right: 15px; }
  html[data-theme="arcade"] .timer-readout { top: 58px; height: 203px; font-size: clamp(144px, 45.2vw, 258px); }
  html[data-theme="arcade"] .timer-readout.is-long { font-size: clamp(116px, 36.5vw, 210px); }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .challenge-heading { min-height: 91px; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .challenge-tag { display: none; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .theme-art { top: -81px; right: 0; bottom: auto; width: 79px; height: 65px; opacity: 1; }
  html[data-theme="shinchan"] .brand-name { font-size: 28px; }
  html[data-theme="shinchan"] h1 { font-size: 31px; }
  html[data-theme="shinchan"] .timer-stage { height: 416px; border-radius: 17px 10px 17px 11px; }
  html[data-theme="shinchan"] .timer-stage::before { left: 39px; width: 65px; height: 19px; top: -11px; }
  html[data-theme="shinchan"] .stage-topline { left: 13px; right: 13px; top: 15px; }
  html[data-theme="shinchan"] .relay-caption { top: 47px; font-size: 13px; }
  html[data-theme="shinchan"] .timer-readout { top: 67px; height: 184px; font-size: 40vw; }
  html[data-theme="shinchan"] .timer-readout.is-long { font-size: 32.5vw; }
  html[data-theme="shinchan"] .timer-underlay { top: 251px; }
  html[data-theme="shinchan"] .progress-track { top: 282px; left: 13px; right: 13px; }
  html[data-theme="shinchan"] .play-prompt { top: 301px; }
  html[data-theme="shinchan"] .play-actions { top: 342px; }
  html[data-theme="shinchan"] .primary-button { font-size: 15px; }
  html[data-theme="shinchan"] .secondary-button { font-size: 14px; }
  html[data-theme="shinchan"] .mode-option { font-size: 14px; }
  html[data-theme="shinchan"] .rule-step h3 { font-size: 18px; }
  html[data-theme="doraemon"] h1 { font-size: 27px; }
  html[data-theme="doraemon"] .timer-stage { --collar-top: 301px; --collar-inset: 17px; height: 448px; border-radius: 34px 34px 25px 25px; }
  html[data-theme="doraemon"] .timer-stage::before { inset: 10px 10px 140px; border-radius: 24px 24px 47% 47% / 24px 24px 25px 25px; }
  html[data-theme="doraemon"] .stage-topline { top: 24px; left: 21px; right: 21px; }
  html[data-theme="doraemon"] .relay-caption { top: 50px; }
  html[data-theme="doraemon"] .timer-readout { top: 78px; height: 186px; font-size: 40vw; }
  html[data-theme="doraemon"] .timer-readout.is-long { font-size: 32vw; }
  html[data-theme="doraemon"] .timer-underlay { top: 264px; gap: 9px; }
  html[data-theme="doraemon"] .play-prompt { top: 340px; }
  html[data-theme="doraemon"] .play-actions { top: 381px; }
  html[data-theme="doraemon"] .rules-dialog { border-radius: 24px; }
  html[data-theme="stardew"] h1 { padding: 7px 10px; font-size: 24px; }
  html[data-theme="stardew"] .timer-stage { height: 416px; border-width: 5px; outline-offset: -8px; }
  html[data-theme="stardew"] .stage-topline { top: 17px; left: 14px; right: 14px; }
  html[data-theme="stardew"] .relay-caption { top: 47px; }
  html[data-theme="stardew"] .timer-readout { top: 65px; height: 198px; font-size: clamp(144px, 45.2vw, 258px); }
  html[data-theme="stardew"] .timer-readout.is-long { font-size: clamp(116px, 36.5vw, 210px); }
  html[data-theme="stardew"] .timer-underlay { top: 258px; }
  html[data-theme="stardew"] .progress-track { top: 288px; left: 16px; right: 16px; }
  html[data-theme="stardew"] .play-prompt { top: 307px; }
  html[data-theme="stardew"] .play-actions { top: 348px; }
}

@media (max-width: 370px) {
  .app-shell { width: calc(100% - 28px); }
  h1 { font-size: 24px; }
  .challenge-tag { display: none; }
  .duration-field, .mode-switch { width: 198px; }
  .duration-field input { width: 100px; }
  .timer-readout { font-size: 43vw; }
  .primary-button { min-width: 164px; }
  .reset-button { min-width: 90px; }
  .game-summary { gap: 8px; padding-inline: 10px; }
  html:is([data-theme="shinchan"], [data-theme="doraemon"], [data-theme="stardew"]) .theme-art { right: 0; width: 58px; }
  html[data-theme="shinchan"] h1 { font-size: 27px; }
  html[data-theme="doraemon"] h1 { font-size: 25px; }
  html[data-theme="stardew"] h1 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .scenery-friend { animation: none !important; transform: none !important; }
}
