/* ============================================================
   PREDICTED — design system
   Warm premium base + a touch of playful
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;0,600;0,700;0,800;1,500;1,600&display=swap');

:root {
  /* fonts */
  --font-display: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-sans: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-mono: 'Spectral', Georgia, 'Times New Roman', serif;

  /* warm paper palette */
  --paper: #f7f3ec;          /* app background */
  --paper-2: #efe9df;        /* deeper warm panel */
  --surface: #fffdfa;        /* cards */
  --surface-2: #faf6f0;      /* inset / subtle */
  --ink: #1b2030;            /* primary text — deep ink-navy */
  --ink-2: #545a6b;          /* secondary text */
  --ink-3: #8a8f9e;          /* tertiary / muted */
  --line: #e9e1d4;           /* warm border */
  --line-2: #f0e9dd;

  /* brand accent — violet */
  --violet: #6a4df4;
  --violet-ink: #4f37c9;
  --violet-soft: #ece8ff;
  --violet-soft-2: #f4f1ff;

  /* outcome colors */
  --yes: #1f9d61;
  --yes-ink: #157a4a;
  --yes-soft: #e4f3ea;
  --no: #e8473f;
  --no-ink: #c5352e;
  --no-soft: #fdeae8;

  /* status */
  --gold: #d6a126;
  --gold-soft: #f8eecf;
  --blue: #2f6fed;

  /* radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* shadow */
  --sh-sm: 0 1px 2px rgba(27,32,48,.05), 0 1px 1px rgba(27,32,48,.04);
  --sh-md: 0 2px 4px rgba(27,32,48,.04), 0 8px 22px rgba(27,32,48,.07);
  --sh-lg: 0 8px 18px rgba(27,32,48,.06), 0 24px 60px rgba(27,32,48,.10);
  --sh-violet: 0 8px 22px rgba(106,77,244,.28);

  --maxw: 1240px;
}

html { scroll-behavior: smooth; }

/* ---------- dark mode ---------- */
[data-theme="dark"] {
  --paper: #14151c;
  --paper-2: #1a1c25;
  --surface: #1e2029;
  --surface-2: #23252f;
  --ink: #f3f1ee;
  --ink-2: #aab0c0;
  --ink-3: #7b8092;
  --line: #2c2f3a;
  --line-2: #262932;
  --violet-soft: #2a2550;
  --violet-soft-2: #221f3f;
  --yes-soft: #143025;
  --no-soft: #34191a;
  --gold-soft: #332b14;
  --sh-md: 0 2px 4px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.4);
  --sh-lg: 0 8px 18px rgba(0,0,0,.35), 0 24px 60px rgba(0,0,0,.5);
}

