/* =====================================================================
   DX LIQUID GLASS — v1 (extracted from Deepread, 2026-11-24)
   Dark-first. The WebGL2 shader is the light source; glass refracts it.
   Override only the TOKENS block per brand. Never hard-code values below.
   ===================================================================== */

/* ---------- TOKENS ---------- */
:root {
  /* ink */
  --ink: #f5f3ff; --ink-2: #c9c6e0; --muted: #8e8aa8; --line: rgba(255,255,255,.12);
  /* glass */
  --surface: rgba(28,26,44,.52); --surface-2: rgba(14,13,24,.62); --solid: #15131f;
  --specular: rgba(255,255,255,.55); --rim-low: rgba(255,255,255,.08);
  --blur: 32px; --sat: 212%;
  /* brand + semantic */
  --accent: #a78bfa; --good: #34d399; --warn: #fbbf24; --bad: #fb7185; --sky: #38bdf8;
  --grad-text: linear-gradient(90deg, #c4b5fd, #f9a8d4, #fde68a);
  --grad-jewel: conic-gradient(from var(--a), #34d399, #38bdf8, #a78bfa, #f472b6, #fde047, #34d399);
  /* depth: ink-tinted, never black */
  --shadow: 0 1px 2px rgba(20,8,60,.25), 0 8px 20px -6px rgba(30,10,90,.35), 0 22px 48px -14px rgba(40,10,120,.45);
  /* shape */
  --r-s: 12px; --r-m: 18px; --r-l: 26px; --pill: 999px;
  /* motion */
  --spring: cubic-bezier(.22,1,.36,1); --bounce: cubic-bezier(.34,1.56,.64,1);
  /* type: max two families */
  --display: 'Instrument Serif', Georgia, serif; --ui: 'Inter', system-ui, sans-serif;
  /* layout */
  --gut: 20px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --page-bg: #07090f;
  color-scheme: dark;
}
@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* ---------- BASE ---------- */
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; background: var(--page-bg); color: var(--ink); font: 400 15px/1.45 var(--ui); }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.dx-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.dx-grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"); }
.dx-app { position: relative; z-index: 2; }

/* ---------- TYPE ---------- */
.dx-kicker { font: 600 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dx-display { font: 400 40px/1.02 var(--display); letter-spacing: -.02em; }
.dx-h2 { font: 400 28px/1.1 var(--display); letter-spacing: -.01em; }
.dx-h3 { font: 600 17px/1.3 var(--ui); }
.dx-body { color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.dx-small { font-size: 13px; color: var(--muted); }
.dx-num { font-variant-numeric: tabular-nums; }
.dx-display em, .dx-h2 em, .dx-grad { font-style: italic; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dx-big { font: 400 88px/.95 var(--display); letter-spacing: -.04em; background: linear-gradient(180deg, #fff, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- GLASS (the core material) ---------- */
.dx-glass { position: relative; border-radius: var(--r-l); border: 1px solid var(--line);
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface-2) 100%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)); backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  box-shadow: inset 0 1.5px 0 var(--specular), inset 0 -1px 0 var(--rim-low), var(--shadow); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .dx-glass { background: var(--solid); } }
.dx-well { border-radius: var(--r-m); background: rgba(0,0,0,.26); border: 1px solid var(--line); box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }

/* ---------- TILT + GLARE + PRESS ---------- */
.dx-tilt { transform-style: preserve-3d; transition: transform .6s var(--spring); --mx: 50%; --my: 0%; overflow: hidden; }
.dx-tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s var(--spring);
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255,255,255,.24), transparent 60%); }
.dx-tilt.lit::after { opacity: 1; }
.dx-press { transition: transform .5s var(--bounce), box-shadow .3s var(--spring), filter .3s; }
.dx-press:active, .dx-press.down { transform: scale(.96); filter: brightness(1.12); transition-duration: .12s; }

