/* ============================================================
   Ticket Marketplace Sandbox — visual system
   Redesigned with taste-skill (redesign-skill audit):
   self-hosted Geist, tinted off-black surfaces, single locked
   accent (no AI glow), depth, full interaction states, grain.
   ============================================================ */

/* ---- self-hosted variable fonts (font-display: swap) ---- */
@font-face {
  font-family: 'Geist';
  src: url('/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* cool-tinted off-black surface ramp (one gray family) */
  --bg: #0b0e13;
  --bg-2: #0e1218;
  --panel: #131922;
  --panel-2: #1a2230;
  --panel-3: #212b3a;
  --border: #222c3a;
  --border-strong: #2f3d4e;

  --text: #e9eff7;
  --muted: #8a98aa;
  --faint: #5c6b7d;

  /* single locked accent — electric blue, flat (no glow) */
  --accent: #5b8cff;
  --accent-2: #7aa2ff;
  --accent-ink: #08111f;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --accent-line: rgba(91, 140, 255, 0.32);

  /* data semantics only (never used as brand chrome) */
  --green: #35d39a;
  --red: #f76d68;
  --amber: #e3b341;
  --bid: #35d39a;
  --ask: #f76d68;

  /* tinted shadows (cool, never pure black) */
  --shadow-sm: 0 1px 2px rgba(4, 8, 14, 0.4);
  --shadow: 0 10px 34px -12px rgba(4, 9, 18, 0.7);
  --shadow-lg: 0 28px 60px -24px rgba(3, 8, 16, 0.85);

  --r-sm: 8px; --r: 14px; --r-lg: 20px; --r-xl: 28px;

  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --maxw: 1240px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  letter-spacing: -0.011em;
  position: relative;
  min-height: 100dvh;
}
/* subtle film grain — kills the sterile flat-vector look */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.4; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
/* ambient brand wash at the top (placeholder for shadergradient island) */
body::after {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 480px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 360px at 18% -8%, rgba(91, 140, 255, 0.14), transparent 60%),
    radial-gradient(700px 320px at 88% -12%, rgba(53, 211, 154, 0.08), transparent 62%);
}
#app, .topbar, .tabs, .footer, .disclaimer-banner { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.025em; }

/* ---------- topbar (asymmetric, layered) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 22px 32px 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(19, 25, 34, 0.6), rgba(11, 14, 19, 0));
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  font-size: 26px; color: var(--accent);
  width: 50px; height: 50px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r);
  background:
    linear-gradient(150deg, rgba(91, 140, 255, 0.22), rgba(91, 140, 255, 0.04)),
    var(--panel-2);
  border: 1px solid var(--accent-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-sm);
}
.topbar h1 { font-size: 19px; letter-spacing: -0.03em; }
.tagline { margin: 3px 0 0; color: var(--muted); font-size: 13px; max-width: 52ch; }
.scenario-controls { display: flex; align-items: center; gap: 10px; }
.scenario-controls label { color: var(--faint); font-size: 12px; }

select, button { font-family: inherit; }
select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 13px; font-size: 13.5px; cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
select:hover { border-color: var(--accent-line); }
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.ghost-btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 15px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}
.ghost-btn:hover { background: var(--panel-3); border-color: var(--accent-line); }
.ghost-btn:active { transform: translateY(1px) scale(0.99); }
.ghost-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- disclaimer ---------- */
.disclaimer-banner {
  background: rgba(227, 179, 65, 0.08);
  color: #e8c87a;
  border-bottom: 1px solid rgba(227, 179, 65, 0.18);
  padding: 11px 32px; font-size: 12.5px;
}
.disclaimer-banner strong { color: #f2d690; font-weight: 600; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 2px; padding: 0 24px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 19, 0.4);
  backdrop-filter: blur(6px);
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 15px 17px 13px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  white-space: nowrap; position: relative;
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}
.tab:focus-visible { outline: none; color: var(--text); box-shadow: inset 0 0 0 2px var(--accent-soft); border-radius: 6px; }