/* lavender theme variant */
[data-tone="lavender"] {
  --paper: #f3f0fb;
  --paper-2: #eae5f8;
  --surface: #ffffff;
  --surface-2: #f7f4fe;
  --line: #e7e1f6;
  --line-2: #efeaf9;
}
/* clean purple theme variant */
[data-tone="purple"] {
  --paper: #f1eefb;
  --paper-2: #e6e0f7;
  --surface: #ffffff;
  --surface-2: #f6f3fd;
  --line: #e4ddf5;
  --line-2: #ede8f8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
::selection { background: var(--violet-soft); color: var(--violet-ink); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4,h5 { margin: 0; }
p { margin: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--paper); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; letter-spacing: -.02em; }
.serif { font-family: var(--font-display); }
.muted { color: var(--ink-2); }
.muted-3 { color: var(--ink-3); }

/* layout helpers */
.app-shell { min-height: 100vh; background: var(--paper); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 2px; } .gap-3 { gap: 3px; } .gap-4 { gap: 4px; } .gap-5 { gap: 5px; } .gap-6{gap:6px;} .gap-7 { gap: 7px; } .gap-8 { gap: 8px; } .gap-10{gap:10px;} .gap-12 { gap: 12px; }
.gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-18 { gap: 18px; } .gap-20 { gap: 20px; } .gap-22 { gap: 22px; } .gap-24 { gap: 24px; } .gap-28 { gap: 28px; }
.spacer { flex: 1; }
.center { align-items: center; }
.between { justify-content: space-between; }
.wrap-flex { flex-wrap: wrap; }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: 22px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 700; font-size: 15px; letter-spacing: -.01em;
  padding: 12px 20px; border-radius: var(--r-md);
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { box-shadow: var(--sh-md); }
.btn-violet { background: var(--violet); color: #fff; box-shadow: var(--sh-violet); }
.btn-violet:hover { background: var(--violet-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-soft { background: var(--violet-soft); color: var(--violet-ink); }
.btn-soft:hover { background: var(--violet-soft-2); }
.btn-yes { background: var(--yes); color: #fff; }
.btn-yes:hover { background: var(--yes-ink); }
.btn-no { background: var(--no); color: #fff; }
.btn-no:hover { background: var(--no-ink); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* icon button */
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* ============================================================
   CHIPS / BADGES
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  transition: .14s; white-space: nowrap;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-dot { width: 8px; height: 8px; border-radius: 999px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.badge-live { background: var(--yes-soft); color: var(--yes-ink); }
.badge-pending { background: var(--gold-soft); color: var(--gold); }
.badge-resolved { background: var(--violet-soft); color: var(--violet-ink); }
.badge-disputed { background: var(--no-soft); color: var(--no-ink); }
.badge-closed { background: var(--paper-2); color: var(--ink-2); }
.badge-cat { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; padding: 5px 11px; }

.pulse-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--yes); box-shadow: 0 0 0 0 rgba(31,157,97,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(31,157,97,.45);} 70%{box-shadow:0 0 0 7px rgba(31,157,97,0);} 100%{box-shadow:0 0 0 0 rgba(31,157,97,0);} }

/* ============================================================
   PROBABILITY BAR
   ============================================================ */
.probar { display: flex; height: 44px; border-radius: var(--r-md); overflow: hidden; background: var(--no); }
.probar .yes-seg { background: var(--yes); display: flex; align-items: center; padding: 0 14px; color: #fff; font-weight: 800; transition: width .5s cubic-bezier(.2,.8,.2,1); white-space: nowrap; overflow: hidden; }
.probar .no-seg { flex: 1; display: flex; align-items: center; justify-content: flex-end; padding: 0 14px; color: #fff; font-weight: 800; white-space: nowrap; }
.probar.thin { height: 30px; border-radius: var(--r-sm); font-size: 13px; }
.probar.mini { height: 8px; border-radius: 999px; }
.probar.is-unavailable { background: var(--paper-2); }
.probar.is-unavailable .yes-seg { background: transparent; }
.market-live-prices .probar { position: relative; }
.market-live-prices .probar .yes-seg { padding: 0; }
.market-price-bar-label {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center;
  color: #fff; font-weight: 800; white-space: nowrap; pointer-events: none;
}
.market-price-bar-label.yes { left: 12px; }
.market-price-bar-label.no { right: 12px; }

/* category tile icon */
.cat-tile { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* avatar */
.av { border-radius: 999px; object-fit: cover; background: var(--paper-2); border: 2px solid var(--surface); display:inline-flex;align-items:center;justify-content:center;font-weight:700;color:#fff; overflow: hidden; }
.av-stack { display: flex; }
.av-stack .av:not(:first-child) { margin-left: -10px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--paper-2) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0%{background-position:100% 0;} 100%{background-position:-100% 0;} }

/* placeholder art */
.ph-art {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background-image: repeating-linear-gradient(135deg, var(--violet-soft) 0 14px, var(--violet-soft-2) 14px 28px);
  display: flex; align-items: center; justify-content: center;
}
.ph-art .ph-label { font-family: var(--font-mono); font-size: 12px; color: var(--violet-ink); background: var(--surface); padding: 6px 12px; border-radius: 999px; box-shadow: var(--sh-sm); }

/* tag pill (small inline) */
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }

/* sections */
.section-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; display:flex;align-items:center;gap:9px; }
.link-violet { color: var(--violet); font-weight: 700; font-size: 14px; display:inline-flex;align-items:center;gap:5px; }
.link-violet:hover { color: var(--violet-ink); }

/* divider */
.hr { height: 1px; background: var(--line); border: none; margin: 0; }

/* toast */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 9000; }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; min-width: 300px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-lg);
  animation: toastIn .35s cubic-bezier(.2,.9,.2,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

@keyframes spin { to { transform: rotate(360deg); } }

/* fade/slide in — transform only (opacity stays 1 so captures/PDF/print never flash empty) */
@keyframes fadeUp { from { transform: translateY(12px); } to { transform: none; } }
.fade-up { animation: fadeUp .5s cubic-bezier(.2,.8,.2,1) both; }

/* tab underline nav */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { width: 0; height: 0; display: none; }
.tab { padding: 12px 4px; margin: 0 12px 0 0; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .15s; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-color: var(--violet); }

/* input */
.inp {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font-size: 15px; transition: .15s; outline: none;
}
.inp:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.inp::placeholder { color: var(--ink-3); }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; display:block; }
.field-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,22,30,.5); backdrop-filter: blur(3px); z-index: 8000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeUp .2s ease; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg); width: 100%; max-width: 440px; overflow: hidden; animation: modalIn .35s cubic-bezier(.2,.9,.2,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }

/* orderbook */
.ob-row { position: relative; display: flex; justify-content: space-between; padding: 6px 10px; font-family: var(--font-mono); font-size: 12.5px; border-radius: 6px; overflow: hidden; }
.ob-fill { position: absolute; inset: 0 auto 0 0; opacity: .12; }

/* responsive */
@media (max-width: 1080px) {
  .wrap { padding: 0 18px; }
}

/* ============================================================
   Server-rendered Tenera components
   These classes encode the inline structure from the original design prototype (JSX)
   for FastAPI/Jinja templates.
   ============================================================ */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; display: block; }
.icon-fill { fill: currentColor; stroke: none; }
.logo-mark { height: 36px; width: auto; display: block; flex-shrink: 0; filter: drop-shadow(0 3px 6px rgba(48,26,92,.18)); }
.logo-text { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.app-header { position: sticky; top: 0; z-index: 500; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.app-header-inner { height: 70px; gap: 22px; }
.app-nav { margin-left: 8px; }
.app-nav a { padding: 8px 13px; border-radius: var(--r-sm); font-weight: 600; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; }
.app-nav a.active { color: var(--ink); background: var(--surface-2); }
.app-search { gap: 10px; padding: 0 14px; height: 42px; flex: 0 1 250px; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink-3); }
.app-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--ink); }
.app-search kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--ink-3); background: var(--surface-2); }
.home-search-mobile { display: none; }
.app-search,
.home-search-mobile,
.search-page-form { position: relative; }
.market-search-suggestions {
  position: absolute; z-index: 800; top: calc(100% + 8px); left: 0; right: 0;
  max-height: min(440px, 70vh); overflow-y: auto; padding: 7px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  box-shadow: var(--sh-lg); color: var(--ink); text-align: left;
}
.market-search-suggestion-heading {
  padding: 7px 10px 5px; color: var(--ink-3); font-family: var(--font-mono);
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.market-search-suggestion {
  display: flex; flex-direction: column; gap: 3px; padding: 10px;
  border-radius: var(--r-sm); color: var(--ink);
}
.market-search-suggestion:hover,
.market-search-suggestion.is-active { background: var(--violet-soft); color: var(--violet-ink); }
.market-search-suggestion-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.market-search-suggestion-meta { color: var(--ink-3); font-size: 11.5px; }
.market-search-suggestion-empty { padding: 16px 10px; color: var(--ink-3); font-size: 13px; text-align: center; }
.market-search-all-results {
  display: block; margin-top: 5px; padding: 10px; border-top: 1px solid var(--line-2);
  color: var(--violet); font-size: 12.5px; font-weight: 800; text-align: center;
}
.search-page { min-height: calc(100vh - 170px); padding-top: 38px; padding-bottom: 72px; }
.search-page-heading { max-width: 720px; }
.search-page-form {
  display: flex; align-items: center; gap: 12px; width: min(720px, 100%);
  margin-top: 22px; padding: 7px 7px 7px 16px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-sm); color: var(--ink-3);
}
.search-page-form:focus-within { border-color: color-mix(in srgb, var(--violet) 55%, var(--line)); }
.search-page-form input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: 16px;
}
.search-results-header { margin-top: 28px; margin-bottom: 16px; }
.search-results-section { margin-bottom: 28px; }
.search-result-description {
  display: -webkit-box; overflow: hidden; color: var(--ink-2); font-size: 13px; line-height: 1.45;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 28px; }

