/* ===== Design tokens ===== */
:root {
  --bg: #0A0E13;
  --bg-elevated: #10151C;
  --bg-elevated-2: #151C25;
  --border: #1E262F;
  --text: #E8EEF2;
  --text-muted: #7C8B99;
  --teal: #00D9C0;
  --teal-dim: #00D9C022;
  --violet: #7C5CFF;
  --green: #39FF88;
  --amber: #FFB020;
  --red: #FF5C5C;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, #0F2E2A 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, #201640 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* subtle scanline texture, evokes signal/CRT without being loud */
.noise-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--teal); color: #04140F; }
.btn-primary:hover { background: #22e6cf; }
.btn-primary:disabled { background: #1c2b29; color: var(--text-muted); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-text { background: none; color: var(--teal); font-weight: 600; text-decoration: none; padding: 10px 4px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== Topbar ===== */
.topbar { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px); background: rgba(10,14,19,0.7); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--teal), var(--violet)); box-shadow: 0 0 18px var(--teal-dim); }
.brand-mark.small { width: 16px; height: 16px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.topbar-nav { display: flex; align-items: center; gap: 18px; }
.topbar-nav a { text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500; }
.topbar-nav a:hover { color: var(--text); }
.wallet-pill { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; }
.wallet-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ===== Hero ===== */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; padding: 90px 24px 80px; }
.eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--teal); font-size: 12px; margin: 0 0 18px; }
.hero-copy h1 { font-size: 52px; line-height: 1.06; margin-bottom: 20px; }
.hero-sub { color: var(--text-muted); font-size: 17px; max-width: 46ch; margin-bottom: 32px; }
.hero-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

/* ===== Terminal (signature element) ===== */
.hero-terminal, .live-active .terminal-chrome + .terminal-body {
  background: var(--bg-elevated);
}
.hero-terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(0,217,192,0.15), 0 0 0 1px rgba(255,255,255,0.02);
}
.terminal-chrome { display: flex; align-items: center; gap: 7px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-elevated-2); }
.chip { width: 9px; height: 9px; border-radius: 50%; }
.chip-red { background: #FF5F57; } .chip-amber { background: #FEBC2E; } .chip-green { background: #28C840; }
.terminal-label { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.terminal-body { padding: 22px; font-family: var(--font-mono); font-size: 14px; min-height: 190px; }
.term-line { margin-bottom: 12px; }
.term-prompt { color: var(--teal); margin-right: 6px; }
.term-dim { color: var(--text-muted); font-size: 13px; }
.term-result { color: var(--text); font-size: 16px; font-weight: 500; }
.term-code { color: var(--green); }
.term-code span { font-weight: 600; letter-spacing: 0.04em; }
.term-cursor { display: inline-block; width: 8px; height: 15px; background: var(--teal); animation: blink 1.1s step-end infinite; }
.term-dots::after { content: ''; animation: dots 1.4s steps(4, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } 100% { content: ''; } }

/* ===== Signal chain (how it works) ===== */
.signal-chain { display: flex; align-items: flex-start; gap: 0; padding: 40px 24px 100px; border-top: 1px solid var(--border); padding-top: 60px; }
.chain-step { flex: 1; }
.chain-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--violet); display: block; margin-bottom: 10px; }
.chain-step p { color: var(--text-muted); font-size: 15px; max-width: 34ch; margin: 0; }
.chain-connector { flex: 0 0 60px; height: 1px; background: linear-gradient(90deg, var(--border), var(--teal), var(--border)); margin-top: 6px; align-self: flex-start; }

/* ===== Services ===== */
.services-section { padding: 20px 24px 110px; }
.section-head { margin-bottom: 28px; }
.section-head h2 { font-size: 30px; margin-bottom: 8px; }
.services-search input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--text); font-family: var(--font-body); font-size: 15px; margin-bottom: 24px;
}
.services-search input:focus { outline: none; border-color: var(--teal); }
.services-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.service-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s ease, transform 0.15s ease;
}
.service-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.service-name { font-weight: 600; font-size: 15px; }
.service-price { font-family: var(--font-mono); color: var(--teal); font-size: 16px; }
.service-skeleton { height: 84px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-elevated), var(--bg-elevated-2), var(--bg-elevated)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Footer ===== */
.site-footer { padding: 40px 24px 60px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ===== Dashboard ===== */
.dash-wrap { padding: 48px 24px 80px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; margin-bottom: 28px; }
.panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel h3 { font-size: 17px; margin-bottom: 18px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--teal); }
.price-row { font-family: var(--font-mono); font-size: 15px; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); margin-bottom: 18px; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

.panel-live { display: flex; align-items: center; justify-content: center; min-height: 260px; }
.live-empty { text-align: center; color: var(--text-muted); font-size: 14px; }
.pulse-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); margin-bottom: 14px; }
.live-active { width: 100%; }
.live-active .terminal-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.live-active .terminal-chrome { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border: 1px solid var(--border); border-bottom: none; }
#btnCancelOrder { margin-top: 14px; }

.panel-history table { width: 100%; border-collapse: collapse; }
.history-table th { text-align: left; font-size: 12px; color: var(--text-muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.history-table td { padding: 12px; font-size: 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.status-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-family: var(--font-body); font-weight: 600; }
.status-waiting { background: #3a2c0022; color: var(--amber); }
.status-received { background: #0a2f1e; color: var(--green); }
.status-cancelled { background: #2a1414; color: var(--red); }

/* ===== Modals ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4,6,9,0.75); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 400px; position: relative; }
.modal h3 { margin-bottom: 20px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-switch { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 18px; }
.modal-switch button { background: none; border: none; color: var(--teal); font-weight: 600; cursor: pointer; font-size: 13px; margin-left: 4px; }
.form-error { color: var(--red); font-size: 13px; margin: -8px 0 14px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-copy h1 { font-size: 38px; }
  .signal-chain { flex-direction: column; gap: 28px; }
  .chain-connector { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .topbar-nav a { display: none; }
}

/* ===== Accessibility ===== */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
