/* StandLink — one stylesheet, no web fonts (venue Wi-Fi is slow; system type
   renders instantly). The visual language comes from the building itself:
   navy wayfinding plates for stand names, hazard striping for urgent. */

:root {
  --concrete: #eef1ee;
  --card: #ffffff;
  --ink: #10233f;
  --ink-soft: #4a5870;
  --line: #d3dad6;
  --amber: #f5b301;
  --amber-soft: #fff4cf;
  --go: #177245;
  --go-soft: #dcf1e5;
  --route: #2456c8;
  --stop: #b3261e;
  --radius: 10px;
  --tap: 48px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--concrete);
  color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { height: 100%; height: 100dvh; display: flex; flex-direction: column; }

h1, h2, h3, p { margin: 0; }
h2 { font-size: 1rem; font-weight: 800; margin: 22px 0 8px; }
.pane > h2:first-child { margin-top: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--route); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---- the plate: a stand name set like a concourse sign ------------------ */

.plate {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
  padding: 0.22em 0.6em;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3.5px rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

/* ---- buttons and fields ------------------------------------------------- */

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.second { background: var(--card); color: var(--ink); }
.btn.quiet {
  border: 0; background: none; color: var(--ink-soft); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; padding: 0 8px;
}
.btn.stop { color: var(--stop); }
.btn.wide { width: 100%; }

input[type="text"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
input[type="text"]:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { resize: vertical; display: block; }

.field { display: block; font-weight: 700; margin: 14px 0 6px; }

.error { color: var(--stop); font-weight: 600; margin-top: 10px; }
.hint { color: var(--ink-soft); font-size: 0.9rem; }
.empty { color: var(--ink-soft); padding: 18px 2px; }

/* ---- join screen -------------------------------------------------------- */

.join { flex: 1; overflow-y: auto; }
.join-sign { background: var(--ink); color: #fff; padding: 44px 20px 30px; }
.join-sign-inner, .join-form { max-width: 460px; margin: 0 auto; }
.wordmark { font-size: clamp(2.6rem, 13vw, 4rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.join-sign p { margin-top: 12px; font-size: 1.1rem; color: #c9d4e6; }
.hazard {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--ink) 14px 28px);
}
.join-form { padding: 22px 20px 40px; }
.join-form .venue { font-size: 1.25rem; font-weight: 800; }
.code-input { font-size: 1.5rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; text-align: center; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 56px; padding: 6px 10px;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--card);
  font-weight: 700; cursor: pointer;
}
.choice input { position: absolute; opacity: 0; }
.choice label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.choice label:has(input:focus-visible) { outline: 3px solid var(--route); outline-offset: 2px; }
.join-form .btn { margin-top: 20px; }

/* ---- shell -------------------------------------------------------------- */

.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line);
}
.top .plate { font-size: 1.15rem; }
.top-who { flex: 1; min-width: 0; line-height: 1.2; }
.top-who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-who span { color: var(--ink-soft); font-size: 0.85rem; }

.offline { background: var(--amber); color: var(--ink); font-weight: 700; text-align: center; padding: 6px 12px; }

.flash {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 5;
  max-width: 520px; margin: 0 auto; padding: 12px 14px;
  background: var(--stop); color: #fff; font-weight: 600; border-radius: var(--radius);
}

#view { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.pane { min-height: 0; overflow-y: auto; padding: 16px 14px 28px; }
.pane > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.pane + .pane { border-left: 1px solid var(--line); }

.tabs { display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button {
  flex: 1; min-height: 58px; border: 0; background: none; cursor: pointer;
  font-weight: 700; font-size: clamp(0.76rem, 3.6vw, 0.92rem); color: var(--ink-soft); border-top: 4px solid transparent;
  padding: 0 2px; white-space: nowrap;
}
.tabs button[aria-current="page"] { color: var(--ink); border-top-color: var(--ink); }
.badge {
  display: inline-block; min-width: 1.5em; margin-left: 6px; padding: 0 0.4em;
  background: var(--amber); color: var(--ink); border-radius: 999px;
  font-size: 0.8rem; font-weight: 800; line-height: 1.5em; text-align: center;
}

/* ---- asking for something ---------------------------------------------- */

.ask { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ask-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.ask-row .btn { margin-left: auto; }
.ask select { margin-bottom: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
details.ask > summary { font-weight: 700; cursor: pointer; min-height: 28px; }
details.ask[open] > summary { margin-bottom: 12px; }

/* ---- request cards ------------------------------------------------------ */

.req {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-top: 10px; overflow: hidden;
}
.req.urgent { border-color: var(--ink); }
.req.urgent::before {
  content: ""; display: block; height: 8px; margin: -14px -14px 12px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 12px, var(--ink) 12px 24px);
}
.req-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-head .age { margin-left: auto; color: var(--ink-soft); font-size: 0.9rem; }
.tag-urgent { background: var(--amber); color: var(--ink); font-weight: 800; padding: 0.1em 0.55em; border-radius: 6px; }
.req-body { font-size: 1.15rem; font-weight: 600; margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.req-state { color: var(--ink-soft); margin-top: 6px; }
.req-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.req-actions .quiet { margin-left: auto; }

.track { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0; margin: 12px 0 0; }
.track li { font-size: 0.8rem; font-weight: 700; color: #8a94a3; }
.track li::before { content: ""; display: block; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.track li.done { color: var(--ink); }
.track li.done::before { background: var(--ink); }
.track li.now.s-on_the_way::before { background: var(--route); }
.track li.now.s-delivered::before { background: var(--go); }

.req.closed { padding: 10px 14px; background: transparent; }
.req.closed .req-body { font-size: 1rem; font-weight: 500; margin-top: 0; }
.req.closed.s-delivered .req-state { color: var(--go); font-weight: 700; }

/* ---- stands list -------------------------------------------------------- */

.stand-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 60px; padding: 10px 12px; margin-top: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.stand-row .last { flex: 1; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stand-row.unread .last { color: var(--ink); font-weight: 700; }

/* ---- a thread ----------------------------------------------------------- */

.pane.thread-pane { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); width: 100%; }
.thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; width: 100%; }
.msg { max-width: 82%; margin-top: 10px; }
.msg.mine { margin-left: auto; }
.msg-who { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.bubble {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
  padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: var(--ink); border-color: var(--ink); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg-time { font-size: 0.75rem; color: var(--ink-soft); margin-top: 2px; }
.msg.mine .msg-time { text-align: right; }
.sys { margin: 14px auto 4px; max-width: 92%; text-align: center; font-size: 0.88rem; color: var(--ink-soft); }
.sys-body { display: block; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; background: var(--card); border-top: 1px solid var(--line); width: 100%; }
.composer textarea { flex: 1; resize: none; max-height: 8em; }
.composer-error { padding: 0 14px 8px; background: var(--card); margin-top: 0; width: 100%; }

/* ---- notices and setup -------------------------------------------------- */

.notice { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; }
.notice p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }
.notice .hint { display: block; margin-top: 6px; }

.setup-code { font-size: 2.2rem; font-weight: 900; letter-spacing: 0.16em; }
.setup-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.setup-box .btn { margin-top: 10px; }
.setup-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.setup-row:first-child { border-top: 0; }
.setup-row .grow { flex: 1; min-width: 0; }
.setup-row .off { color: var(--ink-soft); text-decoration: line-through; }
.setup-add { display: flex; gap: 8px; margin-top: 10px; }
.setup-add input { flex: 1; }
.link-out { overflow-wrap: anywhere; font-weight: 600; }

/* ---- equipment ---------------------------------------------------------- */

.scan .field { margin-top: 0; }
.scan-row { display: flex; gap: 8px; margin-top: 10px; }
.scan-input { flex: 1; min-width: 0; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.scan-input::placeholder { font-weight: 400; letter-spacing: 0; text-transform: none; }
.scan-result { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.scan-result h3 { font-size: 0.9rem; font-weight: 800; margin: 14px 0 4px; }
.scan-result .moved { color: var(--go); font-weight: 700; }
.trail { list-style: none; margin: 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink-soft); font-size: 0.95rem; }
.trail li + li { margin-top: 2px; }
.trail strong { color: var(--ink); }
.scan-add { display: grid; gap: 8px; margin-top: 12px; }
h2 .hint { font-weight: 500; }
.stand-row strong { white-space: nowrap; }

@media (min-width: 1000px) {
  .pane { padding: 22px 24px 32px; }
}
