/* Topdesk — exercise-book paper, navy line-art, one highlighter-yellow accent. The top card IS the desk and the
   outbid slip; receipts for every bump stack under it. The CA hangs in a margin on the right edge at every width. */
:root {
  --ground: #F4F2EB; --ground-2: #FCFBF7; --ground-3: #E9E6DB; --rule: rgba(64, 104, 168, .13); --line: #2B3A55;
  --ink: #1B2030; --ink-2: #4D5566; --ink-3: #7E8697;
  --pencil: #F7C548; --pencil-ink: #2A2004; --refund: #1E7F55; --rail: #1B2030; --rail-ink: #F4F2EB;
  --f-disp: 'Familjen Grotesk', 'Geist', system-ui, sans-serif; --f-body: 'Geist', system-ui, sans-serif; --f-mono: 'Geist Mono', ui-monospace, monospace;
  --marginW: 44px;
}
* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; color: var(--ink); font: 400 15px/1.5 var(--f-body); overflow-x: hidden; padding-right: calc(var(--marginW) + 4px);
  background: linear-gradient(to right, transparent 5px, rgba(214, 72, 72, .35) 5px 6px, transparent 6px), repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px), var(--ground); }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
code { font-family: var(--f-mono); }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }

/* ---------- the margin: the CA, fixed to the right edge ---------- */
.margin { position: fixed; z-index: 50; right: 0; top: 50%; transform: translateY(-50%); width: var(--marginW);
  display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 12px 5px;
  background: var(--rail); color: var(--rail-ink); border: 0; border-radius: 12px 0 0 12px;
  box-shadow: -4px 4px 0 rgba(27, 32, 48, .14); }
