/* Hallmark · job: practise · shape: Timer Ledger · genre: atmospheric · theme: custom · axes: dark/serif/warm · posture: restrained · contrast: pass · fold: pass · nav: N9 · footer: Ft2 · hero: Settled · v2.0.0 */
/* Hallmark · pre-emit critique: P5 H4 E4 S4 R4 V4 · weakest: S, dense mobile controls need a strict 4px rhythm and one anchor hue */
/* Hallmark · built: craft-anything rebuild · redesign: polish */
/* kill-ai-slop · second pass · palette: plum/rose/wisteria, one radius, no atmosphere gradient, serif display heads */
/* Humanizer-zh · second pass · UI copy: dropped manual-voice boilerplate; information and limits preserved */
/* Hallmark · answered F7 · the repeated box is a deliberate instrument panel: seven readouts share one recipe so the timer stays the only loud thing · on the record */
:root {
  --bg: #1b1420;
  --bg2: #251b2b;
  --bg3: #302339;
  --text: #f7eef4;
  --muted: #b9a5bb;
  --accent: #d9a0b6;
  --accent2: #b39ac6;
  --green: #7ec9a4;
  --yellow: #e0c078;
  --red: #e0828c;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --line: rgba(185, 165, 187, 0.24);
  --tap: 44px;
  --font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --lift-1: rgba(27, 20, 32, .92);
  --lift-2: rgba(63, 217, 143, .5);
  --lift-3: rgba(179,154,198,.12);
  --lift-4: #29151f;
  --lift-5: rgba(224,130,140,.5);
  --lift-6: #c4656f;
  --lift-7: #fff;
  --lift-8: rgba(126,201,164,.25);
  --lift-9: #000;
  --lift-10: rgba(27,20,32,.9);
  --lift-11: rgba(37,27,43,.96);
  --lift-12: rgba(0,0,0,.7);
  --lift-13: #201522;
  --lift-14: #241827;
  --on-red: #2a0a12;
  --field-edge: #9d8ba1;
  --mask-ink: #000;
  --dial-track: #322a33;
}
html { overflow-x: clip; }
body { overflow-x: clip; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }


* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: 1.72rem; font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; line-height: 1.35; text-wrap: balance; }
h2 { font-size: 1.12rem; font-family: var(--font-display); font-weight: 600; letter-spacing: .03em; }
button, input, textarea, select { font-family: var(--font); }
button { cursor: pointer; }
ul { list-style: none; padding: 0; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.fineprint { font-size: .72rem; color: var(--muted); margin-top: .6rem; text-align: center; }

/* focus */
:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: 8px; top: 8px; z-index: 200; transform: translateY(-300%);
  background: var(--accent); color: var(--bg); padding: .6rem 1rem; border-radius: var(--r-sm);
}
.skip-link:focus { transform: none; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--lift-1);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 500; letter-spacing: .06em; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 999px;
  background: var(--accent);
}
.brand-title { font-size: 1rem; font-family: var(--font-display); }
.topbar-right { display: flex; align-items: center; gap: .5rem; }

.chip {
  display: inline-block; font-size: .74rem; padding: .2rem .6rem;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  background: var(--bg2); white-space: nowrap;
}
.chip-green { color: var(--green); border-color: var(--lift-2); }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap);
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: var(--r-sm); font-size: 1.1rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}

/* screens */
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stack {
  max-width: 640px; margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
}
.center-card {
  max-width: 420px; margin: 6vh auto; padding: 28px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 14px;
  text-align: center; color: var(--text); }
