:root {
  color-scheme: dark;
  --ink: #fbefe1;
  --muted: #cbb6a8;
  --base: #170e0e;
  --panel: #211514;
  --line: #50352e;
  --rust: #ea694b;
  --gold: #ffd29a;
  --serif: Georgia, "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--base);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main, .mast, footer { max-width: 1248px; margin-inline: auto; padding-inline: 28px; }
.mast, footer { display: flex; justify-content: space-between; align-items: center; min-height: 72px; gap: 16px; }
nav { display: flex; flex-wrap: wrap; gap: 20px; }
a { color: inherit; text-underline-offset: 3px; }
nav a, .brand { text-decoration: none; }
nav a:hover { text-decoration: underline; }
.brand { font-size: 28px; font-weight: 750; letter-spacing: -.08em; }
.chain-proof { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 11px 0 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--gold); }
.chain-proof a::before { content: "◆"; margin-right: 8px; font-size: 9px; }
.chain-proof span { color: var(--muted); }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 18px; padding: 45px clamp(22px,5vw,70px); border: 1px solid #9a5040; background: radial-gradient(ellipse at 80% 35%,#933f30 0,#63231f 35%,#401919 72%); min-height: 298px; border-radius: 12px; overflow: hidden; }
.chain { font-size: 12px; font-weight: 700; letter-spacing: .17em; color: var(--gold); margin: 0; }
h1, h2, p { margin-top: 0; }
h1 { font: 600 clamp(44px,6vw,86px)/1.02 var(--serif); letter-spacing: -.06em; margin: 8px 0 14px; }
:lang(zh-Hant) h1 { letter-spacing: .02em; }
.hero p:not(.chain) { max-width: 42ch; margin-bottom: 22px; line-height: 1.55; color: #f4dbc9; }
.envelope-art { position: relative; display: grid; place-items: center; min-height: 186px; }
.envelope-art::before, .envelope-art::after { content: ""; position: absolute; width: min(19vw, 247px); aspect-ratio: 1; border: 1px solid #ffd29a55; border-radius: 50%; }
.envelope-art::after { transform: scale(1.2); opacity: .7; }
.envelope { isolation: isolate; width: min(24vw, 285px); aspect-ratio: 1.65; position: relative; border: 1px solid #f2a666; border-radius: 13px; background: linear-gradient(25deg,#9b211f,#da4d35 64%,#f27650); overflow: hidden; box-shadow: 0 20px 35px #32111199; transform: rotate(-11deg); z-index: 1; }
.envelope::before { position: absolute; content: ""; inset: 0; background: repeating-linear-gradient(45deg,#fff0 0px 6px,#ffdda51f 7px 8px); }
.fold { position: absolute; inset: 0 0 17%; background: linear-gradient(18deg,#8f2521,#f1744d); clip-path: polygon(0 0,100% 0,100% 13%,53% 92%,50% 93%,47% 92%,0 13%); border-top: 2px solid #ffd29a90; }
.seal { display: grid; place-items: center; color: #661c19; position: absolute; left: 50%; top: 65%; transform: translate(-50%,-50%); width: 24%; aspect-ratio: 1; border: 4px double #a75134; background: #ffc576; border-radius: 50%; font: 700 clamp(16px,3vw,42px)/1 var(--serif); box-shadow: 0 3px 0 #742d20; }
.work { margin-top: 20px; display: grid; grid-template-columns: 1.12fr 1fr; gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: clamp(16px,2vw,25px); min-width: 0; }
h2 { margin: 0 0 15px; font: 600 clamp(23px,2.4vw,34px)/1.15 var(--serif); letter-spacing: -.025em; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
button, .button, input, select { font: inherit; min-height: 41px; border-radius: 7px; }
button, .button { background: #34201d; color: var(--ink); border: 1px solid #674039; padding: 8px 13px; cursor: pointer; white-space: nowrap; font-weight: 650; }
.button { display: inline-flex; text-decoration: none; align-items: center; }
.outline { background: #431815; border-color: #e69576; }
button:hover:not(:disabled), .button:hover { border-color: var(--gold); }
button:disabled { opacity: .5; cursor: default; }
button[aria-pressed=true] { border-color: #cc8763; color: var(--gold); }
.primary { background: var(--rust); color: #21100d; border-color: var(--rust); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.toolbar, .lookup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lookup { margin: 12px 0; }
.lookup input { width: min(105px,30vw); }
.lookup-result:empty { display: none; }
.lookup-result { margin-bottom: 10px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin-bottom: 12px; }
label, summary { color: var(--muted); font-size: 13px; }
.fields input, .fields select, details input { display: block; margin-top: 4px; width: 100%; }
input, select { min-width: 0; background: #190f0f; color: var(--ink); border: 1px solid #644139; padding: 7px 8px; }
input[type=checkbox] { min-height: auto; accent-color: var(--rust); }
.check { display: flex; align-items: center; gap: 7px; }
summary { cursor: pointer; margin: 12px 0; width: fit-content; }
details label { display: block; margin-bottom: 7px; }
.totals { border-block: 1px solid var(--line); padding: 7px 0; margin: 12px 0; }
.totals div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; }
dt, #packet-status, #winners-status, .wallet, .status, footer, #preview-status { color: var(--muted); }
dd { text-align: right; margin: 0; overflow-wrap: anywhere; }
.mono, code, dd, time { font-family: Consolas, ui-monospace, monospace; }
.wallet, .status, #preview-status { margin: 7px 0; overflow-wrap: anywhere; }
.packet, .winner { border-top: 1px solid var(--line); padding: 12px 0; }
.packet strong, .winner strong { color: var(--gold); }
.packet div, .winner { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.packet p, .winner span { margin: 4px 0; color: var(--muted); overflow-wrap: anywhere; }
.packet .action { margin-top: 8px; }
.winners { margin-top: 20px; }
.contract { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; padding: 16px 0; }
.contract h2 { font: 600 15px/1.25 "Segoe UI", sans-serif; margin: 0; }
code { overflow-wrap: anywhere; color: var(--muted); }
dialog { width: min(465px,calc(100vw - 30px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 22px; }
dialog::backdrop { background: #0c0707bf; }
.transaction { margin: 0; }
.transaction:has(a:not([hidden])) { margin: 12px 0; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; }
footer { border-top: 1px solid var(--line); font-size: 13px; }
@media(max-width: 720px) {
  main, .mast, footer { padding-inline: 16px; }
  .mast { min-height: 59px; }
  .hero { padding: 23px 17px; min-height: 245px; grid-template-columns: minmax(0,1fr) 92px; }
  .hero h1 { font-size: clamp(34px,10vw,48px); }
  .envelope { width: 100px; }
  .envelope-art::before, .envelope-art::after { width: 96px; }
  .work { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .chain-proof { gap: 4px 15px; }
  .fields label:has(input[type="datetime-local"]) { grid-column: 1 / -1; }
  footer { flex-wrap: wrap; padding-block: 10px; }
}
#preview-detail { overflow-wrap: anywhere; line-height: 1.5; }
