/* ==========================================================================
   TreviEarth — styles
   Dark "space" theme. No frameworks, no build step.
   ========================================================================== */

:root {
  --bg: #05070f;
  --panel: rgba(12, 18, 32, 0.86);
  --panel-border: rgba(90, 130, 200, 0.22);
  --text: #e8eefc;
  --muted: #8fa3c7;
  --accent: #4f9dff;
  --accent-2: #ff5a3c;
  --land: #2f8f4e;
  --radius: 12px;
  --ticker-h: 56px;
  --panel-w: 320px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* ---------------------------------------------------------------- globe */

#globe {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#globe canvas {
  display: block;
}

/* --------------------------------------------------------------- topbar */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.85), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7fe0a5, var(--land));
  box-shadow: 0 0 16px rgba(79, 157, 255, 0.5);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.4px;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.badge {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--muted);
}

/* Call to action: starts the "place an ad" flow */
.cta {
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #04121f;
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(79, 157, 255, 0.28);
  transition: filter 0.15s, transform 0.15s;
}

.cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.cta.hidden {
  display: none;
}

/* Wallet connect button + connected state */
.wallet {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s;
}

.wallet:hover {
  border-color: var(--accent);
}

.wallet.connected {
  color: var(--muted);
}

.wallet .wallet-balance {
  color: #7fe0a5;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}

/* Checkout block */
.checkout {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(79, 157, 255, 0.07);
}

.checkout[hidden] {
  display: none;
}

.checkout button {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #04121f;
}

.checkout button.ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-weight: 500;
}

.checkout button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ hud */

#hud {
  position: fixed;
  left: 20px;
  bottom: calc(var(--ticker-h) + 16px);
  z-index: 10;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 6px 10px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

/* ---------------------------------------------------------------- panel */

#panel {
  position: fixed;
  top: 84px;
  right: 20px;
  width: var(--panel-w);
  max-height: calc(100vh - var(--ticker-h) - 120px);
  overflow-y: auto;
  z-index: 10;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  animation: panel-in 0.18s ease-out;
}

#panel[hidden] {
  display: none;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.panel-close:hover {
  color: var(--text);
}

.panel-hint {
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

#panel h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.price-box,
.selection-box {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.price-row:last-child {
  margin-bottom: 0;
}

.price-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hint,
.note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: 8px 0 0;
}

.note {
  margin-top: 14px;
  border-top: 1px dashed var(--panel-border);
  padding-top: 12px;
}

.field,
.field-inline {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.field-inline input {
  width: 130px;
}

input[type="text"],
input[type="url"],
input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 13px;
}

input[type="file"] {
  font-size: 11px;
  color: var(--muted);
}

input[type="color"] {
  width: 44px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: transparent;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  font-family: inherit;
}

#ad-form button {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #04121f;
  transition: filter 0.15s;
}

#ad-form button:hover {
  filter: brightness(1.1);
}

#ad-form button.ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-weight: 500;
}

#ad-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-msg {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--accent-2);
}

.form-msg.ok {
  color: #7fe0a5;
}

/* ------------------------------------------------------------- ad list */

.ads-list {
  margin-top: 16px;
}

.ads-list .ad-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-border);
  font-size: 12px;
}

.ads-list .ad-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex: 0 0 auto;
  background-size: cover;
  background-position: center;
}

.ads-list .ad-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.ads-list .ad-px {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ads-list .ad-del {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
}

/* --------------------------------------------------------------- ticker */

#ticker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ticker-h);
  z-index: 11;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--panel-border);
  background: rgba(8, 12, 22, 0.92);
  backdrop-filter: blur(14px);
}

.ticker-label {
  flex: 0 0 auto;
  padding: 0 16px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--panel-border);
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-lr var(--ticker-duration, 40s) linear infinite;
}

/* Left -> right scroll (content moves right, so we start shifted left). */
@keyframes ticker-lr {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

.ticker-viewport:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}

.ticker-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: inline-block;
  object-fit: cover;
}

.ticker-name {
  font-weight: 600;
}

.ticker-pixels {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ticker-item:hover .ticker-name {
  color: var(--accent);
}

.ticker-empty {
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 860px) {
  #panel {
    top: auto;
    bottom: calc(var(--ticker-h) + 12px);
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 46vh;
  }

  #hud {
    display: none;
  }

  .brand p {
    display: none;
  }
}
