:root {
  --bg: #0f1218;
  --surface: #171b24;
  --border: #2a3142;
  --text: #e8eaef;
  --muted: #9aa3b5;
  --accent: #5b8def;
  --accent-hover: #7aa3f5;
  --danger: #e85d5d;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -10%, #1a2744 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1e2a38 0%, transparent 50%), var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.wrap--room {
  max-width: 820px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.room-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.room-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-share {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.btn-share:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--muted);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7dffb3;
  background: rgba(125, 255, 179, 0.08);
  border: 1px solid rgba(125, 255, 179, 0.25);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ee89a;
  box-shadow: 0 0 0 0 rgba(62, 232, 154, 0.5);
  animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(62, 232, 154, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(62, 232, 154, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(62, 232, 154, 0);
  }
}

.card--product {
  padding: 0;
  overflow: hidden;
}

.product-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  padding: 1.35rem 1.35rem 1rem;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

@media (max-width: 600px) {
  .product-hero {
    grid-template-columns: 1fr;
  }
}

.product-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.product-name {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.product-id-line {
  margin: 0 0 0.65rem;
  color: var(--muted);
  word-break: break-all;
}

.product-desc {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 52ch;
}

.product-website-wrap {
  margin: 0;
}

.product-website {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  font-size: 0.95rem;
}

.product-price-box {
  min-width: 140px;
  padding: 0.85rem 1rem;
  background: #12161e;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: right;
}

.product-price-label {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.product-price-value {
  margin: 0;
  font-size: 1rem;
  color: var(--accent-hover);
}

.spec-block {
  padding: 1rem 1.35rem 1.15rem;
}

.spec-heading {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.spec-grid {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.spec-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.spec-grid dd {
  margin: 0;
  color: var(--text);
}

.room-foot {
  margin: 0;
  padding: 0.85rem 1.35rem 1.15rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.card--product .json-details {
  margin: 0 1.35rem 0.5rem;
}

.section-head {
  margin-bottom: 1rem;
}

.section-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.section-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

header.page-head {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0f14;
  color: var(--text);
}

textarea {
  min-height: 220px;
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: 2px solid rgba(91, 141, 239, 0.35);
  outline-offset: 1px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.row > * {
  flex: 1;
  min-width: 120px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #0a0c10;
}

.btn:hover {
  background: var(--accent-hover);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: var(--text);
}

.err {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.json-block {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0c0f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

details.json-details {
  margin-top: 0.5rem;
}

details.json-details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  user-select: none;
  margin-bottom: 0.5rem;
}

.offers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.offers--timeline {
  position: relative;
  padding-left: 0.5rem;
}

.offers--timeline::before {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
  border-radius: 2px;
  opacity: 0.35;
}

.offer {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem 0.85rem 1.35rem;
  background: #12161e;
  margin-left: 0.5rem;
  transition: border-color 0.25s ease, box-shadow 0.35s ease;
}

.offer::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 1rem;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  z-index: 1;
}

.offer--new {
  border-color: rgba(91, 141, 239, 0.65);
  box-shadow: 0 0 0 1px rgba(91, 141, 239, 0.2);
  animation: offer-pop 0.55s ease-out;
}

@keyframes offer-pop {
  0% {
    transform: translateX(-4px);
    opacity: 0.6;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.offer-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.offer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.offer-agent {
  font-weight: 600;
}

.offer-price {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent-hover);
}

.offer-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.offer-msg {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.empty {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.offer-replies {
  margin: 0.65rem 0 0;
  padding: 0.5rem 0 0;
  border-top: 1px dashed var(--border);
}

.offer-reply-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  padding-left: 0.5rem;
  border-left: 2px solid rgba(91, 141, 239, 0.35);
}

.offer-reply-line strong {
  color: var(--text);
  font-weight: 600;
}

.offer-reply-line .reply-kind {
  color: var(--accent-hover);
  font-weight: 600;
  text-transform: capitalize;
}

.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.btn-sm {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.btn-sm:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
}

.btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm.btn-accept {
  border-color: rgba(125, 255, 179, 0.45);
  color: #7dffb3;
}

.btn-sm.btn-decline {
  border-color: rgba(232, 93, 93, 0.45);
  color: var(--danger);
}

.btn-sm.btn-counter {
  border-color: rgba(91, 141, 239, 0.5);
  color: var(--accent-hover);
}

.offer-reply-form {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.offer-reply-form label {
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.offer-reply-form .row {
  margin-top: 0.5rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  max-width: 640px;
  width: 100%;
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.modal-lead {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}

.share-textarea {
  width: 100%;
  min-height: 280px;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0f14;
  color: var(--text);
  resize: vertical;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0;
}

.modal-status {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: #7dffb3;
}

/* ── Home page two-column grid ────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 620px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

.home-card-label {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.home-card-sub {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.home-card--join {
  border-color: rgba(125, 255, 179, 0.2);
}

.home-card--join .home-card-label {
  color: #7dffb3;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Offer stats strip ────────────────────────────────────── */
.offer-stats-card {
  padding: 0;
  overflow: hidden;
}

.offer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 540px) {
  .offer-stats {
    grid-template-columns: 1fr;
  }
}

.offer-stat {
  padding: 1.1rem 1.35rem;
  border-right: 1px solid var(--border);
  position: relative;
}

.offer-stat:last-child {
  border-right: none;
}

@media (max-width: 540px) {
  .offer-stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .offer-stat:last-child {
    border-bottom: none;
  }
}

.offer-stat-label {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.offer-stat-value {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.offer-stat-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offer-stat--low .offer-stat-value {
  color: #e8a85d;
}

.offer-stat--high .offer-stat-value {
  color: #7dffb3;
}

/* ── Room Owner badge ── */
.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #2d4a8a 0%, #1e3770 100%);
  color: #93c0ff;
  border: 1px solid #3b5fa8;
}
.owner-badge::before { content: "👑 "; }

/* ── Room notes band ── */
.room-notes-band {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: #161c2b;
  border: 1px solid #2d3c5e;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}
.room-notes-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 0.1rem; }
.room-notes-label {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.room-notes-owner { font-weight: 400; }
.room-notes-text { margin: 0; font-size: 0.95rem; color: var(--text); }

/* ── Timer band ── */
.room-timer-band {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #131c14;
  border: 1px solid #2d4a30;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  position: relative;
  overflow: hidden;
}
.room-timer-icon { font-size: 1.25rem; flex-shrink: 0; }
.room-timer-label {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.room-timer-value {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #7dffb3;
}
.room-timer-bar-wrap {
  flex: 1;
  height: 5px;
  background: #1e2e20;
  border-radius: 999px;
  overflow: hidden;
  margin-left: auto;
  min-width: 60px;
  max-width: 200px;
}
.room-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 1s linear, background 0.4s;
}

/* ── Entry gate modal ── */
.gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,12,18,0.92);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.gate-overlay[hidden] { display: none !important; }
.gate-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}
.gate-heading {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
}
.gate-sub {
  margin: 0 0 1.5rem;
  font-size: 0.83rem;
  color: var(--muted);
  font-family: var(--mono);
}
.gate-field {
  margin-bottom: 1rem;
}
.gate-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gate-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0f14;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s;
}
.gate-input:focus {
  outline: none;
  border-color: var(--accent);
}
.gate-input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}
.gate-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 1rem 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
}
.gate-consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.gate-tc-link { color: #3B82F6; text-decoration: underline; }
.gate-tc-link:hover { color: #60a5fa; }
.gate-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(232,93,93,0.1);
  border-radius: 6px;
  border: 1px solid rgba(232,93,93,0.3);
}
.gate-submit {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: none;
  background: #3B82F6;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 0.25rem;
}
.gate-submit:hover:not(:disabled) { background: #2563eb; }
.gate-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.gate-privacy-note {
  margin: 0.85rem 0 0;
  font-size: 0.77rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}
.gate-privacy-note a { color: var(--muted); text-decoration: underline; }

/* ── Room Settings card (negotiate-mode.html) ── */
#room-settings-wrap {
  margin-bottom: 1rem;
}
#room-settings-wrap textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0f14;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}
#room-settings-wrap textarea:focus,
#room-settings-wrap input:focus,
#room-settings-wrap select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.rs-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.rs-radio-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.rs-radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}
