/* 插队 — a street queue on raw paper. Heavy black rules, one signal orange, the line itself as the page. */
:root {
  --paper: #E8E6DF;
  --paper-2: #DEDBD2;
  --ink: #0D0D0B;
  --mute: #7A776F;
  --soft: #C9C6BC;
  --sig: #FF4A17;
  --num: 'Archivo Black', 'Noto Sans SC', sans-serif;
  --zh: 'Noto Sans SC', system-ui, sans-serif;
  --mono: 'Red Hat Mono', ui-monospace, monospace;
  --rule: 3px solid var(--ink);
}
* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto; max-width: 1200px; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 var(--zh); padding: 14px 16px 40px; overflow-x: hidden;
}
b { font-weight: 900; }
code { font-family: var(--mono); }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---- the number: what it takes to stand at #1 ---- */
.cutline { padding: 4px 0 10px; border-bottom: var(--rule); }
.cutline-k { margin: 0; font: 900 13px/1.3 var(--zh); letter-spacing: .04em; }
.cutline-k::before { content: ''; display: inline-block; width: 10px; height: 10px; background: var(--sig); margin-right: 8px; vertical-align: 0; }
.cutline-n {
  font: 400 108px/0.92 var(--num); letter-spacing: -.035em; margin: 6px 0 4px;
  white-space: nowrap; font-variant-numeric: tabular-nums; min-height: 60px;
}
.cutline-n.is-bump { animation: bump .5s cubic-bezier(.2,.9,.3,1.3); }
@keyframes bump { 0% { transform: translateY(-12px); color: var(--sig); } 100% { transform: none; } }
.cutline-u { margin: 0; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font: 600 12px/1.4 var(--mono); }
.cutline-tag { color: var(--mute); }