.gate-mark {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 999px;
  border: 2px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 1.4rem;
}
.welcome-ring {
  width: 84px; height: 84px; margin: 0 auto; border-radius: 999px;
  border: 6px solid var(--accent2); box-shadow: 0 0 0 8px var(--lift-3);
}
.welcome-stats { display: flex; justify-content: space-around; margin: .5rem 0; }
.welcome-stats div { display: flex; flex-direction: column; }
.welcome-stats b { font-size: 1.4rem; color: var(--accent); }
.welcome-stats span { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* cards & hero */
.hero { padding: 14px 4px 10px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: .2rem 0 .6rem; }
.hero-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 1.05rem; font-weight: 500; }
.progress { height: 8px; border-radius: 10px; background: var(--bg3); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: opacity .2s linear; }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-list li {
  display: flex; align-items: center; gap: .6rem; font-size: .9rem;
  padding: 8px 8px; border-radius: var(--r-sm); background: var(--bg3);
}
.task-list li .dot { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--muted); flex: none; }
.task-list li.done .dot { background: var(--green); border-color: var(--green); }
.task-list li.done { color: var(--green); }
.task-list li span.tgt { margin-left: auto; color: var(--muted); font-size: .78rem; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick {
  text-align: left; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px; color: var(--text);
  display: flex; flex-direction: column; gap: 2px; min-height: 72px; justify-content: center;
}
.quick b { font-size: 1rem; }
.quick span { font-size: .76rem; color: var(--muted); }

.section-head { display: flex; align-items: center; gap: 10px; }

/* buttons */
.btn {
  min-height: var(--tap); border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg3); color: var(--text); padding: 10px 16px; font-size: .95rem;
  font-weight: 600; transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .8rem; }
.btn-xl { min-height: 58px; font-size: 1.1rem; }
.btn-primary { background: var(--accent); color: var(--lift-4); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--red); border-color: var(--lift-5); }
.btn-edge {
  background: var(--red); color: var(--on-red);
  border-color: var(--red); min-height: 64px; font-size: 1.15rem; font-weight: 600;
  letter-spacing: .04em;
}
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.field input[type=text], .field input[type=number], .code-area {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--field-edge); border-radius: var(--r-sm); padding: 12px;
}
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field b { color: var(--accent); font-variant-numeric: tabular-nums; }
.check-row { display: flex; align-items: center; gap: .6rem; font-size: .9rem; padding: 6px 0; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }

/* segmented choices */
.seg {
  display: flex; gap: 6px; background: var(--bg); padding: 5px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.seg button {
  flex: 1; min-height: 40px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: .86rem; font-weight: 600;
}
.seg button.active { background: var(--accent); color: var(--lift-4); }
.seg-3 button, .seg-4 button { font-size: .8rem; padding: 0 2px; }

/* switch */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .9rem; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.toggle {
  width: 50px; height: 30px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg3); position: relative; flex: none;
}
.toggle span {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 999px; background: var(--muted); transition: transform .15s ease, background .15s ease;
}
.toggle[aria-pressed="true"] { background: var(--lift-8); border-color: var(--green); }
.toggle[aria-pressed="true"] span { transform: translateX(20px); background: var(--green); }

/* config panel */
.cfg-panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; color: var(--text); }
.cfg-tabs { display: flex; border-bottom: 1px solid var(--line); }
.cfg-tab {
  flex: 1; min-height: var(--tap); background: transparent; border: 0;
  color: var(--muted); font-weight: 600; font-size: .9rem;
  border-bottom: 2px solid transparent;
}
.cfg-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.cfg-page { display: none; padding: 16px; flex-direction: column; gap: 12px; }
.cfg-page.active { display: flex; }
.group-title { color: var(--accent2); font-size: .8rem; margin-top: 4px; }

.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset {
  text-align: left; background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px; color: var(--text);
  display: flex; flex-direction: column; gap: 3px; min-height: 76px;
}
.preset b { font-size: .95rem; }
.preset span { font-size: .74rem; color: var(--muted); }
.preset.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* game */
.game-wrap { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); position: relative; display: flex; flex-direction: column; gap: 12px; }
.game-top { display: flex; align-items: center; gap: 10px; }
.game-top .muted { margin-left: auto; }
.phase-pill { padding: .25rem .7rem; border-radius: 10px; font-size: .8rem; font-weight: 500; background: var(--bg3); border: 1px solid var(--line); }
.phase-title { text-align: center; font-size: 1.8rem; font-weight: 600; letter-spacing: .1em; font-family: var(--font-display); }
.phase-sub { text-align: center; color: var(--muted); font-size: .9rem; margin-top: -8px; }
.dial { position: relative; width: 200px; height: 200px; margin: 4px auto; }
.dial-ring {
  position: absolute; inset: 0; border-radius: 999px;
  background: conic-gradient(var(--accent) 0deg, var(--dial-track) 0deg);
}
.dial-inner { position: absolute; inset: 26px; border-radius: 999px; background: var(--bg2); display: grid; place-content: center; text-align: center; }
.countdown { font-size: 2.2rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .04em; font-family: var(--font-display); }
.dial-label { color: var(--muted); font-size: .74rem; }

