/* 月夜墓园：深蓝夜空、苔藓绿草地、灰石墓碑、暖黄烛光。单一深色主题，刻意的。 */
:root {
  --night: #10141d;
  --night-2: #182030;
  --moss: #2c3a2f;
  --grass: #3d5240;
  --stone: #a3a7ad;
  --stone-2: #6d727a;
  --stone-3: #474c54;
  --candle: #ffcf6b;
  --box: #b88d5c;
  --ink: #ece6d8;
  --ink-2: #a9a396;
  --red: #e0745a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 380px, var(--moss) 1200px, #1f2a22 100%);
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--candle); outline-offset: 2px; }

.sky { position: absolute; inset: 0 0 auto; height: 360px; overflow: hidden; pointer-events: none; }
.moon { position: absolute; right: 9%; top: 36px; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fff8e0, #f1e3b4 60%, #d9c58c);
  box-shadow: 0 0 60px 18px rgba(255, 236, 180, .18); }

.wrap { position: relative; max-width: 1080px; margin: 0 auto; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 60px max(16px, env(safe-area-inset-left, 0px)); }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .3em; color: var(--candle); }
h1 { margin: 10px 0 8px; font-size: clamp(26px, 5vw, 44px); line-height: 1.25; text-wrap: balance; max-width: 18em; }
.lede { margin: 0; color: var(--ink-2); max-width: 40em; line-height: 1.7; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.stat { background: rgba(16, 20, 29, .7); border: 1px solid var(--stone-3); border-radius: 6px; padding: 10px 14px; min-width: 104px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-2); }
.stat.alive b { color: var(--candle); }
.stat.batch b { color: var(--box); }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 26px 0 8px; }
.bar button, .small { background: rgba(16, 20, 29, .75); border: 1px solid var(--stone-2); border-radius: 4px; padding: 8px 14px; }
.bar button.on { border-color: var(--candle); color: var(--candle); }
.primary { background: var(--candle) !important; color: #2a1d05 !important; border-color: var(--candle) !important; font-weight: 700; }
.toggle { display: inline-flex; gap: 6px; align-items: center; padding: 8px 6px; color: var(--ink-2); }

.paste { background: rgba(16, 20, 29, .85); border: 1px solid var(--stone-3); border-radius: 6px; padding: 14px 16px; margin: 10px 0; }
.paste p { margin: 0 0 8px; line-height: 1.6; }
.paste pre { margin: 0 0 8px; padding: 10px; background: #0b0e14; border-radius: 4px; overflow-x: auto; font-size: 13px; color: var(--candle); }
.paste textarea { width: 100%; margin-top: 8px; background: #0b0e14; color: var(--ink); border: 1px solid var(--stone-3); border-radius: 4px; padding: 10px; font: 13px/1.5 ui-monospace, Menlo, monospace; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.row button { padding: 8px 14px; border-radius: 4px; border: 1px solid; }
.err { color: var(--red); font-size: 14px; }
.hint { color: var(--ink-2); font-size: 12px; }

.zone { margin-top: 34px; }
.zone h2 { font-size: 20px; margin: 0 0 4px; display: flex; gap: 10px; align-items: baseline; }
.zone h2 .n { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.zone .desc { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; line-height: 1.6; max-width: 46em; }
.yard { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 12px; padding: 18px 14px 22px; border-radius: 8px;
  background: linear-gradient(180deg, transparent 0, transparent 70%, rgba(0, 0, 0, .18) 100%), var(--grass);
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, .04); }

.stone { position: relative; height: 112px; border: 0; padding: 22px 8px 10px; background: var(--stone); color: #22252a;
  border-radius: 46px 46px 4px 4px; text-align: center; display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .12), 0 6px 0 #26332a; transition: transform .15s; }
.stone:hover { transform: translateY(-3px); }
.stone .nm { font: 600 12px/1.25 ui-monospace, Menlo, monospace; word-break: break-all; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.stone .d { font-size: 11px; margin-top: auto; opacity: .8; }
.stone .cross { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); font-size: 12px; opacity: .55; }

.alive .stone { background: #d8d3c4; box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .1), 0 6px 0 #26332a, 0 0 22px rgba(255, 207, 107, .35); }
.alive .stone::after { content: ""; position: absolute; top: -14px; left: 50%; width: 6px; height: 12px; margin-left: -3px; border-radius: 50% 50% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff3c4, var(--candle) 55%, #ff9b3d); box-shadow: 0 0 12px 4px rgba(255, 190, 90, .55); animation: flick 1.6s infinite alternate; }
.dying .stone { background: var(--stone-2); color: #15171b; }
.dying .stone::before { content: ""; position: absolute; left: 30%; top: 34%; width: 28px; height: 2px; background: rgba(0, 0, 0, .35); transform: rotate(38deg); }
.dead .stone { background: var(--stone-3); color: #c9c4b8; transform: rotate(var(--tilt, -3deg)); }
.dead .stone:hover { transform: rotate(var(--tilt, -3deg)) translateY(-3px); }
.dead .stone .d { color: #a9a396; }
.batch .stone { border-radius: 3px; background: var(--box); color: #2b1c0a; height: 92px; padding-top: 14px;
  background-image: linear-gradient(90deg, transparent 44%, rgba(255, 255, 255, .25) 44%, rgba(255, 255, 255, .25) 56%, transparent 56%); }
.batch .stone .cross { display: none; }
@keyframes flick { from { transform: scale(1) translateY(0); opacity: .9; } to { transform: scale(1.1, .92) translateY(1px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .alive .stone::after { animation: none; } .stone { transition: none; } }

.pop { position: fixed; z-index: 9; max-width: 300px; background: #0f131b; border: 1px solid var(--candle); border-radius: 6px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6); line-height: 1.6; }
.pop h3 { margin: 0 0 4px; font: 700 15px ui-monospace, Menlo, monospace; word-break: break-all; }
.pop .meta { color: var(--ink-2); font-size: 13px; }
.pop .adv { margin-top: 8px; font-size: 14px; }
.pop .x { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: var(--ink-2); font-size: 16px; }

.card-box { margin-top: 40px; }
.card-box img { display: block; width: min(100%, 540px); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.foot { margin-top: 48px; color: var(--ink-2); font-size: 12px; line-height: 1.7; }

@media (max-width: 560px) {
  .wrap { padding-top: 28px; }
  .moon { width: 56px; height: 56px; right: 18px; top: 20px; }
  .yard { grid-template-columns: repeat(3, 1fr); gap: 14px 8px; padding: 14px 8px; }
  .stone { height: 100px; }
  .stat { min-width: 0; flex: 1 1 28%; }
}
.by { color: var(--candle); text-decoration: none; opacity: .85; }
.by:hover { text-decoration: underline; }