/* ---- the CA: a pill that pins as you scroll ---- */
.capill {
  position: sticky; top: 8px; z-index: 30; margin: 12px 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 7px 7px 7px 16px;
  box-shadow: 0 6px 0 var(--sig);
}
.capill-k { font: 400 13px/1 var(--num); color: var(--sig); }
.capill-addr { font-size: 10.5px; line-height: 1.3; word-break: break-all; user-select: all; }
.capill-addr.is-wait { color: var(--soft); user-select: none; }
.capill-copy {
  border: 0; border-radius: 999px; background: var(--sig); color: var(--ink); font-weight: 900; font-size: 13px;
  padding: 10px 14px; min-width: 58px;
}
.capill-copy:disabled { background: #3a3a36; color: var(--mute); cursor: default; }
.capill-copy.is-done { background: var(--paper); }
.capill-gm { grid-column: 2; font: 600 10px/1 var(--mono); color: var(--soft); text-decoration: underline; }

/* ---- the live sentence ---- */
.saying { margin: 4px 0 14px; font: 400 16px/1.6 var(--zh); }
.saying b { font-family: var(--num), var(--zh); font-weight: 400; }
.saying em { font-style: normal; background: var(--sig); padding: 0 3px; }

/* ---- the line itself ---- */
.street { border: var(--rule); background: #fff; }
.street-hd { display: flex; align-items: baseline; gap: 12px; padding: 8px 12px; border-bottom: var(--rule); background: var(--ink); color: var(--paper); }
.street-t { font: 900 15px/1 var(--zh); }
.street-clock { font: 400 15px/1 var(--num); color: var(--sig); font-variant-numeric: tabular-nums; }
.street-pot { margin-left: auto; font: 600 12px/1 var(--mono); }
.queue { list-style: none; margin: 0; padding: 0; }
.spot {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-areas: "pos who cut" "pos stake cut";
  align-items: center; column-gap: 10px; padding: 9px 10px 9px 0; border-bottom: 2px solid var(--ink); min-height: 62px;
  position: relative;
}
.spot:last-child { border-bottom: 0; }
.spot-pos { grid-area: pos; align-self: stretch; display: grid; place-items: center; font: 400 26px/1 var(--num); border-right: 2px solid var(--ink); }
.spot-who { grid-area: who; font: 600 12px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot-who i { font-style: normal; color: var(--mute); font-family: var(--zh); font-size: 11px; margin-left: 6px; }
.spot-stake { grid-area: stake; font: 400 19px/1.1 var(--num); }
.spot-stake small { font: 600 10px/1 var(--mono); color: var(--mute); margin-left: 4px; }
.spot-cut {
  grid-area: cut; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); padding: 6px 9px; text-align: right;
  display: grid; gap: 1px; font: 900 13px/1.15 var(--zh); min-width: 104px;
}
.spot-cut span { font: 600 10px/1.2 var(--mono); color: var(--mute); }
.spot-cut:hover, .spot-cut.is-aim { background: var(--sig); }
.spot-cut.is-aim span, .spot-cut:hover span { color: var(--ink); }
.spot.is-front { background: var(--sig); }
.spot.is-front .spot-pos { background: var(--ink); color: var(--sig); }
.spot.is-front .spot-who i, .spot.is-front .spot-stake small { color: var(--ink); }
.spot.is-front .spot-cut { background: #fff; }
.spot.is-me .spot-who::after { content: ' ← 你'; font-family: var(--zh); font-weight: 900; }
.spot.is-empty { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(13,13,11,.05) 8px 10px); }
.spot.is-empty .spot-pos { color: var(--soft); border-right-style: dashed; }
.spot.is-empty .spot-who { color: var(--mute); font-family: var(--zh); }
.spot.is-empty .spot-stake { color: var(--soft); }
.spot.is-gate { background: #fff; outline: 3px solid var(--sig); outline-offset: -3px; }
.spot.is-gate .spot-pos { color: var(--sig); }
.spot.is-gate .spot-who { color: var(--ink); font-weight: 900; }
.spot.is-new { animation: slidein .55s ease-out; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ghost {
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 10px 6px 56px; border-bottom: 2px solid var(--ink);
  background: var(--paper-2); font: 600 11px/1.4 var(--mono);
}
.ghost s { text-decoration-thickness: 2px; text-decoration-color: var(--sig); }
.ghost b { font-family: var(--num); font-weight: 400; }
.ghost.is-fresh { animation: shove .7s ease-out; }
@keyframes shove { from { transform: translateX(40px); background: var(--sig); } to { transform: none; } }
.street-ft { margin: 0; padding: 8px 12px; border-top: var(--rule); font-size: 12px; color: var(--mute); }

/* ---- the ticket: the action ---- */
.ticket { margin: 16px 0 0; border: var(--rule); background: var(--paper-2); padding: 12px; }
.ticket-hd { display: flex; justify-content: space-between; gap: 8px; font: 900 15px/1.3 var(--zh); }
.ticket-bal { font: 600 11px/1.3 var(--mono); color: var(--mute); }
.ticket-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-top: 10px; }
.ticket-in {
  width: 100%; min-width: 0; border: var(--rule); background: #fff; padding: 10px 10px; font: 400 22px/1 var(--num); color: var(--ink);
  border-radius: 0; outline: none;
}
.ticket-in:focus { border-color: var(--sig); }
.ticket-tk { font: 600 11px/1 var(--mono); }
.ticket-go { border: var(--rule); background: var(--ink); color: var(--paper); padding: 12px 14px; font: 900 15px/1 var(--zh); }
.ticket-go:not(:disabled):hover { background: var(--sig); color: var(--ink); }
.ticket-go:disabled { opacity: .45; cursor: default; }
.ticket-math { margin: 10px 0 0; font-size: 13px; }
.ticket-math b { font-family: var(--num); font-weight: 400; }
.ticket-owed { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 2px solid var(--ink); padding-top: 10px; }
.ticket-owed button { border: var(--rule); background: var(--sig); padding: 8px 12px; font-weight: 900; }

/* ---- the second pane ---- */
.side { margin-top: 22px; display: grid; gap: 18px; }
.eg { border: var(--rule); padding: 12px 14px; background: #fff; }
.eg-t, .rulebox-t { margin: 0 0 6px; font: 400 18px/1 var(--num); text-transform: uppercase; }
.eg-t::after { content: ' / 例'; font-family: var(--zh); font-weight: 900; color: var(--sig); }
.eg-ls { margin: 0; padding-left: 20px; font-size: 13.5px; }
.eg-ls li { margin: 4px 0; }
.eg-ls b { font-family: var(--num), var(--zh); font-weight: 400; }
.feed { border: var(--rule); background: var(--ink); color: var(--paper); }
.feed-hd { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 2px solid #3a3a36; font: 900 14px/1 var(--zh); }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sig); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.feed-sub { margin-left: auto; font: 600 11px/1 var(--mono); color: var(--mute); }
.feed-ls { list-style: none; margin: 0; padding: 4px 0; max-height: 360px; overflow-y: auto; }
.feed-ls li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 6px 12px; font: 400 12px/1.45 var(--mono); border-bottom: 1px dashed #3a3a36; }
.feed-ls li:last-child { border-bottom: 0; }
.feed-ls time { color: var(--mute); }
.feed-ls .is-cut span { color: var(--sig); }
.feed-ls .is-eg { opacity: .55; }
.feed-ls .is-quiet { display: block; color: var(--soft); font-family: var(--zh); }
.feed-ls .is-print span { animation: print .6s steps(18); overflow: hidden; }
@keyframes print { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.rulebox { border: var(--rule); padding: 12px 14px; }
.rulebox-dl { margin: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px 10px; font-size: 13.5px; }
.rulebox-dl dt { font-weight: 900; }
.rulebox-dl dd { margin: 0; }
.done-ls { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 2px solid var(--ink); font-size: 12.5px; }
.done-ls li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.done-ls .is-quiet { color: var(--mute); }

.colo { margin-top: 26px; border-top: var(--rule); padding-top: 12px; font-size: 12px; display: grid; gap: 4px; }
.colo code { word-break: break-all; font-size: 11px; }
.colo nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-weight: 900; }

.sheet-x { position: fixed; inset: 0; z-index: 60; background: rgba(13,13,11,.55); display: grid; place-items: center; padding: 16px; }
.sheet-x[hidden] { display: none; }
.sheet-card { background: var(--paper); border: var(--rule); width: min(520px, 100%); max-height: 80vh; overflow: auto; padding: 14px; }
.sheet-hd { display: flex; justify-content: space-between; font-weight: 900; margin-bottom: 10px; }
.sheet-hd button { border: 2px solid var(--ink); background: none; padding: 2px 8px; }
.purse-ls { display: grid; gap: 8px; }
.purse-ls button { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); background: #fff; padding: 10px; font-weight: 900; }
.purse-ls img { width: 24px; height: 24px; }
.flash { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--paper); padding: 10px 16px; font-weight: 900; border: 2px solid var(--sig); }

/* ---- tablet: one column, a wider measure, bigger type ---- */
@media (min-width: 640px) {
  body { padding: 22px 32px 48px; font-size: 16px; }
  .cutline-n { font-size: 150px; }
  .capill-addr { font-size: 13px; }
  .spot { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "pos who stake cut"; min-height: 70px; }
  .spot-pos { font-size: 32px; }
  .spot-stake { font-size: 24px; }
  .ghost { padding-left: 74px; font-size: 12px; }
  .saying { font-size: 18px; }
  .side { grid-template-columns: 1fr 1fr; }
  .feed { grid-column: 1 / -1; }
}

/* ---- desktop: split pane — the line and the action left, the example, the tape and the rules right ---- */
@media (min-width: 1000px) {
  body {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); column-gap: 36px;
    grid-template-areas: "num side" "ca side" "say side" "street side" "ticket side" "colo colo";
    grid-template-rows: auto auto auto auto 1fr auto; align-items: start; padding-top: 28px;
  }
  .cutline { grid-area: num; }
  .capill { grid-area: ca; }
  .saying { grid-area: say; font-size: 19px; }
  .street { grid-area: street; }
  .ticket { grid-area: ticket; }
  .side { grid-area: side; margin-top: 0; grid-template-columns: 1fr; position: sticky; top: 16px; border-left: var(--rule); padding-left: 36px; min-height: 80vh; }
  .colo { grid-area: colo; }
  .cutline-n { font-size: 176px; }
  .feed { grid-column: auto; }
  .feed-ls { max-height: 300px; }
}
.spot.is-gate .spot-stake { color: var(--ink); }