/* ---------- panels ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 34px 24px 80px; }
.panel { display: none; }
.panel.active { display: block; animation: rise 0.34s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-head { margin-bottom: 26px; max-width: 820px; }
.panel-head h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.035em; line-height: 1.05; text-wrap: balance; }
.panel-head p { color: var(--muted); margin: 10px 0 0; font-size: 14.5px; max-width: 68ch; text-wrap: pretty; }
.warn-text { color: #e8c87a !important; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.01em; }
.explain { color: var(--muted); font-size: 13.5px; max-width: 78ch; text-wrap: pretty; }

/* ---------- business simulator ---------- */
.sim-layout { display: grid; grid-template-columns: 348px 1fr; gap: 20px; align-items: start; }
.inputs { position: sticky; top: 16px; border-radius: var(--r-lg); }
.input-row { margin-bottom: 15px; }
.input-row label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 7px; color: var(--muted); }
.input-row label .val { color: var(--text); font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.input-group-title {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--faint); margin: 20px 0 13px; padding-top: 15px; border-top: 1px solid var(--border);
}
.input-group-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* refined range slider */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--panel-3); cursor: pointer; }
input[type=range]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(4, 9, 18, 0.6); transition: transform 0.12s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r);
  padding: 15px 16px; transition: transform 0.16s ease, border-color 0.18s ease; will-change: transform;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi .k-label { color: var(--muted); font-size: 11.5px; letter-spacing: -0.005em; }
.kpi .k-val { font-size: 23px; font-weight: 600; margin-top: 5px; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.kpi .k-sub { font-size: 11px; color: var(--faint); margin-top: 3px; }
.kpi.profit-pos .k-val { color: var(--green); }
.kpi.profit-neg .k-val { color: var(--red); }
.kpi.highlight { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--panel); }

