/* The 3D city fills the screen; the brand card sits top-left and the launch
   list on the right, like a game HUD. Palette and type carry over from Sim. */
:root {
  color-scheme: dark;
  --night: #0F1420;
  --felt: #161D2B;
  --felt-2: #202939;
  --rule: #33405A;
  --chalk: #EEE8DA;
  --muted: #A1ACC0;
  --sodium: #F2B33D;
  --sodium-soft: rgba(242, 179, 61, .15);
  --fog: #C9D2E3;
  --live: #7FD1A0;
  --display: "Big Shoulders Display", "Arial Narrow", Arial, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--night); color: var(--chalk); font-family: var(--body); font-size: 14px; overflow: hidden; }
#app { position: relative; height: 100%; width: 100%; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
.hud { position: absolute; z-index: 3; }
.panel { background: color-mix(in srgb, var(--felt) 90%, transparent); border: 1px solid var(--rule); border-radius: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(5, 8, 14, .28); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Loading */
.loading { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; gap: 14px; background: var(--night); text-align: center; }
.loading-name { display: block; height: 48px; margin: 0 auto; }
.loading-bar { width: 240px; height: 4px; background: var(--felt-2); border-radius: 2px; overflow: hidden; margin: 0 auto; }
.loading-bar span { display: block; height: 100%; width: 0; background: var(--sodium); transition: width .2s; }
.loading-note { color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* Brand card */
.brand { top: 16px; left: 16px; padding: 14px 16px; width: 260px; }
.brand-name { margin: 0; line-height: 0; }
.brand-name img { height: 28px; }
.brand-line { color: var(--sodium); font-family: var(--mono); font-size: 12px; margin-top: 4px; }
.chain { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.chain dt { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chain dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; }

/* Launch list */
.launches { top: 16px; right: 16px; width: 320px; max-height: calc(100% - 32px); overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.launch { border: 1px solid var(--rule); border-radius: 10px; background: var(--felt-2); }
.launch.on { border-color: var(--sodium); }
.launch-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: none; border: 0; cursor: pointer; text-align: left; }
.launch-name { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; }
.note { margin: 0 12px 10px; color: var(--muted); line-height: 1.45; }
.trust { margin: 0 12px 10px; padding: 8px 10px; list-style: none; display: grid; gap: 4px; border-left: 2px solid var(--sodium); background: var(--sodium-soft); line-height: 1.4; }
.how { margin-top: 10px; border-top: 1px solid var(--rule); padding-top: 8px; }
.how summary { cursor: pointer; color: var(--sodium); font-family: var(--mono); font-size: 12px; }
.how ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.4; font-size: 13px; }
.how b { color: var(--chalk); }
.rows { margin: 0 12px 10px; display: grid; gap: 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row dt { color: var(--muted); }
.row dd { margin: 0; font-family: var(--mono); font-size: 12px; text-align: right; }
.ext { display: block; margin: 0 12px 12px; color: var(--sodium); font-size: 12px; }

/* Phase pills (shared by the list and the floating labels) */
.phase { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.phase.lot { color: var(--sodium); }
.phase.bidding, .phase.settling { color: var(--fog); }
.phase.live { color: var(--live); }
.phase.no-sale { color: var(--muted); }

/* Floating labels above sites */
.chip-label { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--rule); background: color-mix(in srgb, var(--felt) 88%, transparent); cursor: pointer; }
.chip-label b { font-family: var(--display); font-weight: 800; font-size: 18px; line-height: 1; }
.chip-label.on { border-color: var(--sodium); }

/* Phones: the list becomes a bottom sheet, the brand card shrinks */
@media (max-width: 640px) {
  .brand { top: 12px; left: 12px; right: 12px; width: auto; padding: 10px 12px; }
  .brand-name img { height: 22px; }
  .brand .chain { display: none; } /* leaves more of the city in view */
  .launches { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-height: 38%; }
  /* A picked launch replaces the list, so its details are what you see. */
  .launches[data-picked] { max-height: 58%; }
}
.launches > .eyebrow { display: flex; justify-content: space-between; align-items: center; }
.all-launches { border: 0; background: none; padding: 0; color: var(--sodium); font: inherit; text-decoration: underline; cursor: pointer; }

/* Loading and connection problems */
.loading .btn { justify-self: center; }
.conn-note { margin: 8px 0 0; padding: 6px 8px; border-radius: 6px; font-size: 12px; line-height: 1.4; color: var(--sodium); background: var(--sodium-soft); }

/* Bid form: price unit, its echo in the other unit, resuming a saved bid */
.with-unit { display: flex; gap: 6px; }
.with-unit select { flex: none; font: 14px var(--mono); color: var(--chalk); background: var(--night); border: 1px solid var(--rule); border-radius: 8px; padding: 0 8px; }
.echo { min-height: 1.2em; }
.linkish { border: 0; background: none; padding: 0; color: var(--sodium); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.bid-resumed { margin: 0 0 10px; padding: 8px 10px; border-left: 2px solid var(--sodium); background: var(--sodium-soft); font-size: 13px; }
.after-send ol { margin: 4px 0 12px; padding-left: 18px; display: grid; gap: 4px; }
.bid-fields code.prose { word-break: normal; overflow-wrap: break-word; }

/* Paying: wide screens scan the QR; a phone opens its own wallet app, and
   shows the QR only for another device. */
.only-narrow, #bid .qr-toggle { display: none; }
@media (max-width: 640px) {
  .only-wide { display: none; }
  .pay-intro.only-narrow { display: block; }
  #bid .qr-toggle { display: inline-flex; margin-bottom: 8px; }
  section[data-step="pay"]:not([hidden]) { display: flex; flex-direction: column; }
  section[data-step="pay"] .bid-resumed { order: -4; }
  section[data-step="pay"] .pay-intro { order: -3; }
  section[data-step="pay"] .bid-actions { order: -2; }
  section[data-step="pay"] .qr-toggle { order: -1; }
  #bid:not(.show-qr) .bid-qr { display: none; }
}

/* Buttons */
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--sodium); background: var(--sodium); color: var(--night); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: none; color: var(--sodium); }
.bid-open { margin: 0 12px 12px; width: calc(100% - 24px); }

/* Bid dialog */
.bid { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 18px 20px 20px; color: var(--chalk); background: var(--felt); }
.bid::backdrop { background: rgba(8, 11, 18, .6); }
.bid h2 { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.05; margin: 4px 32px 8px 0; }
.bid p { line-height: 1.5; }
.bid-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.bid-timing { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--felt-2); color: var(--muted); font-size: 13px; }
.bid-timing.late { background: var(--sodium-soft); color: var(--sodium); }
.bid-terms { margin: 0 0 12px; }
#bidForm, #claimForm { display: grid; gap: 12px; }
#bidForm label, #claimForm label { display: grid; gap: 4px; font-weight: 500; }
#bidForm small, #claimForm small { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 11px; }
#bidForm input, #claimForm input { font: 14px var(--mono); color: var(--chalk); background: var(--night); border: 1px solid var(--rule); border-radius: 8px; padding: 9px 10px; width: 100%; }
#bidForm input:focus-visible, #claimForm input:focus-visible { outline: 2px solid var(--sodium); outline-offset: 1px; }
.bid-summary { margin: 0; min-height: 1.5em; font-size: 13px; color: var(--live); }
.bid-summary.problem { color: var(--sodium); }
.bid-summary a { color: inherit; }
.bid-fine { color: var(--muted); font-size: 12px; }
.bid-fine summary { cursor: pointer; }
.bid-sealed { color: var(--live); margin-top: 0; }
.bid-code { display: block; font-family: var(--mono); font-size: 12px; word-break: break-all; background: var(--night); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.bid-qr { width: min(260px, 100%); margin: 8px auto 12px; background: #fff; border-radius: 10px; padding: 6px; }
.bid-qr svg { display: block; width: 100%; height: auto; }
.bid-fields { display: grid; gap: 8px; margin: 0 0 12px; }
.bid-fields dt { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bid-fields dd { margin: 2px 0 0; display: flex; gap: 8px; align-items: flex-start; }
.bid-fields code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.copy { flex: none; border: 1px solid var(--rule); border-radius: 6px; background: var(--felt-2); padding: 2px 8px; font-size: 12px; cursor: pointer; }
.audit-verdict { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: var(--felt-2); line-height: 1.45; }
.audit-verdict.ok { color: var(--live); }
.audit-verdict.bad { color: var(--sodium); background: var(--sodium-soft); }
.envelopes-wrap { overflow-x: auto; }
.envelopes { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.envelopes th { text-align: left; font-weight: 500; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.envelopes td { padding: 5px 6px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.envelopes tr.won td:last-child { color: var(--live); }
.envelopes tr.partial td:last-child { color: var(--sodium); }
.envelopes tr.lost td, .envelopes tr.late td { color: var(--muted); }
.envelopes tr.bad td { color: var(--sodium); }
.audit-h { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.bid-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.snapshot-note { display: none; margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--sodium); max-width: 260px; }
[data-snapshot] .snapshot-note { display: block; }
[data-snapshot] #auditRerun { display: none; }

/* The launch directory: tabs, search, sort, then a list that draws only the
   rows in view (main.js renderList), so it scales to thousands of launches. */
.launches { display: flex; flex-direction: column; }
.dir-controls { display: grid; gap: 6px; }
.dir-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.dir-tabs button { border: 1px solid var(--rule); background: none; color: var(--muted); border-radius: 999px; padding: 3px 8px; font: 11px var(--mono); cursor: pointer; }
.dir-tabs button span { opacity: .7; }
.dir-tabs button.on { border-color: var(--sodium); color: var(--sodium); }
.dir-row { display: flex; gap: 6px; }
.dir-row input, .dir-row select { min-width: 0; font: 13px var(--body); color: var(--chalk); background: var(--night); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; }
.dir-row input { flex: 1; }
.launches { overflow: hidden; }
.launch-list { position: relative; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.launch-list-inner { position: relative; }
.launch-row { position: absolute; left: 0; right: 0; height: 42px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--felt-2); color: var(--chalk); cursor: pointer; text-align: left; }
.launch-row .launch-name { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launch-row.on { border-color: var(--sodium); }
.launch-row:focus-visible { outline: 2px solid var(--sodium); outline-offset: 1px; }
#launchCount { color: var(--muted); }
@media (max-width: 640px) {
  .launches[data-picked] .dir-controls, .launches[data-picked] .launch-list { display: none; }
}
