/* Solar Command Center tokens - same family as the live dashboard */
:root {
  --gold: #f59e0b; --warm: #fbbf24; --amber: #d97706;
  --bg: #09090c; --surface: #141318; --elevated: #1d1b21;
  --green: #22c55e; --red: #ef4444;
  --text: #fafafa; --sub: #a1a1aa; --muted: #96939f;
  --line: rgba(251, 191, 36, .16);        /* gold hairline */
  --line-soft: rgba(255, 255, 255, .07);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; color: var(--text);
  font: 400 1rem/1.5 var(--sans);
  background:
    radial-gradient(ellipse 90% 42% at 50% -8%, rgba(245, 158, 11, .16) 0%, transparent 60%),
    radial-gradient(ellipse 60% 30% at 85% 22%, rgba(217, 119, 6, .05) 0%, transparent 65%),
    linear-gradient(180deg, #0d0c10 0%, var(--bg) 45%);
  background-attachment: fixed;
}
.wrap { position: relative; max-width: 640px; margin: 0 auto; padding: 26px 16px 70px; display: flex; flex-direction: column; gap: 14px; }

/* ---- hero ---- */
.hero { position: relative; text-align: center; display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.access-key-btn {
  position: absolute; top: -5px; right: 0; width: 42px; height: 42px; padding: 0;
  z-index: 2; touch-action: manipulation;
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(251, 191, 36, .05); color: var(--warm); font-size: 1.05rem; cursor: pointer;
}
.access-key-btn:hover { background: rgba(245, 158, 11, .12); }
h1 {
  margin: 0; font-weight: 800; font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: -.015em;
  padding-inline: 42px;
  background: linear-gradient(180deg, #fde68a 10%, var(--gold) 78%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(251, 191, 36, .28));
  text-wrap: balance;
}
.hero-sub { margin: 0; color: var(--sub); font-size: clamp(.88rem, 3vw, .98rem); text-wrap: balance; }
.hero-sub b { color: var(--text); font-weight: 600; }
.badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.badge {
  border: 1px solid var(--line); background: rgba(251, 191, 36, .05); color: var(--warm);
  border-radius: 999px; padding: 5px 13px; font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  white-space: nowrap;
}

/* ---- how it works ---- */
.steps { display: flex; gap: 10px; }
.step {
  flex: 1; background: linear-gradient(170deg, rgba(251, 191, 36, .07), rgba(251, 191, 36, .02));
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: .7rem; color: var(--sub); line-height: 1.5; text-align: center;
}
.step b { display: block; color: var(--warm); font-size: .8rem; font-weight: 600; letter-spacing: .01em; margin-bottom: 2px; }
.step b .n { font-family: var(--mono); color: var(--gold); margin-right: 4px; }

/* ---- status banners ---- */
.banner {
  background: rgba(245, 158, 11, .1); border: 1px solid var(--line); color: var(--warm);
  border-radius: 10px; padding: 9px 13px; text-align: center; font-size: .78rem;
}
.rental-strip {
  background: rgba(34, 197, 94, .09); border: 1px solid rgba(34, 197, 94, .4); color: var(--green);
  border-radius: 10px; padding: 9px 13px; text-align: center; font-size: .8rem;
}
.rental-strip a { color: var(--green); }
.claim-card {
  border-color: rgba(34, 197, 94, .48);
  background: linear-gradient(165deg, rgba(20, 38, 29, .98), var(--surface) 72%);
}
.claim-card .winner-banner { margin-bottom: 14px; }
#resultBox:empty { display: none; }
.auction-loss-card {
  border-color: rgba(239, 68, 68, .38);
  background: linear-gradient(165deg, rgba(45, 25, 25, .96), var(--surface) 72%);
  text-align: center;
}
.auction-loss-title { color: var(--red); font-size: 1rem; font-weight: 800; }
.auction-loss-totals {
  margin-top: 9px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  color: var(--sub); font-size: .8rem;
}
.auction-loss-totals strong { display: block; margin-top: 2px; color: var(--text); font: 700 .95rem/1.2 var(--mono); }
.bid-status {
  min-height: 72px; margin: 5px 0 3px; padding: 11px 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); text-align: center;
}
.bid-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.bid-status-value-label {
  color: var(--muted); font: 600 .72rem/1.2 var(--sans); letter-spacing: 0; text-transform: uppercase;
}
.bid-status-state { display: flex; align-items: center; justify-content: center; gap: 9px; }
.bid-status-state strong { color: var(--text); font-size: 1.28rem; line-height: 1.2; }
.bid-status-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 5px; color: var(--sub); font-size: .8rem; line-height: 1.35; }
.bid-status-value { color: var(--text); font: 700 .9rem/1.2 var(--mono); white-space: nowrap; }
.bid-status-separator { color: var(--muted); }
.bid-status.leading .bid-status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.bid-status.leading .bid-status-state strong { color: var(--green); }
.bid-status.outbid .bid-status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 68, 68, .12); }
.bid-status.outbid .bid-status-state strong { color: var(--red); }
.bid-status.pending .bid-status-dot { background: var(--warm); box-shadow: 0 0 0 4px rgba(251, 191, 36, .12); }
.bid-status.pending .bid-status-state strong { color: var(--warm); }
.alert-control {
  display: none; margin: 2px 0 5px; padding: 10px 12px; gap: 10px; align-items: center;
  justify-content: space-between; border: 1px solid var(--line-soft); border-radius: 10px;
  background: rgba(255, 255, 255, .025); text-align: left;
}
.alert-control.show { display: flex; }
.alert-copy { min-width: 0; color: var(--sub); font-size: .72rem; line-height: 1.35; }
.alert-copy strong { display: block; color: var(--text); font-size: .8rem; }
.alert-toggle {
  flex: 0 0 auto; min-width: 94px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: rgba(245, 158, 11, .09); color: var(--warm);
  font: 700 .72rem/1.1 var(--sans); cursor: pointer;
}
.alert-toggle.on { border-color: rgba(34, 197, 94, .5); color: var(--green); background: rgba(34, 197, 94, .08); }
.alert-toggle:disabled { opacity: .5; cursor: not-allowed; }
.install-steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: install; text-align: left; }
.install-steps li { position: relative; padding: 9px 0 9px 38px; color: var(--sub); font-size: .84rem; }
.install-steps li::before {
  counter-increment: install; content: counter(install); position: absolute; left: 0; top: 6px;
  width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 50%; color: var(--warm); font: 700 .72rem var(--mono);
}
.install-access-id { margin: 12px 0; color: var(--sub); font-size: .8rem; }
.install-access-id code { color: var(--warm); font: 700 .85rem var(--mono); }
.bid-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 10px; align-items: baseline; margin-top: 2px; text-align: center; }
.auction-details { text-align: center; line-height: 1.4; }