.market-thumb { position: relative; min-width: 0; overflow: hidden; flex-shrink: 0; background-position: center; background-size: cover; background-repeat: no-repeat; }
.market-thumb-placeholder { position: absolute; inset: 0; background-image: repeating-linear-gradient(135deg, rgba(106,77,244,.06) 0 10px, transparent 10px 20px); }
.market-thumb-label { position: absolute; left: 8px; bottom: 8px; font-size: 9.5px; letter-spacing: .04em; color: var(--violet-ink); background: var(--surface); padding: 2px 7px; border-radius: 999px; box-shadow: var(--sh-sm); }
.cat-tile.server { background: var(--violet-soft); color: var(--violet); }
.cat-politics { background: rgba(47,111,237,.14); color: #2f6fed; }
.cat-sports { background: rgba(232,132,63,.14); color: #e8843f; }
.cat-crypto { background: rgba(214,161,38,.16); color: #d6a126; }
.cat-ai { background: rgba(15,163,127,.14); color: #0fa37f; }
.cat-economy { background: rgba(197,53,46,.12); color: #c5352e; }
.cat-entertainment { background: rgba(177,77,244,.14); color: #b14df4; }

.hero-home { background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: .82fr 1.18fr; gap: 24px; align-items: center; }
.hero-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 3.4vw, 54px); line-height: 1.06; letter-spacing: -.03em; }
.featured-card { padding: 22px; box-shadow: var(--sh-lg); }

/* Hero floating object scene */
.hero-scene {
  position: relative;
  height: 520px;
  align-self: center;
  pointer-events: none;
}
.float-anchor {
  position: absolute;
  transform: translate(-50%, -50%);
}
.float-obj {
  will-change: transform;
  animation: floaty var(--d, 6.5s) ease-in-out infinite;
  animation-delay: var(--dl, 0s);
}
.float-obj img {
  display: block;
  width: 100%;
  height: auto;
  animation: objShadow var(--d, 6.5s) ease-in-out infinite;
  animation-delay: var(--dl, 0s);
}
/* Keep the urn itself filter-free: filtering its transparent pixels forces the
   browser to flatten the fine glass and gold detail into a softer bitmap layer.
   The shadow lives on a separate pseudo-element so the artwork stays crisp while
   the parent continues to float. */
.urn-obj {
  position: relative;
  isolation: isolate;
}
.urn-obj::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 13%;
  right: 13%;
  bottom: 1.5%;
  height: 9%;
  border-radius: 50%;
  background: rgba(48, 26, 92, .28);
  filter: blur(16px);
  transform: translateY(9px) scaleX(.94);
  pointer-events: none;
}
.float-obj img.urn-float {
  animation: none;
  position: relative;
  z-index: 1;
  filter: none;
  image-rendering: -webkit-optimize-contrast;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-13.5px) rotate(var(--rot, 0deg)); }
}
/* --shd (shadow depth, default 1) is inherited from each object's position class:
   lower objects in the scene get a bigger, darker shadow pool, reading as the
   surface they hover above; higher objects cast a fainter, more diffuse shadow. */
@keyframes objShadow {
  0%, 100% {
    filter:
      drop-shadow(0 calc(13px * var(--shd, 1)) calc(16px * var(--shd, 1)) rgba(48,26,92, calc(.26 * var(--shd, 1))))
      drop-shadow(0 calc(4px * var(--shd, 1)) calc(4px * var(--shd, 1)) rgba(48,26,92, calc(.16 * max(var(--shd, 1) - .85, 0))))
      brightness(.985);
  }
  50% {
    filter:
      drop-shadow(0 calc(27px * var(--shd, 1)) calc(28px * var(--shd, 1)) rgba(48,26,92, calc(.14 * var(--shd, 1))))
      drop-shadow(0 calc(9px * var(--shd, 1)) calc(8px * var(--shd, 1)) rgba(48,26,92, calc(.09 * max(var(--shd, 1) - .85, 0))))
      brightness(1.02);
  }
}
.mkt-up {
  width: 168px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px 12px;
  animation: cardShadow var(--d, 6.5s) ease-in-out infinite;
  animation-delay: var(--dl, 0s);
}
@keyframes cardShadow {
  0%, 100% { box-shadow: 0 calc(12px * var(--shd, 1)) calc(18px * var(--shd, 1)) -8px rgba(48,26,92, calc(.32 * var(--shd, 1))); }
  50% { box-shadow: 0 calc(26px * var(--shd, 1)) calc(30px * var(--shd, 1)) -10px rgba(48,26,92, calc(.17 * var(--shd, 1))); }
}
.mkt-up .mkt-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-2);
  font-weight: 700;
}
.mkt-up .mkt-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 7px; }
.mkt-up .mkt-pct { font-weight: 800; font-size: 17px; color: var(--yes-ink); letter-spacing: -.02em; }
@media (prefers-reduced-motion: reduce) {
  .float-obj { animation: none; }
  .float-obj img { animation: none; filter: drop-shadow(0 calc(16px * var(--shd, 1)) calc(18px * var(--shd, 1)) rgba(48,26,92, calc(.22 * var(--shd, 1)))); }
  .mkt-up { animation: none; box-shadow: var(--sh-lg); }
}