/* ---------- JEWEL (rotating conic iridescence: logo, focal buttons) ---------- */
.dx-jewel { position: relative; width: 64px; height: 64px; flex: none; --jr: 22px; }
.dx-jewel .halo { position: absolute; inset: -12px; border-radius: calc(var(--jr) + 8px); background: var(--grad-jewel); filter: blur(16px); opacity: .6; animation: dx-spin 6s linear infinite; }
.dx-jewel .collar { position: absolute; inset: 0; border-radius: var(--jr); background: var(--grad-jewel); animation: dx-spin 5s linear infinite; }
.dx-jewel .core { position: absolute; inset: 2px; border-radius: calc(var(--jr) - 2px); display: grid; place-items: center;
  background: radial-gradient(120% 100% at 30% 0%, #2d2654, #0d0b18 70%); box-shadow: inset 0 1.5px 0 var(--specular), inset 0 -12px 24px rgba(167,139,250,.25); }
.dx-jewel.xl { width: 128px; height: 128px; --jr: 36px; }
@keyframes dx-spin { to { --a: 360deg; } }

/* ---------- BUTTONS / FIELDS / CHIPS ---------- */
.dx-btn { height: 56px; padding: 0 24px; border-radius: var(--pill); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 16px; position: relative; overflow: hidden; }
.dx-btn-prime { color: #120b24; background: linear-gradient(180deg, #f5f0ff, #d8ccff); box-shadow: inset 0 1.5px 0 #fff, inset 0 -8px 16px rgba(244,114,182,.35), 0 12px 32px -8px rgba(167,139,250,.7); }
.dx-btn-ghost { border: 1px solid var(--line); background: rgba(255,255,255,.06); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.18); }
.dx-btn[disabled] { opacity: .5; pointer-events: none; }
.dx-field { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-radius: var(--r-m); background: rgba(0,0,0,.28);
  border: 1px solid var(--line); box-shadow: inset 0 1px 2px rgba(0,0,0,.4); transition: border-color .3s var(--spring), box-shadow .3s var(--spring); }
.dx-field:focus-within { border-color: rgba(167,139,250,.6); box-shadow: inset 0 1px 2px rgba(0,0,0,.4), 0 0 0 4px rgba(167,139,250,.15); }
.dx-field input { flex: 1; background: none; border: 0; outline: 0; font-size: 17px; min-width: 0; }
.dx-field input::placeholder { color: var(--muted); }
.dx-chip { height: 36px; padding: 0 14px; border-radius: var(--pill); font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px; flex: none; transition: background .3s var(--spring), color .3s, transform .5s var(--bounce); }
.dx-chip.on { background: rgba(255,255,255,.92); color: #120b24; border-color: transparent; box-shadow: 0 6px 20px -6px rgba(167,139,250,.8); }
.dx-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }
.dx-badge { height: 28px; padding: 0 12px; border-radius: var(--pill); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: #052e1f; background: linear-gradient(180deg, #a7f3d0, #34d399); box-shadow: inset 0 1px 0 #fff, 0 6px 16px -6px #34d399; }
.dx-sev { height: 24px; padding: 0 10px; border-radius: var(--pill); display: inline-flex; align-items: center; font: 800 10px/1 var(--ui); letter-spacing: .08em; align-self: flex-start; }
.dx-sev.critical { background: #fb7185; color: #2a0610; } .dx-sev.high { background: rgba(251,113,133,.2); color: #fda4af; } .dx-sev.moderate { background: rgba(251,191,36,.18); color: #fcd34d; }
.dx-sev.low { background: rgba(52,211,153,.16); color: #6ee7b7; } .dx-sev.info { background: rgba(56,189,248,.16); color: #7dd3fc; }

/* ---------- SEGMENTED + TAB BAR (sliding blob) ---------- */
.dx-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: 44px; padding: 4px; border-radius: var(--pill); position: relative; }
.dx-seg button { position: relative; z-index: 1; font-size: 13px; font-weight: 600; color: var(--muted); border-radius: var(--pill); transition: color .3s; }
.dx-seg button.on { color: #120b24; }
.dx-seg .blob { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 3)); border-radius: var(--pill); background: rgba(255,255,255,.92);
  transition: transform .6s var(--bounce); box-shadow: 0 4px 14px -4px rgba(167,139,250,.8); }
.dx-tabs { position: fixed; left: var(--gut); right: var(--gut); bottom: calc(var(--safe-b) + 16px); z-index: 10; height: 68px; padding: 8px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-radius: var(--pill); max-width: 440px; margin: 0 auto; }
.dx-tab { position: relative; z-index: 1; border-radius: var(--pill); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); transition: color .3s; }
.dx-tab svg { width: 22px; height: 22px; } .dx-tab.on { color: var(--ink); }
.dx-tabs .blob { position: absolute; top: 8px; bottom: 8px; left: 8px; width: calc((100% - 16px) / var(--n, 3)); border-radius: var(--pill); z-index: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.05)); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.4), 0 4px 16px -4px rgba(167,139,250,.5); transition: transform .7s var(--bounce); }