.waterfall { display: flex; flex-direction: column; gap: 9px; }
.wf-row { display: grid; grid-template-columns: 150px 1fr 116px; align-items: center; gap: 14px; font-size: 13px; }
.wf-row .wf-name { color: var(--muted); }
.wf-bar-track { background: var(--panel-2); border-radius: 6px; height: 22px; overflow: hidden; }
.wf-bar { height: 100%; border-radius: 6px; transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.wf-bar.pos { background: linear-gradient(90deg, var(--green), #2bb886); }
.wf-bar.neg { background: linear-gradient(90deg, #d9534f, var(--red)); }
.wf-bar.total { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.wf-amt { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.wf-amt.neg { color: var(--red); }

.funnel { display: flex; flex-direction: column; gap: 7px; }
.fn-row { display: grid; grid-template-columns: 160px 1fr 92px; align-items: center; gap: 14px; font-size: 13px; }
.fn-bar-track { background: var(--panel-2); border-radius: 6px; height: 24px; overflow: hidden; }
.fn-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.fn-val { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.fn-name { color: var(--muted); }

/* ---------- order book ---------- */
.ob-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.ob-metric { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; text-align: center; }
.ob-metric .m-val { font-size: 21px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ob-metric .m-label { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.ob-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bid-h { color: var(--bid); } .ask-h { color: var(--ask); }
.ob-rows { display: flex; flex-direction: column; gap: 5px; }
.ob-row { display: grid; grid-template-columns: 72px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; position: relative; padding: 2px 0; }
.ob-depth { position: absolute; top: 0; bottom: 0; border-radius: 5px; opacity: 0.16; transition: width 0.3s ease; }
.ob-row.bid .ob-depth { background: var(--bid); right: 0; }
.ob-row.ask .ob-depth { background: var(--ask); right: 0; }
.ob-price { font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; z-index: 1; }
.ob-row.bid .ob-price { color: var(--bid); }
.ob-row.ask .ob-price { color: var(--ask); }
.ob-qbar { height: 18px; z-index: 1; }
.ob-qty { text-align: right; color: var(--muted); z-index: 1; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- liquidity ---------- */
.liq-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.liq-gauge-card { text-align: center; }
.gauge { padding: 22px 0 14px; }
.gauge-value { font-size: 52px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.gauge-label { font-size: 14px; margin-top: 4px; font-weight: 500; }
.gauge-bar { height: 10px; background: var(--panel-2); border-radius: 8px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 8px; transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.3s; }
.liq-detail .ld-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.liq-detail .ld-row:last-child { border-bottom: none; }
.liq-detail .ld-row span:first-child { color: var(--muted); }
.liq-detail .ld-row span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- competition ---------- */
.comp-bars { display: flex; flex-direction: column; gap: 16px; }
.comp-row { display: grid; grid-template-columns: 158px 1fr 96px; align-items: center; gap: 14px; font-size: 14px; }
.comp-track { background: var(--panel-2); border-radius: 7px; height: 28px; overflow: hidden; }
.comp-fill { height: 100%; border-radius: 7px; transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.comp-fill.you { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.comp-fill.them { background: linear-gradient(90deg, #313e51, #3c4b60); }
.comp-amt { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.comp-name .you-badge { color: var(--accent); font-size: 11px; display: block; margin-top: 2px; }

/* ---------- legal ---------- */
.legal-grid { display: grid; gap: 2px; }
.legal-row { display: grid; grid-template-columns: 210px 132px 1fr; gap: 14px; align-items: center; padding: 13px 8px; border-radius: var(--r-sm); transition: background 0.16s ease; }
.legal-row:hover { background: var(--panel-2); }
.legal-row .jur { font-weight: 600; }
.legal-row .note { color: var(--muted); font-size: 13px; }
.risk-pill { padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-align: center; letter-spacing: -0.005em; }
.risk-low { background: rgba(53, 211, 154, 0.13); color: var(--green); }
.risk-med { background: rgba(227, 179, 65, 0.13); color: var(--amber); }
.risk-high { background: rgba(247, 109, 104, 0.13); color: var(--red); }
.safer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.safer-item { background: var(--panel-2); border-radius: var(--r); padding: 13px 14px; border: 1px solid var(--border); }
.safer-item .si-label { color: var(--faint); font-size: 11.5px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.safer-item .si-val { margin-top: 5px; font-size: 14px; }

/* ---------- investor ---------- */
.investor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.inv-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); transition: transform 0.16s ease, border-color 0.18s ease; }
.inv-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.inv-card h3 { font-size: 17px; letter-spacing: -0.02em; }
.inv-card .inv-tag { font-size: 11.5px; color: var(--accent); margin-bottom: 16px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
.inv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.inv-row:last-child { border-bottom: none; }
.inv-row span:first-child { color: var(--muted); }
.inv-row .iv { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.inv-row.profit { margin-top: 4px; padding-top: 13px; }
.inv-row.profit span:first-child { color: var(--text); font-weight: 500; }
.inv-row.profit .iv { font-weight: 600; font-size: 15px; }
.inv-row.profit .iv.pos { color: var(--green); }
.inv-row.profit .iv.neg { color: var(--red); }

/* ---------- journeys ---------- */
.journey-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.journey-col h3 { font-size: 15px; margin-bottom: 14px; }
.journey-step { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin-bottom: 9px; font-size: 13.5px; display: flex; gap: 12px; align-items: flex-start; transition: border-color 0.18s ease, transform 0.14s ease; }
.journey-step:hover { border-color: var(--accent-line); transform: translateX(2px); }
.journey-step .num { color: var(--accent); font-weight: 700; font-family: var(--mono); font-size: 12px; padding-top: 1px; }

/* ---------- footer ---------- */
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto; padding: 22px 24px 30px;
  border-top: 1px solid var(--border); color: var(--faint); font-size: 12.5px;
}
.footer a { color: var(--muted); text-decoration: none; transition: color 0.16s ease; }
.footer a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .sim-layout, .liq-layout { grid-template-columns: 1fr; }
  .inputs { position: static; }
  .kpi-grid, .ob-metrics, .investor-grid, .journey-grid { grid-template-columns: 1fr 1fr; }
  .ob-layout, .safer-grid { grid-template-columns: 1fr; }
  .topbar { padding: 18px 20px; }
  main { padding: 26px 18px 64px; }
}
@media (max-width: 560px) {
  .kpi-grid, .ob-metrics, .investor-grid, .journey-grid { grid-template-columns: 1fr; }
  .wf-row, .fn-row, .comp-row { grid-template-columns: 104px 1fr 84px; }
  .legal-row { grid-template-columns: 1fr; gap: 6px; }
  .scenario-controls { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Iter 2 — effect-library integration layers
   ============================================================ */

/* ruucm/shadergradient ambient background (fixed, header region, masked) */
#shader-bg {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 620px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 100%);
}
#shader-bg canvas { display: block; width: 100% !important; height: 100% !important; }
/* once the live shader mounts, drop the static CSS fallback wash */
body:has(#shader-bg[data-fx='on'])::after { opacity: 0; }

/* paper-design liquid-metal brand mark fills the logo tile */
.logo#brand-logo { overflow: hidden; padding: 0; }
#brand-logo[data-fx='on'] { color: transparent; }
#brand-logo canvas { width: 100% !important; height: 100% !important; border-radius: inherit; display: block; }

/* dashersw/liquid-glass-js floating pill */
#glass-dock {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 60;
}
#glass-dock .glass-button {
  box-shadow: 0 18px 40px -16px rgba(3, 8, 16, 0.8);
}
#glass-dock .glass-button-text {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  text-transform: lowercase;
}
@media (max-width: 560px) { #glass-dock { right: 12px; bottom: 12px; } }
@media (prefers-reduced-motion: reduce) { #shader-bg { opacity: 0.32; } }
