@font-face { font-family: 'Special Elite'; src: url(../fonts/special-elite-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; src: url(../fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; font-weight: 400; src: url(../fonts/libre-caslon-text-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; font-weight: 400; font-style: italic; src: url(../fonts/libre-caslon-text-latin-400-italic.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; font-weight: 700; src: url(../fonts/libre-caslon-text-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; src: url(../fonts/playfair-display-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: italic; src: url(../fonts/playfair-display-latin-700-italic.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Playfair Display'; font-weight: 900; src: url(../fonts/playfair-display-latin-900-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'UnifrakturCook'; font-weight: 700; src: url(../fonts/unifrakturcook-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Architects Daughter'; src: url(../fonts/architects-daughter-latin-400-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --night: #07080c;
  --ink: #e9e4d8;
  --dim: #8d8a83;
  --torch: #ffcf7a;
  --torch2: #f0a43a;
  --guard: #7fa6ff;
  --alert: #ff5a46;
  --blue: #12264a;
  --blue2: #1a3563;
  --line: #9cc0ff;
  --paper: #efe6cf;
  --hud: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --serif: 'Libre Caslon Text', Georgia, serif;
  --type: 'Special Elite', 'Courier New', monospace;
  --hand: 'Architects Daughter', 'Comic Sans MS', cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); overflow: hidden; }
body { font-family: var(--hud); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--night); z-index: 50; transition: opacity .5s; }
#boot.out { opacity: 0; pointer-events: none; }
.boot-t { font-family: 'Playfair Display', serif; font-weight: 700; font-style: italic; font-size: 34px; color: var(--torch); text-align: center; }
.boot-bar { width: 220px; height: 2px; background: #222; margin: 16px auto 0; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--torch); transition: width .2s; }

/* ---------- shared ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.btn { background: var(--torch); color: #1b1408; border: 0; border-radius: 3px; padding: 12px 20px; font-family: var(--hud); font-weight: 700; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; min-height: 46px; }
.btn:hover { background: #ffe0a0; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(233,228,216,.35); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); background: rgba(255,255,255,.04); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .iconbtn:focus-visible { outline: 2px solid var(--torch); outline-offset: 2px; }
.kicker { font-family: var(--hud); font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: var(--ink); font-size: 16px; display: inline-grid; place-items: center; }
.iconbtn:hover { background: rgba(255,255,255,.14); }
.iconbtn.on { background: var(--torch); color: #1b1408; }

/* ---------- job ---------- */
#job { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }
.hud-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px; padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: linear-gradient(#07080cf0, #07080c00); pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-l { display: flex; align-items: center; gap: 10px; }
.gclock { width: 50px; height: 50px; flex: none; }
.gclock path { fill: #1a2233; stroke: #07080c; stroke-width: 2; transition: fill .3s; }
.gclock path.on { fill: var(--guard); }
.gclock text { fill: var(--ink); font: 700 22px var(--hud); text-anchor: middle; dominant-baseline: central; }
.gclock circle { fill: #07080c; }
.ntime { font-weight: 600; font-size: 17px; letter-spacing: .03em; }
.nbar { width: 84px; height: 3px; background: #23262f; margin-top: 4px; }
.nbar i { display: block; height: 100%; background: #6c7a95; }
.nbar.late i { background: var(--alert); }
.strip { flex: 1; position: relative; height: 22px; min-width: 120px; }
.strip .seg { position: absolute; top: 0; bottom: 0; border: 1px solid #2c3650; border-right: 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: #8091b5; display: grid; place-items: center; overflow: hidden; background: #0d1424; }
.strip .seg.fog { color: #3c4560; background: repeating-linear-gradient(45deg, #0b0f19 0 4px, #0e1320 4px 8px); }
.strip i { position: absolute; top: -3px; width: 4px; height: 28px; margin-left: -2px; border-radius: 2px; }
.strip i.me { background: var(--torch); box-shadow: 0 0 8px var(--torch); z-index: 2; }
.strip i.gd { background: var(--guard); }
.strip i.gd.alert { background: var(--alert); }
.strip i.tg { width: 0; height: 0; top: -9px; border: 6px solid transparent; border-top-color: var(--torch); margin-left: -6px; border-radius: 0; }
.hud-r { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: .04em; }
.litflag { padding: 3px 8px; border-radius: 2px; background: #141824; color: #8ea0c5; font-size: 13px; letter-spacing: .1em; min-width: 86px; text-align: center; }
.litflag.on { background: var(--torch); color: #241808; box-shadow: 0 0 14px #ffcf7a88; }
.litflag.hid { background: #1d2b1f; color: #9fd0a8; }
.strikes { display: inline-flex; gap: 4px; }
.strikes b { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #6c7a95; }
.strikes b.x { background: var(--alert); border-color: var(--alert); }

.labelcard { position: absolute; right: max(14px, env(safe-area-inset-right)); top: 76px; width: 268px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.lab { background: #f3efe6; color: #1c1a17; padding: 12px 14px 11px; font-family: var(--serif); font-size: 13px; line-height: 1.35; box-shadow: 0 6px 24px #0008; }
.lab-artist { font-weight: 700; font-size: 14px; }
.lab-title { margin-top: 2px; }
.lab-med, .lab-dim { margin-top: 6px; font-size: 12px; color: #48433b; }
.lab-room { margin-top: 6px; font-family: var(--hud); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #7a7366; }
.pencil { font-family: var(--hand); color: var(--torch); font-size: 14px; line-height: 1.3; padding: 0 4px; text-shadow: 0 1px 3px #000; }

.actions { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); pointer-events: none; display: flex; justify-content: center; }
.actions .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.actions button { position: relative; overflow: hidden; min-width: 112px; min-height: 58px; padding: 6px 16px; border: 0; border-radius: 4px; background: #161a24ee; color: var(--ink); font-weight: 700; font-size: 19px; letter-spacing: .04em; text-transform: uppercase; box-shadow: inset 0 0 0 1.5px #ffffff22; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
.actions button small { font-size: 14px; font-weight: 600; color: var(--dim); text-transform: none; }
.actions button em { font-style: normal; font-weight: 500; font-size: 12px; letter-spacing: .02em; text-transform: none; color: var(--dim); max-width: 170px; line-height: 1.1; }
.actions button.hold { box-shadow: inset 0 0 0 1.5px #ffcf7a88; }
.actions button.hold:not(:disabled):active, .actions button.hold:not(:disabled):hover { background: #2a2416; }
.actions button:disabled { opacity: .55; box-shadow: inset 0 0 0 1px #ffffff14; }
.actions button .pg { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--torch); }
.actions button .lb { position: relative; }

.toast { position: absolute; left: 50%; top: 84px; transform: translate(-50%, -8px); background: #0b0d14ee; border-left: 3px solid var(--torch); padding: 9px 14px; font-size: 17px; font-weight: 500; letter-spacing: .02em; max-width: min(560px, 86vw); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.flash { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Playfair Display', serif; font-weight: 900; font-size: clamp(26px, 5vw, 54px); color: #fff; background: #8a140c66; opacity: 0; pointer-events: none; transition: opacity .3s; text-align: center; padding: 20px; }
.flash.on { opacity: 1; }
.flash.final { background: #8a140caa; }

.notepin { position: absolute; left: max(14px, env(safe-area-inset-left)); top: 76px; width: 260px; transform: translateX(-120%); transition: transform .3s; }
.notepin.open { transform: none; }

.pause { position: absolute; inset: 0; background: #05060acc; display: grid; place-items: center; z-index: 5; }
.pause-in { display: flex; flex-direction: column; gap: 12px; width: min(380px, 90vw); text-align: center; }
.pause-in h2 { font-family: 'Playfair Display', serif; font-style: italic; font-size: 40px; margin: 0 0 8px; color: var(--torch); }
.pause .keys { font-size: 15px; color: var(--dim); line-height: 1.45; font-weight: 500; }

/* ---------- the note (typed buyer's letter) ---------- */
.note { background: var(--paper); color: #1d1a16; font-family: var(--type); padding: 20px 22px 18px; font-size: 15px; line-height: 1.5; box-shadow: 0 10px 30px #000a, inset 0 0 60px #c9b98a55; position: relative; }
.note p { margin: 0 0 6px; }
.note .sig { margin-top: 12px; text-align: right; }
.note .fee { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #0003; font-size: 14px; }
.note.hand { font-family: var(--hand); font-size: 16px; }
.note::before { content: ''; position: absolute; top: -8px; left: 50%; width: 70px; height: 18px; margin-left: -35px; background: #e6d9a8aa; transform: rotate(-3deg); }
.notepin .note { font-size: 13px; padding: 14px 16px; }

/* ---------- van ---------- */
#van { position: fixed; inset: 0; z-index: 10; background: radial-gradient(ellipse at 50% 30%, #2a241b, #0b0a08 70%); display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); overflow-y: auto; }
.van-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; max-width: 1100px; width: 100%; margin: 0 auto; }
.van-head h2 { font-family: 'Playfair Display', serif; font-style: italic; font-size: 32px; margin: 2px 0 0; color: var(--torch); }
.van-meta { text-align: right; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.vfill { font-size: 22px; }
.vclock { font-size: 13px; color: var(--dim); letter-spacing: .06em; }
.van-body { flex: 1; display: flex; gap: 24px; align-items: flex-start; justify-content: center; max-width: 1100px; width: 100%; margin: 18px auto; }
.van-body.portrait { flex-direction: column; align-items: center; }
.van-bed { background: #1a1612; padding: 14px; border-radius: 6px; box-shadow: inset 0 0 0 3px #3a3226, 0 20px 50px #000; }
.grid { position: relative; background-color: #6e5536; background-image: linear-gradient(#0000 calc(var(--cs) - 1px), #00000040 0), linear-gradient(90deg, #0000 calc(var(--cs) - 1px), #00000040 0), repeating-linear-gradient(90deg, #7a5f3d 0 37px, #6a5133 37px 40px); background-size: var(--cs) var(--cs), var(--cs) var(--cs), auto; }
.doors { text-align: center; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #8d7c62; margin-top: 8px; }
.piece { position: absolute; cursor: grab; touch-action: none; }
.tray .piece { position: relative; flex: none; }
.piece.rolled { border-radius: 999px; background: linear-gradient(#d8ccb0, #b9aa86 45%, #8c7c5c); box-shadow: 0 3px 6px #0008, inset 0 0 0 1px #0003; display: grid; place-items: center; overflow: hidden; }
.piece.rolled.vert { background: linear-gradient(90deg, #d8ccb0, #b9aa86 45%, #8c7c5c); }
.piece.rolled .tag { font-family: var(--hand); font-size: 11px; color: #3a2e1c; white-space: nowrap; overflow: hidden; max-width: 92%; text-overflow: ellipsis; }
.piece.rolled.vert .tag { writing-mode: vertical-rl; max-height: 92%; }
.piece.flat { background: linear-gradient(135deg, #6e5220, #c9a24e 35%, #8a6a2a 60%, #5a4218); padding: 6%; box-shadow: 0 4px 10px #000a; display: grid; place-items: center; overflow: hidden; }
.piece.flat.wood { background: linear-gradient(135deg, #5b4127, #7d5a36); }
.piece.flat.copper_other_rigid { background: linear-gradient(135deg, #8a4f2a, #d48a55 40%, #7a4020); }
.piece .art { width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; }
.piece .art img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.piece .art.rot img { transform: rotate(90deg); width: auto; height: auto; max-width: none; }
.piece.ghost { pointer-events: none; z-index: 30; filter: drop-shadow(0 10px 18px #000); }
.shadow { position: absolute; background: #6ee08a44; box-shadow: inset 0 0 0 2px #6ee08a; pointer-events: none; }
.shadow.bad { background: #ff5a4644; box-shadow: inset 0 0 0 2px var(--alert); }
.tray { width: 280px; flex: none; }
.van-body.portrait .tray { width: 100%; max-width: 520px; }
.tray-h { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; font-weight: 600; }
.tray-items { display: flex; flex-direction: column; gap: 12px; }
.tray-slot { display: flex; gap: 12px; align-items: center; background: #ffffff08; padding: 10px; border-radius: 4px; }
.tray-cap { display: flex; flex-direction: column; font-size: 14px; line-height: 1.25; }
.tray-cap b { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 13px; }
.tray-cap span { color: var(--dim); font-size: 13px; }
.tray-cap em { color: var(--alert); font-style: normal; font-size: 13px; }
.tray-empty { color: var(--dim); font-size: 15px; }
.tray-tip { color: var(--dim); font-size: 14px; }
.van-foot { display: flex; gap: 12px; justify-content: center; }

@media (max-width: 760px) {
  .hud-top { flex-wrap: wrap; gap: 8px; }
  .strip { order: 3; flex-basis: 100%; height: 16px; }
  .strip .seg { font-size: 9px; }
  .hud-r { margin-left: auto; gap: 6px; font-size: 13px; }
  .litflag { min-width: 0; font-size: 11px; padding: 2px 5px; }
  .labelcard { width: min(300px, calc(100% - 20px)); top: 124px; right: 10px; }
  .lab { padding: 8px 10px; font-size: 11.5px; }
  .lab-artist { font-size: 12.5px; }
  .pencil { font-size: 12.5px; }
  .actions button { min-width: 92px; min-height: 52px; font-size: 16px; padding: 4px 10px; }
  .iconbtn { width: 34px; height: 34px; }
  .toast { top: 96px; font-size: 15px; }
}
@media (max-height: 460px) {
  .labelcard { top: 60px; width: 220px; }
  .lab { padding: 7px 10px; font-size: 11px; }
  .lab-med { display: none; }
  .actions { padding-bottom: 6px; }
  .actions button { min-height: 46px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .van-head h2 { font-size: 22px; }
  .van-body { margin: 8px auto; }
  #van { padding-top: 8px; padding-bottom: 8px; }
}