.margin::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; border-left: 1px dashed rgba(247, 197, 72, .45); }
.margin-k { writing-mode: vertical-rl; font: 600 9.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--pencil); }
.margin-ca { writing-mode: vertical-rl; font: 500 10.5px/1.1 var(--f-mono); color: var(--rail-ink); white-space: nowrap; user-select: all; -webkit-user-select: all; }
.margin-ca.is-wait { color: #A9B0BF; font-style: italic; user-select: none; -webkit-user-select: none; }
.margin-copy { border: 0; border-radius: 7px; background: var(--pencil); color: var(--pencil-ink); font: 600 10px/1 var(--f-mono); width: 34px; padding: 9px 0; }
.margin-copy:disabled { background: #343B4F; color: #A9B0BF; cursor: default; }
.margin-copy.is-done { background: #9FE3C1; color: #06281A; }
.margin-gm { font: 500 9.5px/1 var(--f-mono); color: #C9CEDA; writing-mode: vertical-rl; }

/* ---------- frame ---------- */
.room { max-width: 1180px; margin: 0 auto; padding: 10px 10px 30px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.room-a, .room-b { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- the top card: the desk + the outbid slip ---------- */
.topcard { position: relative; background: var(--ground-2); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px 16px;
  box-shadow: 0 14px 0 -6px var(--ground-2), 0 14px 0 -5px rgba(43, 58, 85, .55), 0 26px 0 -12px var(--ground-2), 0 26px 0 -11px rgba(43, 58, 85, .3); margin-bottom: 18px; }
.topcard-strip { display: flex; align-items: center; gap: 10px; }
.badge { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font: 700 15px/1 var(--f-disp); letter-spacing: -.01em; }
.badge img { border-radius: 7px; border: 1px solid var(--line); }
.deskno { font: 500 11px/1 var(--f-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.hook { margin-left: auto; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font: 500 12.5px/1 var(--f-body); }
.hook.is-on { border-color: var(--pencil); color: var(--pencil); }

.moment { margin: 14px 0 6px; font: 600 21px/1.18 var(--f-disp); letter-spacing: -.015em; }
.moment b { font-weight: 700; background: linear-gradient(transparent 52%, var(--pencil) 52% 92%, transparent 92%); padding: 0 2px; }
.moment code { font-size: .82em; color: var(--ink); background: var(--ground-3); padding: 1px 6px; border-radius: 6px; }

/* the desk, drawn in lines */
.scene { position: relative; height: 208px; margin: 6px 0 4px; }
.plate { position: absolute; left: 50%; bottom: 82px; transform: translateX(-50%); min-width: 62%; max-width: 92%; text-align: center;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--ground-2); padding: 8px 14px 9px; box-shadow: 3px 3px 0 var(--pencil); }
.plate-k { display: block; font: 500 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.plate-who { display: block; margin-top: 5px; font: 500 17px/1.1 var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.plate-bid { display: block; margin-top: 4px; font: 700 22px/1 var(--f-disp); color: var(--ink); }
.plate-bid small { font: 500 11px/1 var(--f-mono); color: var(--ink-2); }
.plate.is-empty { border-style: dashed; animation: beckon 1.8s ease-in-out infinite; }
.plate.is-empty .plate-who { color: var(--ink-2); }
.plate.is-bumped { animation: bump .9s cubic-bezier(.2, .7, .2, 1); }
@keyframes beckon { 50% { box-shadow: 3px 3px 0 var(--pencil), 0 0 0 8px rgba(247, 197, 72, .35); } }
@keyframes bump { 0% { transform: translate(-50%, -26px) rotate(-3deg); opacity: .2; } 60% { transform: translate(-50%, 4px) rotate(.5deg); opacity: 1; } 100% { transform: translate(-50%, 0); } }
.desktop-line { position: absolute; left: 8%; right: 8%; bottom: 66px; height: 14px; border: 1.5px solid var(--line); border-radius: 4px 4px 2px 2px; }
.legs { position: absolute; left: 13%; right: 13%; bottom: 10px; height: 56px; display: flex; justify-content: space-between; }
.legs i { width: 12px; border: 1.5px solid var(--line); border-top: 0; border-radius: 0 0 3px 3px; }
.dropchip { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1.5px solid var(--refund); color: var(--refund); border-radius: 999px; padding: 5px 14px; background: var(--ground-2); white-space: nowrap; }
.dropchip span { font: 500 9.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.dropchip b { font: 600 15px/1.1 var(--f-mono); }
.dropchip.is-quiet { border-color: var(--ink-3); color: var(--ink-2); }
.clock { position: absolute; right: 0; top: 0; font: 500 11px/1 var(--f-mono); color: var(--ink-2); border: 1px solid rgba(43, 58, 85, .25); background: var(--ground); border-radius: 6px; padding: 5px 7px; }

.liveline { margin: 8px 0 12px; font-size: 14.5px; color: var(--ink-2); }
.liveline b { color: var(--ink); }
.liveline code { color: var(--ink); }

.bidrow { display: block; }
.bidrow-k { display: block; font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin-bottom: 6px; }
.bidrow-in { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; background: #FFFFFF; padding: 0 12px; }
.bidrow-in:focus-within { box-shadow: 0 0 0 4px rgba(247, 197, 72, .55); }
.bidrow-in input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 600 26px/1 var(--f-mono); padding: 12px 0; outline: none; }
.bidrow.is-first .bidrow-in { box-shadow: 0 0 0 4px rgba(247, 197, 72, .6); }
.unit { font: 500 12px/1 var(--f-mono); color: var(--ink-3); }
.outbid { width: 100%; margin-top: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--pencil); color: var(--pencil-ink); box-shadow: 3px 3px 0 var(--line); font: 700 17px/1 var(--f-disp); padding: 16px; letter-spacing: -.01em; }
.outbid:disabled { opacity: .45; cursor: default; }

.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.split div { border-top: 1px dashed var(--line); padding-top: 7px; min-width: 0; }
.split dt { font: 500 10px/1.25 var(--f-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.split dd { margin: 4px 0 0; font: 600 15px/1.2 var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.split div:first-child dd { color: var(--refund); }
.slipnote { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.owed { margin-top: 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--refund); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.owed button { border: 0; border-radius: 8px; background: var(--refund); color: #FFFFFF; padding: 7px 11px; font-weight: 600; }

/* ---------- rules card ---------- */
.howcard { background: var(--ground-2); border: 1px solid rgba(43, 58, 85, .2); border-radius: 14px; padding: 14px 16px; }
.howcard h3, .pile-head h3 { margin: 0 0 8px; font: 700 16px/1.2 var(--f-disp); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; color: var(--ink-2); font-size: 14px; }
.steps b { color: var(--ink); }
.worked { margin-top: 12px; border: 1.5px dashed var(--line); background: rgba(247, 197, 72, .14); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--ink-2); }
.worked p { margin: 4px 0 0; }
.worked b { color: var(--ink); font-family: var(--f-mono); font-weight: 600; }
.worked-k { font: 600 10px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink); }

/* ---------- receipts: one card per play, newest on top ---------- */
.pile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pile-head span { font: 500 11px/1 var(--f-mono); color: var(--ink-3); }
.pile { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rcpt { background: #FFFFFF; color: #1A1F2C; filter: drop-shadow(0 1px 0 rgba(43, 58, 85, .35)); border-radius: 4px; padding: 9px 12px 10px; font: 400 12.5px/1.45 var(--f-mono);
  -webkit-mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 0 0 / 14px 100% repeat-x; mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 0 0 / 14px 100% repeat-x; padding-bottom: 14px; }
.rcpt-top { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: #5C6577; text-transform: uppercase; letter-spacing: .06em; }
.rcpt-line { display: flex; justify-content: space-between; gap: 10px; }
.rcpt-line span:last-child { text-align: right; overflow-wrap: anywhere; }
.rcpt-sum { border-top: 1px dashed #9AA2B1; margin-top: 5px; padding-top: 5px; font-weight: 600; }
.rcpt.is-bump .rcpt-sum span:last-child { background: var(--pencil); padding: 0 4px; border-radius: 3px; }
.rcpt.is-close { background: #E3F4EA; }
.rcpt.is-open { background: #E6EAF1; }
.rcpt.is-print { animation: print .7s ease-out; }
@keyframes print { from { transform: translateY(-14px); opacity: 0; clip-path: inset(0 0 100% 0); } to { transform: none; opacity: 1; clip-path: inset(0 0 0 0); } }
.rcpt.is-blank { background: transparent; color: var(--ink-2); border: 1.5px dashed var(--line); -webkit-mask: none; mask: none; padding: 12px; }
.rcpt.is-blank b { color: var(--ink); background: var(--pencil); padding: 0 3px; }
.pastdesks { font: 400 12.5px/1.5 var(--f-mono); color: var(--ink-3); }
.pastdesks a { color: var(--ink-2); }

/* ---------- colophon ---------- */
.colophon { border-top: 1px solid rgba(43, 58, 85, .2); padding-top: 14px; font-size: 12.5px; color: var(--ink-3); display: grid; gap: 4px; }
.colophon code { color: var(--ink-2); overflow-wrap: anywhere; }
.colophon nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.colophon nav a { color: var(--ink-2); }

/* ---------- drawer + toast ---------- */
.drawer { position: fixed; inset: 0; z-index: 80; background: rgba(27, 32, 48, .45); display: flex; align-items: flex-end; justify-content: center; }
.drawer-card { width: min(560px, 100%); max-height: 80vh; overflow: auto; background: var(--ground-2); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 14px 16px 20px; }
.drawer-top { display: flex; justify-content: space-between; align-items: center; font: 700 16px/1 var(--f-disp); margin-bottom: 10px; }
.drawer-top button { background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 12px; }
.pick { display: grid; gap: 8px; }
.pick button { display: flex; align-items: center; gap: 10px; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); padding: 10px 12px; }
.pick img { width: 24px; height: 24px; }
.list { margin: 0; padding-left: 18px; font: 400 13px/1.6 var(--f-mono); color: var(--ink-2); }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--rail); color: var(--rail-ink); border-radius: 10px; padding: 10px 16px; font-size: 14px; max-width: 86vw; }

/* ---------- tablet: wider measure, bigger desk ---------- */
@media (min-width: 700px) {
  :root { --marginW: 52px; }
  .margin-ca { font-size: 12px; }
  .room { padding: 22px 22px 40px; gap: 22px; }
  .topcard { padding: 16px 22px 22px; }
  .moment { font-size: 28px; }
  .scene { height: 244px; }
  .plate { bottom: 96px; min-width: 46%; }
  .plate-who { font-size: 19px; }
  .plate-bid { font-size: 27px; }
  .desktop-line { bottom: 78px; height: 16px; }
  .legs { height: 66px; }
  .bidrow-in input { font-size: 30px; }
  .split dd { font-size: 18px; }
  .rcpt { font-size: 13.5px; }
}

/* ---------- desktop: the margin opens into a rail; the desk and its receipts sit side by side ---------- */
@media (min-width: 1000px) {
  :root { --marginW: 214px; }
  body { padding-right: calc(var(--marginW) + 14px); }
  .margin { align-items: stretch; gap: 10px; padding: 18px 16px 16px 20px; }
  .margin-k, .margin-ca, .margin-gm { writing-mode: horizontal-tb; }
  .margin-k { font-size: 10.5px; }
  .margin-ca { white-space: normal; word-break: break-all; font-size: 13px; line-height: 1.45; }
  .margin-copy { width: auto; padding: 11px 0; font-size: 12px; }
  .margin-gm { font-size: 11px; align-self: flex-start; }
  .room { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 28px; padding: 30px 24px 44px; }
  .room-a { grid-column: 1; }
  .room-b { grid-column: 2; grid-row: 1; position: sticky; top: 22px; align-self: start; max-height: calc(100vh - 44px); overflow: auto; padding-right: 2px; }
  .colophon { grid-column: 1 / -1; }
  .moment { font-size: 34px; }
  .scene { height: 276px; }
  .plate { bottom: 108px; min-width: 40%; }
  .plate-who { font-size: 21px; }
  .plate-bid { font-size: 32px; }
  .desktop-line { bottom: 88px; height: 18px; left: 12%; right: 12%; }
  .legs { left: 16%; right: 16%; height: 76px; }
}
@media (min-width: 1360px) {
  .room { grid-template-columns: minmax(0, 1fr) 400px; }
  .moment { font-size: 38px; }
}
