:root {
  --ink: #e8dcc0;
  --dim: #8d8371;
  --line: rgba(232, 220, 192, 0.18);
  --amber: #e2a94a;
  --label: "Futura", "Gill Sans", "Avenir Next Condensed", "Helvetica Neue", "PingFang SC", sans-serif;
  --type: "American Typewriter", "Courier Prime", "Courier New", "Songti SC", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070605; color: var(--ink); font-family: var(--label); }
button, input { font: inherit; color: inherit; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.title { position: fixed; left: 26px; top: 20px; pointer-events: none; }
.title h1 { margin: 0; font: 400 19px/1.2 Georgia, "Times New Roman", serif; letter-spacing: 0.26em; text-transform: uppercase; }
.title p { margin: 6px 0 0; font-size: 12px; letter-spacing: 0.12em; color: var(--dim); }



.drawer { position: fixed; right: 18px; top: 18px; bottom: 18px; width: 350px; display: flex; flex-direction: column;
  background: rgba(10, 9, 8, 0.78); border: 1px solid var(--line); backdrop-filter: blur(8px); transition: transform 0.3s ease; }
.drawer.folded { transform: translateX(calc(100% - 34px)); }
.drawer.folded .pane { visibility: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-right: 1px solid var(--line); background: none; }
.tabs #fold { margin-left: auto; border-right: 0; border-left: 1px solid var(--line); width: 34px; padding: 7px 0; order: -1; margin-left: 0; }
.drawer.folded #fold { transform: scaleX(-1); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.pane-actions { display: flex; gap: 8px; }
.pane-actions button:disabled { opacity: 0.35; cursor: default; }
.pane-note { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.5; }
.sheets { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.sheets .empty { color: var(--dim); font-size: 12.5px; text-align: center; margin-top: 40px; }
.sheet { background: #f5efdc; color: #1d1b18; padding: 20px 22px 12px; font: 13.5px/1.62 var(--type); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6); }
.sheet .t { text-align: center; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.sheet .b { text-align: center; font-size: 12px; margin-top: 2px; }
.sheet .c { text-align: center; font-size: 12px; letter-spacing: 0.3em; margin: 10px 0 2px; }
.sheet .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; min-height: 1.6em; }
.sheet.typing .body::after { content: "▌"; animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sheet .folio { text-align: center; font-size: 11px; color: #6d6558; margin-top: 10px; }
.sheet.cut .folio::before { content: "[ 总闸断开 ] "; color: #a33; }
#pane-card pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.5 "Courier New", monospace; }
#pane-card { overflow-y: auto; }
#pane-card pre, #pane-card .holes { background: #e9dcb4; color: #2b2416; padding: 10px 12px; }
#pane-card .holes { white-space: pre; overflow: hidden; letter-spacing: 1px; line-height: 1.05; padding-bottom: 4px; margin-bottom: -10px;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%); }

.telegram { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); max-width: 520px; background: #f1cf55; color: #3a1d00;
  padding: 9px 14px; font: 12px/1.5 var(--type); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6); }
.tip { position: fixed; pointer-events: none; max-width: 300px; padding: 7px 10px; background: rgba(8, 7, 6, 0.92); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.45; z-index: 5; }
.tip b { display: block; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); font-size: 11px; }
.tip i { font-style: normal; color: var(--ink); }
@media (max-width: 900px) { .drawer { width: min(380px, 86vw); } }

.gate { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; width: min(440px, 90vw); padding: 22px 24px;
  background: rgba(10, 9, 8, 0.94); border: 1px solid var(--amber); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px #000; }
.gate h2 { margin: 0; font: 400 15px Georgia, serif; letter-spacing: 0.26em; text-transform: uppercase; color: var(--amber); }
.gate p { margin: 0; font-size: 13px; color: var(--ink); }
.gate input { padding: 8px 10px; background: #0d0c0a; border: 1px solid var(--line); outline: 0; font: 15px var(--type); }
.gate input:focus { border-color: var(--amber); }
.gate button { padding: 8px; background: var(--amber); color: #1a1206; border: 0; letter-spacing: 0.2em; cursor: pointer; }


.toast { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); max-width: min(520px, 80vw); padding: 10px 16px; z-index: 5;
  background: rgba(10, 9, 8, 0.94); border: 1px solid var(--amber); font-size: 13px; line-height: 1.55; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.7); }

.gate h2 { display: flex; align-items: center; }
.gate h2 button { margin-left: auto; background: none; color: var(--dim); padding: 0 4px; letter-spacing: 0; }
.gate fieldset { border: 1px solid var(--line); margin: 0; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gate legend { font-size: 11px; letter-spacing: 0.14em; color: var(--dim); padding: 0 6px; }
.gate small { font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.gate .pair { display: flex; gap: 8px; }
.gate .pair > * { flex: 1; min-width: 0; }
.gate #own-clear { background: none; color: var(--ink); border: 1px solid var(--line); }

/* ---- flow HUD: bottom-left, one column, nothing overlaps ---- */
.hud { position: fixed; left: 22px; bottom: 20px; z-index: 4; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  max-width: calc(100vw - var(--inset, 0px) - 40px); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud button, .tabs button, .pane-actions button, .zoom button, .keybtn {
  background: rgba(10, 9, 8, 0.78); border: 1px solid var(--line); padding: 7px 13px; font-size: 12px; letter-spacing: 0.1em;
  cursor: pointer; backdrop-filter: blur(6px); transition: border-color 0.15s, color 0.15s; white-space: nowrap; }
.hud button:hover:not(:disabled), .tabs button:hover, .pane-actions button:hover:not(:disabled), .zoom button:hover, .keybtn:hover { color: var(--amber); }
.card { width: min(440px, 100%); padding: 13px 16px 14px; background: rgba(10, 9, 8, 0.86); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  backdrop-filter: blur(8px); }
.card header { display: flex; align-items: baseline; gap: 10px; }
.card header span { font-size: 11px; letter-spacing: 0.16em; color: var(--dim); }
.card header b { font-size: 16px; font-weight: 600; letter-spacing: 0.1em; color: var(--amber); }
.card p { margin: 8px 0 12px; font-size: 13px; line-height: 1.65; white-space: normal; }
.card footer { display: flex; gap: 8px; justify-content: flex-end; }
.card footer button:disabled { opacity: 0.35; cursor: default; }
.card footer .primary { background: var(--amber); color: #1a1206; border-color: var(--amber); }
.card footer .primary:hover { color: #1a1206; filter: brightness(1.1); }
.nameplate { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; letter-spacing: 0.14em; color: var(--dim); }
.nameplate input { flex: 1; min-width: 0; padding: 6px 9px; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); outline: 0; font: 14px var(--type); color: var(--ink); }
.nameplate input:focus { border-color: var(--amber); }
.bar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.steps { display: flex; flex-wrap: wrap; }
.steps button { margin: 0 -1px -1px 0; }
.steps button.on, #look-round.on, .tabs button.on { border-color: var(--amber); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); position: relative; }
.steps kbd { font: inherit; color: var(--dim); margin-right: 6px; }
.start { position: fixed; left: 50%; bottom: 13vh; transform: translateX(-50%); padding: 14px 44px; background: var(--amber); color: #1a1206; border: 0;
  cursor: pointer; font-size: 16px; letter-spacing: 0.4em; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7); }
.start:hover { filter: brightness(1.1); }
.topbtns { position: fixed; left: 26px; top: 86px; display: flex; gap: 8px; }
.zoom { position: fixed; left: 26px; top: 132px; display: flex; }
.zoom button + button { border-left: 0; }
.toast { bottom: auto; top: 76px; }

.about { position: fixed; inset: 0; z-index: 7; background: rgba(4, 3, 2, 0.72); display: flex; justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.about article { position: relative; width: min(680px, 100%); height: max-content; padding: 30px 34px 28px; background: #f3ecd8; color: #221e17;
  font: 15px/1.75 Georgia, "Songti SC", serif; box-shadow: 0 30px 80px #000; }
.about h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.about h3 { margin: 22px 0 6px; font: 600 12px var(--label); letter-spacing: 0.22em; color: #7a5a22; }
.about p { margin: 0 0 10px; }
.about .lead { color: #5b5242; }
.about .note, .about small { font-size: 13px; color: #5b5242; line-height: 1.65; display: block; }
.about blockquote { margin: 8px 0; padding: 4px 0 4px 14px; border-left: 3px solid #b8924a; font-style: italic; }
.about ul { margin: 0; padding-left: 20px; }
.about a { color: #7a3d10; }
.about #about-close { position: absolute; right: 14px; top: 12px; background: none; border: 0; color: #5b5242; font-size: 16px; cursor: pointer; }
.about .pair { display: flex; gap: 8px; margin: 8px 0 12px; }
.about .pair button { padding: 8px 16px; background: #221e17; color: #f3ecd8; border: 0; cursor: pointer; letter-spacing: 0.1em; font: 13px var(--label); }
.about iframe { width: 100%; height: 78vh; border: 1px solid #b8a67c; background: #fff; margin-bottom: 10px; }
