/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
  --ink:        #1a1a1a;
  --ink-muted:  #555555;
  --line:       #e8e8e8;
  --bg:         #f4f4f2;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --pad:        24px;
  --max:        400px;
}

/* ── Base ───────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font-sans);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header {
  padding: 22px var(--pad) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tagline {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
  font-weight: 400;
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}

.nav-link {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0;
  position: relative;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Underline grows from left on hover */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link:hover::after {
  width: 100%;
}

/* ── Info sheet (How it works / About) ──────────────────────────────── */
.info-sheet {
  max-width: 440px;
}

.info-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 28px;
}

.info-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-body p {
  font-size: 14px;
  color: #555;
  line-height: 1.7;
}

.info-body strong {
  color: var(--ink);
  font-weight: 600;
}

.info-body em {
  font-style: italic;
}

.info-rule {
  font-size: 10px !important;
  color: #bbb !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 8px;
}

.info-muted {
  font-size: 11px !important;
  color: var(--ink-muted) !important;
  line-height: 1.6 !important;
}

/* ── Main ───────────────────────────────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--pad);
}

/* ── Spot ───────────────────────────────────────────────────────────── */
.spot {
  width: 100%;
  max-width: var(--max);
  text-align: center;
  padding: 72px 0 48px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spot-empty,
.spot-occupied {
  width: 100%;
}

.spot-empty-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

.spot-empty-message {
  font-family: var(--font-serif);
  font-size: clamp(20px, 5vw, 26px);
  font-style: italic;
  font-weight: normal;
  color: #aaa;
  line-height: 1.5;
  margin-bottom: 20px;
}

.spot-empty-sub {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.7;
}

.spot-username {
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  margin-bottom: 22px;
  font-weight: 500;
}

.spot-message {
  font-family: var(--font-serif);
  font-size: clamp(20px, 5vw, 26px);
  font-style: italic;
  font-weight: normal;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 auto 28px;
  max-width: 340px;
  word-break: break-word;
}

.spot-meta {
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ── CTA ────────────────────────────────────────────────────────────── */
.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 80px;
}

.btn-claim {
  display: inline-block;
  padding: 13px 36px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-claim:hover,
.btn-claim:focus-visible {
  opacity: 0.65;
  outline: none;
}

.cta-hint {
  font-size: 11px;
  color: var(--ink-muted);
  min-height: 16px;
}

/* ── Bid histogram ──────────────────────────────────────────────────── */
.chart {
  width: 100%;
  max-width: var(--max);
  padding-bottom: 52px;
}

.chart[hidden] { display: none; }

.chart-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.chart-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-bar {
  fill: var(--ink);
  opacity: 0.15;
  cursor: default;
  transition: opacity 0.1s;
}

.chart-bar:hover { opacity: 0.7; }

.chart-x-label {
  font-size: 9px;
  fill: var(--ink-muted);
  font-family: var(--font-sans);
}

.chart-tooltip {
  position: fixed;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 6px 10px;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  line-height: 1.6;
}

.chart-tooltip[hidden] { display: none; }

/* ── History ────────────────────────────────────────────────────────── */
.history {
  width: 100%;
  max-width: var(--max);
  border-top: 1px solid var(--line);
  padding: 52px 0 100px;
}

.history-empty {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  padding-bottom: 20px;
}

.history-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 52px;
}

.history-item {
  margin-bottom: 52px;
}

.history-item:last-child {
  margin-bottom: 0;
}

.h-position {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.h-message {
  font-family: var(--font-serif);
  font-size: 17px;
  font-style: italic;
  font-weight: normal;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 14px;
  word-break: break-word;
}

.h-meta {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.9;
}

/* ── Sheet overlay ──────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  animation: fadeIn 0.2s ease;
}

.sheet-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  padding: 36px var(--pad) max(40px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  position: relative;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.sheet-close:hover {
  color: var(--ink);
}

.sheet-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}

.sheet-price {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 32px;
}

/* ── Form fields ────────────────────────────────────────────────────── */
.field {
  margin-bottom: 26px;
}

.field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.field-prefix {
  display: flex;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.15s;
}

.field-prefix:focus-within {
  border-bottom-color: var(--ink);
}

.field-at {
  font-size: 15px;
  color: var(--ink-muted);
  padding-bottom: 8px;
  padding-top: 8px;
  flex-shrink: 0;
}

.field-input,
.field-textarea {
  width: 100%;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

.field-prefix .field-input {
  border-bottom: none;
  padding-left: 1px;
}

.field-input:focus,
.field-textarea:focus {
  border-bottom-color: var(--ink);
  outline: none;
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--line);
}

.field-textarea {
  resize: none;
  line-height: 1.55;
  display: block;
}

.field-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 5px;
  min-height: 18px;
}

/* ── Bid field ──────────────────────────────────────────────────────── */
.field-bid-wrap {
  display: flex;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.15s;
}

.field-bid-wrap:focus-within {
  border-bottom-color: var(--ink);
}

.field-dollar {
  font-size: 15px;
  color: var(--ink-muted);
  padding: 8px 2px 8px 0;
  flex-shrink: 0;
}

.field-bid {
  border-bottom: none;
  padding-left: 1px;
  -moz-appearance: textfield;
}

.field-bid::-webkit-outer-spin-button,
.field-bid::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-hint {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 5px;
}

/* ── ────────────────────────────────────────────────────────────────── */

.char-count {
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

.char-count.low {
  color: #c0392b;
}

.field-error {
  font-size: 11px;
  color: #c0392b;
  min-height: 16px;
  line-height: 1.4;
}

.form-error {
  font-size: 12px;
  color: #c0392b;
  text-align: center;
  margin: 12px 0 4px;
  min-height: 18px;
  line-height: 1.4;
}

/* ── Payment Request Button ─────────────────────────────────────────── */
#payment-request-wrap[hidden] { display: none; }

#payment-request-button {
  margin-bottom: 16px;
}

.pay-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.pay-divider::before,
.pay-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pay-divider span {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ── Card element (Stripe) ──────────────────────────────────────────── */
.card-element {
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.15s;
}

.card-element.focused {
  border-bottom-color: var(--ink);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  margin-top: 12px;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  opacity: 0.65;
  outline: none;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.back-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  display: block;
  letter-spacing: 0.02em;
}

.back-btn:hover { color: var(--ink); }

/* ── Success step ───────────────────────────────────────────────────── */
.step-success {
  text-align: center;
  padding: 20px 0 8px;
}

.success-mark {
  font-size: 28px;
  color: var(--ink);
  margin-bottom: 18px;
  opacity: 0.5;
}

.success-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 10px;
}

.success-sub {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* ── Honeypot ───────────────────────────────────────────────────────── */
.hp {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  tab-index: -1;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  padding: 10px 20px;
  letter-spacing: 0.04em;
  z-index: 300;
  animation: toastIn 0.2s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ── Desktop / tablet ───────────────────────────────────────────────── */
@media (min-width: 640px) {
  :root { --pad: 40px; }

  .sheet-overlay {
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
  }

  .sheet {
    border: 1px solid var(--line);
    border-radius: 1px;
    max-height: 88vh;
    animation: none;
  }

  .spot {
    padding: 110px 0 64px;
  }

  .spot-message,
  .spot-empty-message {
    font-size: 28px;
  }
}

@media (min-width: 900px) {
  .spot {
    padding: 140px 0 80px;
  }

  .spot-message,
  .spot-empty-message {
    font-size: 30px;
    max-width: 420px;
  }
}