.spot-card { border-color: rgba(34, 197, 94, .32); background: linear-gradient(165deg, rgba(20, 38, 29, .95), var(--surface) 68%); text-align: center; }
.spot-head { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.spot-head h2 { margin-bottom: 4px; color: var(--green); }
.spot-price { color: var(--text); font: 700 1.15rem var(--mono); white-space: nowrap; }
.spot-window { margin: 7px 0 12px; color: var(--sub); font-size: .82rem; }
.spot-window strong { color: var(--text); }
.spot-solar { display: block; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.spot-card .bidbtn { background: var(--green); color: #04120a; box-shadow: 0 10px 24px -10px rgba(34, 197, 94, .5); }
.spot-state { min-height: 1.2em; margin-top: 8px; color: var(--muted); font-size: .72rem; }

/* ---- cards ---- */
.card {
  background: linear-gradient(165deg, var(--elevated) 0%, var(--surface) 60%);
  border: 1px solid var(--line-soft); border-radius: 16px; padding: 20px;
  box-shadow: 0 10px 34px -14px rgba(0, 0, 0, .8);
}
.card.big {
  text-align: center; padding: 26px 20px 22px;
  background:
    linear-gradient(168deg, #1e1a13 0%, #141318 52%, #121116 100%) padding-box,
    linear-gradient(168deg, rgba(251, 191, 36, .55), rgba(251, 191, 36, .1) 38%, rgba(251, 191, 36, .3) 100%) border-box;
  border: 1px solid transparent;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, .9), 0 0 60px -30px rgba(245, 158, 11, .35);
  display: flex; flex-direction: column; gap: 7px;
}
.eyebrow {
  font-size: .66rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
}
.prize { font-size: 1.02rem; font-weight: 600; color: var(--text); }
.prize em { font-style: normal; color: var(--sub); font-weight: 400; font-size: .85rem; }
.solar-windows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 3px; }
.solar-window { min-width: 0; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(0, 0, 0, .14); text-align: left; }
.solar-window-head { display: flex; align-items: baseline; gap: 5px; margin-bottom: 3px; white-space: nowrap; }
.solar-window-name { color: var(--text); font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.solar-window-time { color: var(--muted); font-size: .56rem; letter-spacing: .04em; text-transform: uppercase; }
.solar-window-value { color: var(--sub); font-size: .76rem; white-space: nowrap; }
.solar-window-value b { color: var(--text); }

/* the instrument */
.countdown {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: clamp(3rem, 13vw, 4.4rem); line-height: 1.05; letter-spacing: .01em; margin: 2px 0;
  background: linear-gradient(180deg, #fde68a 5%, var(--gold) 82%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.countdown.closing { background: linear-gradient(180deg, #fca5a5, var(--red)); animation: pulse 1s infinite; }
.countdown.final { background: linear-gradient(180deg, #fca5a5, var(--red)); animation: bigpulse .5s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes bigpulse { 50% { opacity: .5; transform: scale(1.04); } }

/* Optional anti-snipe drain bar; production hard-close auctions keep it hidden. */
.snipe { display: none; width: 72%; max-width: 300px; height: 4px; margin: 0 auto; border-radius: 4px;
  background: rgba(255, 255, 255, .08); overflow: hidden; }
.snipe.show { display: block; }
.snipe-fill { height: 100%; width: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--amber), var(--warm)); transition: width .25s linear; }

.extended { display: none; color: var(--green); font-weight: 800; font-size: .9rem; }
.extended.show { display: block; animation: fadeout 2.5s forwards; }
@keyframes fadeout { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.sub { color: var(--sub); font-size: .78rem; }
.lv { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }

.bidbtn {
  display: block; width: 100%; margin-top: 12px; padding: 17px; border: 0; border-radius: 14px;
  font: 800 1.12rem/1 var(--sans); letter-spacing: .05em; text-transform: uppercase;
  color: #1a1206; cursor: pointer;
  background: linear-gradient(180deg, #fbbf24, var(--gold) 55%, var(--amber));
  box-shadow: 0 10px 30px -8px rgba(245, 158, 11, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.bidbtn:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
.bidbtn:not(:disabled):active { transform: translateY(1px) scale(.99); box-shadow: 0 5px 16px -8px rgba(245, 158, 11, .5); }
.bidbtn:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.bid-entry { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.bid-amount { display: block; text-align: center; }
.bid-amount-head { display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.bid-minimum { color: var(--warm); font: 600 .72rem var(--mono); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.bid-amount-field { position: relative; display: block; }
.bid-amount input {
  height: 56px; margin: 5px 0 0; padding: 12px 62px;
  font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center;
  appearance: textfield; -moz-appearance: textfield;
}
.bid-amount input::-webkit-inner-spin-button,
.bid-amount input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.bid-amount .unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--sub); font: 600 .75rem var(--mono); pointer-events: none; }
.bid-entry .bidbtn { min-height: 52px; margin-top: 0; padding: 14px; font-size: 1rem; }

.mystats { font-size: .74rem; color: var(--muted); font-family: var(--mono); }
.namechip { border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.namechip:hover { color: var(--warm); }

/* ---- ledger ---- */
h2 { font: 600 .68rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; text-align: center; }
h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ticker { max-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th { color: var(--muted); text-transform: uppercase; font-size: .62rem; letter-spacing: .1em; text-align: center; padding: 4px 6px; font-weight: 600; }
td { padding: 6px; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--sub); text-align: center; }
td:first-child { color: var(--text); }
th:last-child, td:last-child { white-space: nowrap; }

/* ---- rules ---- */
.rules { color: var(--sub); font-size: .8rem; line-height: 1.55; text-align: left; }
.rules h2 { text-align: left; }
.rules strong { color: var(--warm); font-weight: 600; }
.detail { padding: 9px 0; }
.detail + .detail { border-top: 1px solid var(--line-soft); }

/* ---- forms ---- */
input {
  width: 100%; padding: 11px; margin: 4px 0 12px; border-radius: 10px; color: var(--text);
  border: 1px solid var(--line-soft); background: var(--bg);
  font: 400 .82rem var(--mono); transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--gold); }
label { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.winner-banner {
  background: rgba(34, 197, 94, .1); border: 1px solid var(--green); color: var(--green);
  border-radius: 10px; padding: 12px; text-align: center; margin-bottom: 14px; font-weight: 600; line-height: 1.6;
}
.winner-banner a { color: var(--green); }

/* ---- invoice modal ---- */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(5, 5, 8, .82); backdrop-filter: blur(6px);
  z-index: 50; align-items: center; justify-content: center; padding: 12px; overflow-y: auto; }
.modal { background: var(--elevated); border: 1px solid var(--line); border-radius: 18px;
  position: relative; max-width: 500px; width: 100%; max-height: calc(100dvh - 24px); padding: 28px; text-align: center; overflow-y: auto;
  box-shadow: 0 24px 70px -20px rgba(0, 0, 0, .95); }
.modal-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--surface); color: var(--sub); font: 700 1rem var(--sans); cursor: pointer;
}
.modal-close:hover { color: var(--text); border-color: var(--line); }
.modal h2 { color: var(--warm); margin-bottom: 4px; font-size: 1.25rem; line-height: 1.25; letter-spacing: 0; text-transform: none; }
.modal > .sub { font-size: 1rem; }
.modal.form-modal { max-width: 430px; text-align: left; }
.modal.form-modal h2 { color: var(--green); }
.modal-actions { display: flex; gap: 8px; align-items: stretch; }
.modal-actions .bidbtn { margin: 0; padding: 13px; font-size: .9rem; }
.modal-actions .close { margin: 0; white-space: nowrap; }
#qr { display: flex; justify-content: center; margin: 18px auto; background: #fff; padding: 12px; border-radius: 10px; width: fit-content; max-width: 100%; }
#qr canvas, #qr img { display: block; max-width: 100%; height: auto; }
#accessQr { display: flex; justify-content: center; margin: 16px auto; background: #fff; padding: 10px; border-radius: 8px; width: fit-content; max-width: 100%; }
#accessQr canvas, #accessQr img { display: block; max-width: 100%; height: auto; }
.access-code {
  display: block; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--bg); color: var(--warm); font: 600 .82rem/1.55 var(--mono);
  overflow-wrap: anywhere; user-select: all;
}
.access-note { margin: 12px 0; color: var(--sub); font-size: .82rem; line-height: 1.45; }
.access-id { margin-top: 10px; color: var(--sub); font-size: .78rem; }
.access-id code { color: var(--warm); font: 600 .82rem var(--mono); }
.access-import { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); text-align: left; }
.access-import .modal-actions { margin-top: 4px; }
.access-import input { margin-bottom: 8px; }
.paybtns { display: flex; gap: 8px; }
.paybtns a, .paybtns button {
  flex: 1; min-height: 48px; padding: 13px; border-radius: 10px; border: 1px solid var(--gold); background: none;
  color: var(--gold); font: 700 .96rem/1.2 var(--sans); cursor: pointer; text-decoration: none; text-align: center;
  transition: background .15s;
}
.paybtns a:hover, .paybtns button:hover { background: rgba(245, 158, 11, .1); }
.bolt11 { word-break: break-all; font: 400 .78rem/1.45 var(--mono); color: var(--sub);
  background: var(--bg); border-radius: 8px; padding: 10px; margin: 12px 0; max-height: 84px; overflow-y: auto; }
.status-paid { color: var(--green); font-weight: 800; font-size: 1.1rem; }
.status-wait { color: var(--warm); font-size: 1rem; line-height: 1.4; }
.close { margin-top: 12px; background: none; border: 1px solid var(--line-soft); color: var(--sub);
  min-height: 44px; border-radius: 9px; padding: 10px 22px; cursor: pointer; font: 600 .95rem var(--sans); }

a { color: var(--gold); }
:is(button, a, input, .namechip):focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; border-radius: 4px; }
.confetti { position: fixed; width: 8px; height: 8px; border-radius: 2px; z-index: 99; pointer-events: none; }

@media (max-width: 430px) {
  .steps { flex-direction: column; gap: 7px; }
  h1 { padding-inline: 34px; }
  .access-key-btn { width: 36px; height: 36px; }
  .step { padding: 8px 12px; }
  .modal { padding: 20px 16px; }
  .paybtns { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Keep the current checkout and connection controls in the restored layout. */
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.rental-status { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--sub); font-size: .72rem; text-align: center; }
.rental-status [data-tone="warning"] { color: var(--warm); }
.state-retry, .quiet-button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--warm); font: inherit; cursor: pointer; }
.payment-preview, .payment-terms { margin: 0; color: var(--sub); font-size: .72rem; line-height: 1.5; }
.payment-preview strong, .payment-terms strong { color: var(--warm); }
.form-error { margin: 8px 0; color: #fca5a5; font-size: .8rem; }
.form-modal .payment-terms { margin-bottom: 12px; }
.form-modal h2 { padding-right: 24px; }
.solar-window { margin: 0; }
@media (max-width: 350px) {
  .solar-windows { grid-template-columns: 1fr; }
  .bid-amount-head { flex-wrap: wrap; gap: 4px 12px; }
}