.instruction-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; color: var(--text); }
.instruction-label { color: var(--accent2); font-size: .76rem; }
.instruction-text { font-size: 1.12rem; line-height: 1.6; min-height: 3.2em; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat-row div { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 2px; display: flex; flex-direction: column; }
.stat-row b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.game-controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ctrl { min-height: var(--tap); border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-size: .78rem; font-weight: 600; }

/* overlays */
.overlay { position: absolute; inset: 0; background: var(--lift-10); z-index: 20; display: grid; place-items: center; padding: 20px; }
.overlay[hidden] { display: none; }
.overlay-card { width: 100%; max-width: 360px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; gap: 12px; text-align: center; color: var(--text); }
.hold-btn { touch-action: none; user-select: none; -webkit-user-select: none; }

/* result */
.result-hero { text-align: center; padding: 10px; }
.result-outcome { font-size: 1.8rem; font-weight: 600; color: var(--accent); font-family: var(--font-display); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid div { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.result-grid b { display: block; font-size: 1.2rem; }
.result-grid span { font-size: .76rem; color: var(--muted); }
.badge-list { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-list li { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: .78rem; }
.share-canvas { width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--line); }
.code-area { width: 100%; resize: vertical; font-size: .78rem; word-break: break-all; }

/* records / achievements / titles */
.record-list, .hint-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.record-list li { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .86rem; }
.record-list li .r-main { display: flex; flex-direction: column; }
.record-list li .r-sub { color: var(--muted); font-size: .74rem; }
.record-list li .r-tag { color: var(--accent); font-weight: 500; white-space: nowrap; }
.hint-list li { background: var(--bg3); border-radius: var(--r-sm); padding: 10px 12px; font-size: .84rem; color: var(--muted); }
.hint-list li.unlocked { color: var(--text); border: 1px solid var(--accent2); }
.ach-cat { margin-top: 14px; }
.ach-cat h2 { color: var(--accent2); margin-bottom: 8px; font-size: .9rem; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.badge {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 8px; text-align: center; font-size: .72rem; line-height: 1.35;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.badge .ico { font-size: 1.4rem; filter: grayscale(1); opacity: .4; }
.badge.unlocked { border-color: var(--accent); }
.badge.unlocked .ico { filter: none; opacity: 1; }
.badge .nm { color: var(--muted); }
.badge.unlocked .nm { color: var(--text); }
.title-mode { margin-top: 14px; }
.title-mode h2 { color: var(--accent2); margin-bottom: 8px; font-size: .9rem; }
.title-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.title-cell { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; font-size: .8rem; color: var(--muted); text-align: center; }
.title-cell.unlocked { color: var(--text); border-color: var(--accent); }

details { border-bottom: 1px solid var(--line); padding: 10px 0; }
details:last-child { border-bottom: 0; }
summary { font-weight: 600; cursor: pointer; }
details p { color: var(--muted); font-size: .86rem; margin-top: 8px; }

/* tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--lift-11);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; min-height: 60px; background: transparent; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem;
}
.tabbar button span { font-size: 1.15rem; line-height: 1; }
.tabbar button.active { color: var(--accent); }

/* install banner */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 60; background: var(--bg3); border: 1px solid var(--accent2);
  border-radius: var(--r-md); padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  font-size: .82rem;
}
.install-banner[hidden] { display: none; }
.install-banner span { flex: 1; }

/* modal + toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: var(--lift-12); display: grid; place-items: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: 100%; max-width: 380px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; color: var(--text); }
.modal-body { color: var(--muted); font-size: .9rem; margin: 10px 0 18px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 120;
  background: var(--accent2); color: var(--lift-13); font-weight: 500; font-size: .85rem;
  padding: 8px 16px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (min-width: 720px) {
  .stack, .game-wrap { padding-left: 24px; padding-right: 24px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .dial { width: 240px; height: 240px; }
  .countdown { font-size: 2.8rem; }
  .tabbar { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: var(--r-lg) var(--r-lg) 0 0; }
}
@media (min-width: 1024px) {
  body { background: var(--bg); border-top: 1px solid var(--line); }
}

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