/* ---------- CARD GRID (full / half; "two cards per screen") ---------- */
.dx-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dx-card { grid-column: span 2; padding: 16px; border-radius: var(--r-m); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dx-card.half { grid-column: span 1; padding: 14px 12px; }
.dx-card .ct { font: 600 13px/1.3 var(--ui); color: var(--ink-2); }
.dx-card.flag { border-left: 3px solid var(--sc, var(--warn)); }
.dx-calc { font: 500 13px/1.45 ui-monospace, 'SF Mono', Consolas, monospace; color: var(--ink-2); padding: 8px 12px; border-radius: var(--r-s); background: rgba(0,0,0,.28); border: 1px solid var(--line); overflow-wrap: anywhere; }

/* ---------- DATA VIS (bars, donut, compare, ring, score, table) ---------- */
.dx-bars { display: grid; gap: 12px; }
.dx-bar { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.dx-bar .track { display: block; height: 24px; border-radius: 8px; background: rgba(255,255,255,.06); overflow: hidden; }
.dx-bar .fill { display: block; height: 100%; border-radius: 8px; width: calc(var(--w) * 1%); transform: scaleX(0); transform-origin: left;
  background: linear-gradient(90deg, var(--c1, #8b5cf6), var(--c2, #f472b6)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); transition: transform 1.4s var(--spring); transition-delay: calc(var(--d, 0) * 120ms + 300ms); }
.in .dx-bar .fill { transform: none; }
.dx-card.half .dx-bar { grid-template-columns: 44px 1fr; } .dx-card.half .dx-bar b { grid-column: 2; font-size: 12px; margin-top: -6px; } .dx-card.half .dx-bar .track { height: 16px; }
.dx-donut { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.dx-donut svg { width: 140px; height: 140px; transform: rotate(-90deg); }
.dx-donut circle.arc { fill: none; stroke-width: 18; transition: stroke-dasharray 1.4s var(--spring); transition-delay: calc(var(--d, 0) * 150ms + 300ms); }
.dx-card.half .dx-donut { grid-template-columns: 1fr; justify-items: center; } .dx-card.half .dx-donut svg { width: 112px; height: 112px; }
.dx-legend { display: grid; gap: 8px; font-size: 13px; } .dx-legend div { display: flex; gap: 8px; align-items: center; } .dx-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.dx-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dx-compare > div { padding: 16px; border-radius: var(--r-m); background: rgba(0,0,0,.24); border: 1px solid var(--line); }
.dx-compare b { display: block; font: 400 32px/1 var(--display); margin-top: 8px; }
.dx-ring { width: 112px; height: 112px; position: relative; } .dx-ring svg { transform: rotate(-90deg); }
.dx-ring circle { fill: none; stroke-width: 10; } .dx-ring .val { stroke-linecap: round; transition: stroke-dashoffset 1.6s var(--spring); }
.dx-ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 400 40px/1 var(--display); }
.dx-score { display: grid; grid-template-columns: 112px 1fr 32px; gap: 12px; align-items: center; font-size: 13px; }
.dx-score .track { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.dx-score .fill { display: block; height: 100%; border-radius: 4px; background: var(--c); transform-origin: left; transform: scaleX(0); transition: transform 1.4s var(--spring); transition-delay: calc(var(--d, 0) * 80ms + 300ms); }
.in .dx-score .fill, .dx-score.go .fill { transform: scaleX(var(--v)); }
.dx-tbl-wrap { overflow-x: auto; } table.dx-tbl { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.dx-tbl th { text-align: right; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dx-tbl td { text-align: right; padding: 8px; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.dx-tbl th:first-child, .dx-tbl td:first-child { text-align: left; white-space: normal; min-width: 120px; position: sticky; left: 0; background: rgba(20,18,32,.92); color: var(--ink); }
.dx-list { display: grid; gap: 8px; padding: 0; list-style: none; } .dx-list li { display: flex; gap: 8px; font-size: 14px; color: var(--ink-2); }
.dx-list li::before { content: ''; width: 6px; height: 6px; margin-top: 8px; flex: none; border-radius: 50%; background: var(--tc, var(--accent)); }

/* ---------- MOTION: entrances, scenes ---------- */
.dx-stagger > * { opacity: 0; transform: translateY(16px); }
.on .dx-stagger > *, .dx-stagger.on > * { animation: dx-rise .8s var(--spring) forwards; animation-delay: calc(var(--i, 0) * 50ms + 120ms); }
@keyframes dx-rise { to { opacity: 1; transform: none; } }
[data-r] { opacity: 0; transform: translateY(24px); filter: blur(6px); transition: opacity .9s var(--spring), transform 1s var(--spring), filter .9s var(--spring); transition-delay: calc(var(--d, 0) * 90ms); }
.in [data-r] { opacity: 1; transform: none; filter: none; }
.dx-scroll-story { height: 100%; overflow-y: auto; scroll-snap-type: y proximity; scrollbar-width: none; }
.dx-scene { min-height: 100%; scroll-snap-align: start; padding: calc(var(--safe-t) + 80px) var(--gut) calc(var(--safe-b) + 104px); display: flex; flex-direction: column; justify-content: center; }
.dx-progress { position: fixed; right: 8px; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; z-index: 5; }
.dx-progress i { width: 4px; height: 16px; border-radius: 2px; background: rgba(255,255,255,.18); transition: height .5s var(--spring), background .4s; }
.dx-progress i.on { height: 32px; background: #fff; }
.dx-screen { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; pointer-events: none; transform: translateY(16px) scale(.985); transition: opacity .6s var(--spring), transform .8s var(--spring); }
.dx-screen.on { opacity: 1; pointer-events: auto; transform: none; }
.dx-skel { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.1), rgba(255,255,255,.04)); background-size: 200% 100%; animation: dx-shimmer 1.6s var(--spring) infinite; }
@keyframes dx-shimmer { to { background-position: -200% 0; } }

/* ---------- OVERLAYS: sheet, scrim, toast ---------- */
.dx-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(4,3,10,.5); opacity: 0; pointer-events: none; transition: opacity .4s var(--spring); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.dx-scrim.on { opacity: 1; pointer-events: auto; }
.dx-sheet { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 12px); z-index: 31; padding: 24px 20px; display: grid; gap: 12px; max-width: 480px; margin: 0 auto; transform: translateY(120%); transition: transform .7s var(--spring); }
.dx-sheet.on { transform: none; }
.dx-toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 16px); z-index: 40; padding: 12px 16px; border-radius: var(--pill); font-size: 14px; transform: translate(-50%, -160%); transition: transform .6s var(--bounce); max-width: calc(100% - 40px); }
.dx-toast.on { transform: translate(-50%, 0); }

/* ---------- SPLASH: jewel mark + wordmark reveal ---------- */
.dx-mark-draw path, .dx-mark-draw line { stroke-dasharray: 220; stroke-dashoffset: 220; animation: dx-draw 1.6s var(--spring) forwards; }
.dx-mark-draw :nth-child(2) { animation-delay: .25s } .dx-mark-draw :nth-child(3) { animation-delay: .4s } .dx-mark-draw :nth-child(4) { animation-delay: .55s } .dx-mark-draw :nth-child(5) { animation-delay: .7s }
@keyframes dx-draw { to { stroke-dashoffset: 0; } }
.dx-mark-in { animation: dx-mark-in 1.4s var(--bounce) both; }
@keyframes dx-mark-in { from { transform: scale(.4) rotate(-18deg); opacity: 0; filter: blur(12px); } }
.dx-word { font: 400 56px/1 var(--display); letter-spacing: -.03em; display: flex; overflow: hidden; }
.dx-word span { display: inline-block; transform: translateY(110%); animation: dx-up 1s var(--spring) forwards; animation-delay: calc(700ms + var(--i) * 55ms); }
.dx-word span.it { font-style: italic; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 4px; }
@keyframes dx-up { to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
