:root { --g: #4aff84; --d: #27a557; --l: rgba(74,255,132,.24); --k: #000; --w: #fff; --pad: 20px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #000; color: var(--g); font: 400 16px/1.35 "B612", system-ui, sans-serif; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { overflow-x: hidden; }
button, input { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--w); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
canvas { display: block; width: 100%; }
b { font-weight: 700; }

/* ---- monitor ---- */
.mon { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0,1fr) 340px; grid-template-rows: 64px minmax(0,1fr) 104px 60px;
  grid-template-areas: "bar bar" "lead vit" "strip vit" "keys keys"; background: radial-gradient(circle at 1px 1px, rgba(74,255,132,.17) 1px, transparent 1.4px) 0 0 / 48px 48px, #000; }
.bar { grid-area: bar; display: flex; align-items: center; gap: 24px; padding: 0 var(--pad); border-bottom: 1px solid var(--l); background: #000; }
.name { font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.bar form { flex: 1; display: flex; justify-content: center; }
.bar input { width: min(520px, 100%); height: 42px; padding: 0 14px; border: 2px solid var(--g); font: 400 15px "B612 Mono", monospace; background: #000; caret-color: var(--w); }
.bar input::placeholder { color: var(--d); opacity: 1; }
.bar form button { height: 42px; padding: 0 18px; background: var(--g); color: #000; font-weight: 700; white-space: nowrap; }
.bar form button:hover { background: var(--w); }
.clock { font-size: 18px; color: var(--d); font-variant-numeric: tabular-nums; }

.lead { grid-area: lead; position: relative; display: flex; flex-direction: column; min-height: 0; }
.q { padding: 20px var(--pad) 0; display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap; }
h1 { font-size: clamp(30px, 4.4vw, 64px); line-height: 1; letter-spacing: -.025em; font-weight: 700; }
.ans { font-size: clamp(64px, 12.4vw, 190px); line-height: .84; letter-spacing: -.05em; font-weight: 700; }
.alarm { font: 700 clamp(18px, 2vw, 28px) "B612 Mono", monospace; margin-left: auto; align-self: center; }
.who { padding: 12px var(--pad) 0; font: 400 15px "B612 Mono", monospace; color: var(--g); min-height: 34px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who em { font-style: normal; color: var(--d); }
.scope { flex: 1; position: relative; min-height: 240px; }
.scope canvas { position: absolute; inset: 0; height: 100%; }
.note { position: absolute; left: var(--pad); bottom: 14px; font-size: 14px; max-width: 60ch; background: #000; }
.note:empty { display: none; }
.note button { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; padding: 6px 4px; }

.vit { grid-area: vit; border-left: 1px solid var(--l); display: grid; grid-template-rows: 1.5fr 1fr 1fr 1fr; background: #000; }
.v { position: relative; padding: 14px 20px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--l); min-width: 0; }
.v:last-child { border-bottom: 0; }
.v .l { font: 700 13px "B612 Mono", monospace; letter-spacing: .06em; color: var(--d); }
.v .u { font-size: 13px; color: var(--d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v b { font-size: 72px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v1 b { font-size: 150px; line-height: .9; letter-spacing: -.07em; }
.v1 b.long { font-size: 112px; } .v b.long { font-size: 54px; }
.dot { position: absolute; right: 20px; top: 20px; width: 20px; height: 20px; border-radius: 50%; background: var(--g); opacity: .18; }
.dot.on { opacity: 1; }

.stripw { grid-area: strip; position: relative; border-top: 1px solid var(--l); background: #000; }
.stripw canvas { height: 100%; position: absolute; inset: 0; cursor: crosshair; touch-action: pan-y; }
.read { position: absolute; left: var(--pad); top: 8px; font: 400 13px "B612 Mono", monospace; pointer-events: none; background: #000; padding-right: 8px; max-width: calc(100% - 2*var(--pad)); }
.keys { grid-area: keys; display: flex; border-top: 1px solid var(--l); background: #000; overflow-x: auto; scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.keys button { padding: 0 20px; min-height: 59px; border-right: 1px solid var(--l); white-space: nowrap; font-size: 15px; }
.keys button:hover { background: var(--g); color: #000; }
.keys button[aria-pressed=true] { background: var(--g); color: #000; font-weight: 700; }
.keys button:focus-visible { outline-offset: -4px; }
.picks { margin-left: auto; display: flex; }
.picks button { border-right: 0; border-left: 1px solid var(--l); font-family: "B612 Mono", monospace; }

/* alarm: the top of the monitor turns hard white */
body[data-st=dead] .q { background: var(--w); color: #000; padding-bottom: 16px; }
body[data-st=dead] .who { color: var(--w); } body[data-st=dead] .who em { color: #b9b9b9; }
body[data-st=dead] .v1 b, body[data-st=dead] .v:nth-child(2) b { color: var(--w); }
body[data-st=dead] .v1 .l, body[data-st=dead] .v:nth-child(2) .l { color: var(--w); }
body[data-st=dead] .dot { background: var(--w); }
body[data-st=lost] .ans, body[data-st=wait] .ans { color: var(--d); }
@keyframes blink { 50% { background: #000; color: #fff; } }
body[data-st=dead] .alarm { animation: blink 1s steps(1) infinite; padding: 8px 14px; background: #000; color: #fff; }
@keyframes blinkw { 0%,49% { background: #000; color: #fff } 50%,100% { background: #fff; color: #000 } }
body[data-st=dead] .alarm { animation: blinkw 1s steps(1) infinite; border: 3px solid #000; }

/* ---- tap ---- */
.tap { border-top: 1px solid var(--l); min-height: 100svh; display: flex; flex-direction: column; }
.taph { padding: 56px var(--pad) 28px; display: flex; align-items: baseline; gap: 40px; flex-wrap: wrap; }
h2 { font-size: clamp(38px, 6.6vw, 104px); letter-spacing: -.045em; line-height: .95; font-weight: 700; }
.line { font-size: 18px; max-width: 34ch; }
.pad { position: relative; flex: 1; min-height: 440px; border-top: 1px solid var(--l); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pad canvas { position: absolute; inset: 0; height: 100%; pointer-events: none; z-index: 1; }
.half { position: absolute; left: 0; right: 0; text-align: left; font-weight: 700; font-size: clamp(40px, 9vw, 140px); letter-spacing: -.05em; line-height: 1; color: var(--g); -webkit-touch-callout: none; }
.half span { position: absolute; left: var(--pad); }
.buy { top: 0; height: 60%; } .buy span { top: 18px; }
.sell { top: 60%; bottom: 0; } .sell span { bottom: 14px; }
@media (hover: hover) { .half:hover { background: rgba(74,255,132,.09); } .tap.dead .half:hover { background: rgba(0,0,0,.06); } }
.half.on { background: var(--g); color: #000; }
.sell { border-top: 1px dashed var(--l); }
.half:focus-visible { outline-offset: -5px; }
.pad .big { position: absolute; right: var(--pad); top: 14px; font-size: clamp(80px, 17vw, 260px); line-height: .86; font-weight: 700; letter-spacing: -.07em; pointer-events: none; z-index: 2; font-variant-numeric: tabular-nums; }
.pad .cap { position: absolute; right: var(--pad); top: calc(14px + clamp(72px, 15.6vw, 240px)); font-size: 15px; z-index: 2; pointer-events: none; color: var(--d); }
.tap.dead .pad { background: #fff; color: #000; }
.tap.dead .half { color: #000; border-color: #000; } .tap.dead .half.on { background: #000; color: #fff; } .tap.dead .pad .cap { color: #000; }

/* ---- ward ---- */
.ward { border-top: 1px solid var(--l); display: grid; grid-template-columns: 360px minmax(0,1fr); }
.wardh { padding: 56px var(--pad); position: sticky; top: 0; align-self: start; }
.wardh .line { margin-top: 16px; }
.cnt { font-size: 150px; font-weight: 700; letter-spacing: -.07em; line-height: .9; margin-top: 40px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cnt.long { font-size: 100px; }
.cap { font-size: 15px; color: var(--d); }
.wardh button { margin-top: 28px; padding: 14px 20px; border: 2px solid var(--g); font-weight: 700; }
.wardh button:hover { background: var(--g); color: #000; }
.fine { font-size: 13px; color: var(--d); margin-top: 16px; max-width: 44ch; }
.beds { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-content: start; border-left: 1px solid var(--l); min-height: 680px; }
.beds li { border-right: 1px solid var(--l); border-bottom: 1px solid var(--l); min-width: 0; }
.bed { width: 100%; text-align: left; padding: 14px 16px 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; align-items: end; min-height: 168px; align-content: space-between; }
.bed:hover { background: rgba(74,255,132,.08); }
.bed:focus-visible { outline-offset: -4px; }
.bed .s { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: start; }
.bed .p { font-size: 40px; font-weight: 700; letter-spacing: -.05em; line-height: .9; font-variant-numeric: tabular-nums; align-self: start; }
.bed canvas { grid-column: 1 / -1; height: 74px; }
.bed .a, .bed .m { font: 400 13px "B612 Mono", monospace; color: var(--d); }
.bed .m { text-align: right; }
.bed.dead { color: #fff; } .bed.dead .a, .bed.dead .m { color: #c4c4c4; }
.bed.dead .m { background: #fff; color: #000; padding: 1px 6px; font-weight: 700; }
.bed.none { color: var(--d); }

/* ---- how ---- */
.how { border-top: 1px solid var(--l); padding: 72px 0 64px; }
.how canvas { height: clamp(180px, 25vw, 340px); }
.how ol { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 var(--pad); gap: 24px; }
.how li { font-size: 17px; max-width: 34ch; color: var(--d); }
.how li b { display: block; font-size: clamp(22px, 2.3vw, 34px); letter-spacing: -.025em; color: var(--g); }
.how li:last-child b { color: #fff; }

/* ---- footer ---- */
.foot { border-top: 1px solid var(--l); padding: 40px var(--pad) 48px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px 40px; align-items: end; }
.fw { grid-column: 1 / -1; position: relative; margin: 0 calc(-1*var(--pad)); padding: 0 var(--pad) 12px; }
.fw canvas { position: absolute; inset: 0; height: 100%; }
.fname { position: relative; font-size: clamp(64px, 15vw, 220px); font-weight: 700; letter-spacing: -.07em; line-height: 1; overflow-wrap: anywhere; }
.fl { font-size: 18px; }
.fk { display: flex; flex-wrap: wrap; gap: 12px; }
.key { display: inline-flex; align-items: center; min-height: 50px; padding: 0 20px; border: 2px solid var(--g); font-weight: 700; text-decoration: none; }
.key[hidden] { display: none; }
.key:hover { background: var(--g); color: #000; }
.foot .fine { grid-column: 1 / -1; max-width: 80ch; margin-top: 4px; }

@media (max-width: 900px) {
  :root { --pad: 16px; }
  .mon { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto 72px 54px; grid-template-areas: "bar" "lead" "vit" "strip" "keys"; }
  .bar { flex-wrap: wrap; gap: 8px 12px; padding: 10px var(--pad) 10px; }
  .name { flex: 1; font-size: 20px; } .clock { font-size: 15px; }
  .bar form { order: 3; flex: 0 0 100%; }
  .bar input { flex: 1; min-width: 0; height: 44px; font-size: 16px; } .bar form button { height: 44px; padding: 0 14px; font-size: 15px; }
  .q { padding-top: 14px; gap: 2px 14px; }
  h1 { font-size: 30px; flex: 0 0 100%; } .ans { font-size: 84px; }
  .alarm { margin-left: auto; font-size: 16px; align-self: center; text-align: center; }
  .alarm span { display: block; }
  .who { font-size: 13px; padding-top: 8px; min-height: 28px; }
  .scope { min-height: 150px; }
  .vit { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; border-left: 0; border-top: 1px solid var(--l); }
  .v { padding: 9px var(--pad); border-right: 1px solid var(--l); } .v:nth-child(2n) { border-right: 0; } .v:nth-child(3) { border-bottom: 0; }
  .v b, .v b.long { font-size: 40px; } .v b.long { font-size: 30px; } .v1 b, .v1 b.long { font-size: 64px; } .v1 b.long { font-size: 52px; }
  .v .u { font-size: 12px; } .v .l { font-size: 12px; }
  .dot { right: 16px; top: 14px; width: 14px; height: 14px; }
  .read { font-size: 12px; top: 3px; }
  .keys button { min-height: 53px; padding: 0 16px; font-size: 14px; } .picks { margin-left: 0; }
  .taph { padding: 44px var(--pad) 20px; gap: 10px; }
  .ward { grid-template-columns: minmax(0,1fr); }
  .wardh { position: static; padding: 44px var(--pad) 24px; display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: end; }
  .wardh h2, .wardh .line, .wardh .fine { grid-column: 1 / -1; } .cnt { margin-top: 24px; font-size: 84px; } .cnt.long { font-size: 64px; }
  .wardh .cap { grid-column: 1; } .wardh button { grid-column: 2; grid-row: 3 / span 2; margin: 0; }
  .beds { grid-template-columns: 1fr 1fr; border-top: 1px solid var(--l); border-left: 0; min-height: 900px; }
  .bed { padding: 12px; min-height: 148px; } .bed .p { font-size: 30px; } .bed .s { font-size: 16px; } .bed canvas { height: 50px; }
  .bed .a, .bed .m { font-size: 12px; }
  .how { padding: 40px 0 44px; } .how canvas { height: 560px; }
  .how ol { display: block; position: relative; margin-top: -560px; height: 560px; }
  .how li { position: absolute; left: var(--pad); right: var(--pad); max-width: none; }
  .how li:nth-child(1) { top: 0; } .how li:nth-child(2) { top: 190px; } .how li:nth-child(3) { top: 380px; }
  .foot { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 900px) and (max-height: 760px) { .ans { font-size: 64px; } .scope { min-height: 120px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } body[data-st=dead] .alarm { animation: none; background: #000; color: #fff; } }