.market-card { text-align: left; padding: 0; display: flex; flex-direction: column; overflow: hidden; transition: transform .14s, box-shadow .15s; cursor: pointer; color: inherit; }
.market-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.market-card-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.market-card-title { font-family: var(--font-display); font-weight: 600; font-size: 17.5px; line-height: 1.25; letter-spacing: -.01em; min-height: 44px; text-wrap: pretty; }
.market-grid-design { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.trend-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.home-guides { scroll-margin-top: 88px; }
.guide-card { position: relative; overflow: hidden; }
.guide-card-icon {
  width: 34px; height: 34px; flex: none; padding: 8px; border-radius: 12px;
  color: var(--violet); background: var(--violet-soft); box-sizing: content-box;
}
.create-guide-card { background: linear-gradient(145deg, var(--surface) 0%, var(--violet-soft-2) 145%); }
.guide-intro { line-height: 1.55; min-height: 44px; }
.guide-list { display: grid; gap: 10px; }
.guide-step {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 13px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid transparent;
}
.guide-step:hover { border-color: var(--line); }
.guide-step-number {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; color: var(--violet-ink); background: var(--violet-soft);
  font-family: var(--font-mono); font-size: 11px; font-weight: 800;
}
.guide-step > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.guide-step b { font-size: 14.5px; }
.guide-step div span { color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.trust-strip { background: var(--surface); }

.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 28px; align-items: start; }
.detail-title { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.big-stat-value { font-size: 21px; font-weight: 700; }
.detail-thumb { width: 168px; flex-shrink: 0; }
.market-desc { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.market-desc.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.desc-toggle { align-self: flex-start; background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--violet); cursor: pointer; }
.desc-toggle:hover { text-decoration: underline; }
.trading-sticky { position: sticky; top: 86px; overflow: hidden; }
.trade-toggle { padding: 6px; gap: 4px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.trade-toggle button { flex: 1; padding: 9px; border-radius: var(--r-sm); font-weight: 700; font-size: 14px; text-transform: capitalize; color: var(--ink-3); }
.trade-toggle button.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-sm); }
.trade-toggle button.active.buy-yes { background: var(--yes); color: #fff; }
.trade-toggle button.active.buy-no { background: var(--no); color: #fff; }
.outcome-choice { flex: 1; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--surface); }
.outcome-choice.yes.active { border-color: var(--yes); background: var(--yes-soft); }
.outcome-choice.no.active { border-color: var(--no); background: var(--no-soft); }
.trade-amount { border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 14px; background: var(--surface); }
.trade-amount input { flex: 1; border: none; outline: none; background: transparent; font-size: 26px; font-weight: 700; padding: 12px 6px; width: 100%; }
.calc-box { background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; }
.calc-row { padding: 4px 0; }
.ob-row { position: relative; display: flex; justify-content: space-between; padding: 6px 10px; font-family: var(--font-mono); font-size: 12.5px; border-radius: 6px; overflow: hidden; }
.ob-fill { position: absolute; inset: 0 auto 0 0; opacity: .12; }
.chart-placeholder { min-height: 180px; border-radius: var(--r-md); background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid var(--line); position: relative; overflow: hidden; }
.chart-placeholder svg { width: 100%; height: 180px; display: block; }

.create-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 28px; align-items: start; }
.create-preview { position: sticky; top: 86px; }
.upload-box { padding: 14px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.outcome-pill { flex: 1; padding: 12px 16px; border-radius: var(--r-md); }
.outcome-pill.yes { background: var(--yes-soft); border: 1px solid var(--yes); }
.outcome-pill.no { background: var(--no-soft); border: 1px solid var(--no); }

.mod-grid { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 24px; align-items: start; }
.mod-tabs { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.mod-tabs-inner { background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; }
.mod-tabs button { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.mod-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-sm); }
.queue-item { text-align: left; padding: 15px 20px; border-top: 1px solid var(--line-2); border-left: 3px solid transparent; }
.queue-item:first-child { border-top: 0; }
.queue-item.active { background: var(--surface-2); border-left-color: var(--violet); }
.mod-review { position: sticky; top: 86px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.admin-item { min-width: 0; }
.value { word-break: break-word; }

.hidden { display: none !important; }
.tx-result, .result { margin-top: 10px; border-radius: var(--r-md); padding: 10px 12px; font-size: 12px; line-height: 1.45; font-weight: 700; word-break: break-word; }
.tx-info, .info { background: #eef5ff; border: 1px solid #9ebae8; color: #20376f; }
.tx-ok, .ok { background: var(--yes-soft); border: 1px solid color-mix(in srgb, var(--yes) 35%, var(--line)); color: var(--yes-ink); }
.tx-err, .err { background: var(--no-soft); border: 1px solid color-mix(in srgb, var(--no) 35%, var(--line)); color: var(--no-ink); }

@media (max-width: 1180px) {
  .hero-scene { height: 440px; }
}
@media (max-width: 1120px) {
  .app-header-inner { height: auto; min-height: 70px; flex-wrap: wrap; padding: 14px 0; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .app-search { margin-left: auto; }
  .hero-grid, .detail-grid, .create-grid, .mod-grid { grid-template-columns: 1fr; }
  .hero-scene { display: none; }
  .trend-grid, .market-grid-design { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .trading-sticky, .create-preview, .mod-review { position: static; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .app-search { display: none; }
  .hero-title { font-size: 44px; }
  .trend-grid, .market-grid-design, .info-grid, .footer-grid { grid-template-columns: 1fr; }
  .detail-header-row { flex-direction: column; }
  .detail-thumb { width: 100%; }
  .detail-thumb .market-thumb { height: 220px !important; }
  .row.mobile-col { flex-direction: column; align-items: stretch; }
}

/* Existing JS hooks rendered in Tenera visual language */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
th { color: var(--ink-3); background: var(--surface-2); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.book-hover-info { position: fixed; left: 0; top: 0; z-index: 90; display: none; max-width: 260px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 10.5px; font-weight: 800; line-height: 1.35; box-shadow: var(--sh-md); pointer-events: none; white-space: normal; }
.book-hover-info.visible { display: block; }
.book-hover-info.buy { border-color: color-mix(in srgb, var(--yes) 35%, var(--line)); background: var(--yes-soft); color: var(--yes-ink); }
.book-hover-info.sell { border-color: color-mix(in srgb, var(--no) 35%, var(--line)); background: var(--no-soft); color: var(--no-ink); }
.book-level-slot { position: relative; min-height: 34px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; padding: 8px 10px; overflow: hidden; cursor: crosshair; }
.book-level-depth { position: absolute; top: 0; bottom: 0; width: var(--depth-width, 0%); pointer-events: none; opacity: .25; }
.book-level-slot.buy .book-level-depth { right: 0; background: var(--yes); }
.book-level-slot.sell .book-level-depth { left: 0; background: var(--no); }
.book-level-price, .book-level-size { position: relative; z-index: 1; font-family: var(--font-mono); font-weight: 800; }
.book-level-size { text-align: right; color: var(--ink-2); }
.book-level-slot.buy .book-level-price { color: var(--yes-ink); }
.book-level-slot.sell .book-level-price { color: var(--no-ink); }
.comments-list { display: grid; gap: 12px; }
.comment { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.comment.reply { margin-left: 18px; border-left: 3px solid var(--violet-soft); }
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.comment-author { font-weight: 800; color: var(--ink); }
.comment-rating { color: var(--ink-3); font-size: 11px; font-weight: 700; }
.comment-body { margin: 0 0 10px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.comment-action-wrap { display: inline-flex; align-items: center; gap: 4px; }
.comment-action-count { min-width: 12px; color: var(--ink-3); font-size: 10px; font-weight: 800; line-height: 1; }
.comment-icon-button { width: 30px; height: 30px; min-height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; box-shadow: none; }
.comment-icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.comment-icon-button.like.active { color: var(--yes); background: var(--yes-soft); border-color: color-mix(in srgb, var(--yes) 35%, var(--line)); }
.comment-icon-button.dislike.active, .comment-icon-button.report { color: var(--no); background: var(--no-soft); border-color: color-mix(in srgb, var(--no) 35%, var(--line)); }
.comment-icon-button.reply { color: var(--violet); }
.reply-context { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 800; }
.modal[role="dialog"] { position: fixed; inset: 0; z-index: 8000; display: grid; place-items: center; width: auto; max-width: none; margin: 0; padding: 20px; border: 0; border-radius: 0; background: rgba(20,22,30,.5); backdrop-filter: blur(3px); box-shadow: none; animation: fadeUp .2s ease; }
.modal[role="dialog"].hidden { display: none !important; }
.modal-panel { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-family: var(--font-display); font-size: 24px; }
.modal-close { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); box-shadow: none; }
.modal-body { padding: 18px 22px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 22px; }
.modal-meta { display: grid; gap: 8px; margin-bottom: 12px; }
.wallet-status-row { min-height: 34px; display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink-2); background: var(--surface-2); overflow: hidden; }
.controls { display: grid; gap: 11px; }
.metrics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.metric { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.metric .k { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.metric .v { font-size: 16px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; word-break: break-word; }
.fee-vault-metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fee-vault-note { margin-top: 10px; }
.modal-meta .label { font-weight: 700; color: var(--ink-3); margin-right: 6px; }
.modal-meta .value { font-family: var(--font-mono, ui-monospace, monospace); word-break: break-all; }
.tx-link { display: inline-flex; align-items: center; justify-content: center; color: var(--violet); border-radius: var(--r-sm); transition: .15s; }
.tx-link:hover { color: var(--violet-ink); transform: translateY(-1px); }

/* --- Market sets ("collections") ------------------------------------------ */
.group-list { display: flex; flex-direction: column; gap: 10px; }
.group-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.group-row:hover { border-color: var(--violet); transform: translateY(-1px); }
.group-row.active { border-color: var(--violet); background: var(--violet-soft-2); box-shadow: inset 0 0 0 1px var(--violet); }
.group-row.static { cursor: default; padding: 9px 12px; }
.group-row.static:hover { border-color: var(--line); transform: none; }
.group-row-rank {
  width: 24px; height: 24px; flex: none; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--font-mono, ui-monospace, monospace); font-weight: 800; font-size: 12px; color: var(--ink-3);
  transition: background .15s, color .15s, border-color .15s;
}
.group-row.leading { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-soft) 0%, var(--surface-2) 60%); }
.group-row.leading .group-row-rank { background: var(--gold); color: #fff; border-color: transparent; }
.group-row.leading.active { border-color: var(--violet); }
.group-row-thumb {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-sm);
  background: var(--surface) center/cover no-repeat; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--violet);
}
.group-row-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.group-row-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.group-row-prob { display: flex; align-items: center; gap: 8px; }
.group-row-chance { font-family: var(--font-mono, ui-monospace, monospace); font-weight: 800; font-size: 15px; color: var(--yes-ink); min-width: 44px; text-align: right; }
.group-row-buy { display: flex; gap: 6px; flex: none; }
.group-row .probar.mini { flex: 1; min-width: 90px; }
.group-mini-probability { display: flex; flex-direction: column; gap: 5px; width: 116px; flex: none; }
.group-mini-probability-labels,
.group-candidate-probability-labels {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 800; line-height: 1;
  color: var(--ink-2); letter-spacing: .02em;
}
.group-mini-probability .probar.mini { width: 100%; min-width: 0; flex: none; height: 8px; }
.group-candidate-probability { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.group-candidate-probability .probar.mini { width: 100%; flex: none; height: 8px; }

.group-detail-head { display: flex; gap: 16px; align-items: center; }
.group-detail-head .detail-title { font-size: 24px; }
.group-detail-thumb {
  width: 72px; height: 72px; flex: none; border-radius: var(--r-md);
  background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--line);
}
.group-detail-thumb.is-empty {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--violet-soft) 0%, var(--violet-soft-2) 100%);
  border-color: transparent;
}
.group-detail-thumb.is-empty .icon { width: 26px; height: 26px; color: var(--violet); }

.group-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  margin-top: 2px; padding-top: 16px; border-top: 1px solid var(--line);
}
.group-stat {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.group-stat-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.group-stat-value {
  font-weight: 800; font-size: 15.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#leading-candidate { color: var(--gold); }

@media (max-width: 760px) {
  .group-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-detail-head { gap: 14px; }
  .group-detail-thumb { width: 64px; height: 64px; }
  .group-row { flex-wrap: wrap; }
  .group-row-chance { min-width: 0; margin-left: auto; }
  .group-row-buy { flex: 1 0 100%; }
  .group-row-buy .btn { flex: 1; }
}
.group-trade-frame { width: 100%; border: 0; border-radius: var(--r-lg); background: transparent; min-height: 560px; }
.group-page-grid { grid-template-columns: minmax(0, 1fr); }
.group-market-panel { min-height: 760px; }
.group-market-frame { width: 100%; border: 0; border-radius: var(--r-lg); background: transparent; min-height: 760px; }
.group-list.collapsed .group-row:not(.active) { display: none; }
.group-list.collapsed .group-row.active { margin-bottom: 0; }
.group-trade-empty { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 200px; padding: 24px; color: var(--ink-3); }

/* candidate builder rows */
.candidate-row { gap: 12px; }
.candidate-handle {
  width: 28px; height: 28px; flex: none; border-radius: 999px; display: flex; align-items: center;
  justify-content: center; background: var(--violet-soft); color: var(--violet-ink); font-weight: 800; font-size: 13px;
}
.candidate-thumb {
  width: 46px; height: 46px; flex: none; border-radius: var(--r-sm); padding: 0; cursor: pointer;
  background: var(--surface-2) center/cover no-repeat; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--violet);
  transition: border-color .15s, opacity .15s;
}
.candidate-thumb:hover { border-color: var(--violet); }
.candidate-thumb.has-image { border-style: solid; }
.candidate-thumb.has-image .candidate-thumb-icon,
.candidate-thumb.has-image .market-thumb-placeholder { display: none; }
.candidate-thumb.is-loading { opacity: .55; pointer-events: none; }
.candidate-thumb-icon { width: 16px; height: 16px; position: relative; z-index: 1; }
.candidate-status-err { background: var(--no-soft); color: var(--no-ink); }

/* --- Embedded trade-only mode (?embed=trade) ------------------------------ */
html.embed-trade .m-topbar,
html.embed-trade .m-drawer-overlay,
html.embed-trade #mobile-drawer,
html.embed-trade .footer,
html.embed-trade .app-nav,
html.embed-trade .app-search,
html.embed-trade #fee-vault-info-btn,
html.embed-trade .logo-text,
html.embed-trade main.fade-up > .row:first-child,
html.embed-trade .detail-grid > section { display: none !important; }
html.embed-trade .detail-grid { display: block !important; }
html.embed-trade main.fade-up { padding: 12px !important; }
html.embed-trade .app-header { position: static !important; }
html.embed-trade body, html.embed-trade .app-shell { background: transparent !important; }
html.embed-trade .trading-sticky { position: static !important; top: auto !important; }
html.embed-group .m-topbar,
html.embed-group .m-drawer-overlay,
html.embed-group #mobile-drawer,
html.embed-group .footer,
html.embed-group .app-header,
html.embed-group main.fade-up > .row:first-child,
html.embed-group .detail-grid > section > article:first-child,
html.embed-group #market-about-card { display: none !important; }
html.embed-group body,
html.embed-group .app-shell { background: transparent !important; }
html.embed-group main.fade-up { padding: 12px !important; }
html.embed-group .detail-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
html.embed-group .trading-sticky { top: 12px; }
html.embed-group .chart-placeholder { min-height: 220px; }
html.embed-group .chart-placeholder svg { height: 220px; }
@media (max-width: 980px) {
  html.embed-group .detail-grid { grid-template-columns: 1fr; }
  html.embed-group .trading-sticky { position: static; }
}
