/* CoinFlip Theme Shell v1
   - Effects layer: #fx-root
   - Content layer: #site-root
   - Controls: bottom-right cluster + dropdown
*/

:root{
  --bg0: #050308;
  --bg1: #090513;
  --ink: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);
  --faint: rgba(255,255,255,0.50);
  --line: rgba(255,255,255,0.14);
  --glass: rgba(0,0,0,0.34);
  --glow: rgba(215,160,255,0.22);
  --glow2: rgba(255,130,130,0.14);
  --shadow: rgba(0,0,0,0.45);
  --radius: 22px;
  --radius2: 16px;
}

html, body{ height:auto; min-height:100%; }
body{
  margin:0;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 50% 0%, rgba(124,55,180,0.14), transparent 60%),
              radial-gradient(900px 600px at 70% 20%, rgba(255,130,130,0.08), transparent 55%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  overflow-x:hidden;
}

a{ color: inherit; text-decoration: none; }
b{ color: rgba(255,255,255,0.96); }

/* ---------- Guaranteed layering ---------- */
#fx-root{
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
#fx-grid, #fx-runes{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
}
#fx-grain{
  position:absolute;
  inset:0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 20% 40%, rgba(255,255,255,0.06) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.04) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 75%, rgba(255,255,255,0.05) 0 1px, transparent 2px);
  background-size: 140px 140px;
  filter: blur(.2px);
  mix-blend-mode: overlay;
}
#fx-vignette{
  position:absolute;
  inset:0;
  pointer-events:none;
  background: radial-gradient(900px 600px at 50% 35%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.38) 55%, rgba(0,0,0,0.86) 100%);
  opacity: var(--vignetteOpacity);
  mix-blend-mode: multiply;
}


#site-root{
  position: relative;
  z-index: 2;
}

/* ---------- Topbar ---------- */
.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(0,0,0,0.26);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 22px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
}
.sigil{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.brandName{ font-weight: 900; letter-spacing: .02em; }
.brandTag{ font-size: 12px; opacity: 0.22; margin-top: 2px; }

.nav{
  display:flex;
  gap: 14px;
  font-size: 13px;
  opacity: 0.22;
}
.nav a{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.nav a:hover{
  border-color: rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
}

/* ---------- Sections ---------- */
main{ padding: 24px clamp(22px, 4.5vw, 64px) 140px; max-width: 1180px; margin: 0 auto; }
.section{ padding: 26px 0; }
h1{ font-size: clamp(34px, 5vw, 54px); line-height: 1.03; margin: 0 0 14px; }
h2{ font-size: 26px; margin: 0 0 10px; }
h3{ font-size: 16px; margin: 0 0 10px; letter-spacing: .01em; }
.lead{ font-size: 16px; line-height: 1.6; color: var(--muted); margin: 0 0 16px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.faint{ color: var(--faint); }

/* ---------- Hero ---------- */
.hero{
  position: relative;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.14));
  box-shadow: 0 24px 80px rgba(0,0,0,0.38);
  overflow: hidden;
}
.heroGlow{
  position:absolute;
  inset:-80px;
  background:
    radial-gradient(500px 380px at 25% 20%, rgba(215,160,255,0.20), transparent 60%),
    radial-gradient(500px 380px at 75% 30%, rgba(255,130,130,0.12), transparent 60%);
  filter: blur(2px);
  opacity: 0.22;
}
.heroGrid{
  position: relative;
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 26px;
}
@media (max-width: 980px){
  .heroGrid{ grid-template-columns: 1fr; }
}
.heroCard{
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.32);
  padding: 16px;
  position: relative;
}
.heroCardTop{ margin-bottom: 10px; }
.heroMiniTitle{ font-weight: 900; }
.heroMiniSub{ font-size: 12px; opacity: 0.22; margin-top: 2px; letter-spacing: .08em; text-transform: uppercase; }
.quotePreview{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  padding: 12px;
}
.qRow{
  display:flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.qRow:last-child{ border-bottom:none; }
.heroStamp{
  position:absolute;
  right: 14px;
  bottom: 12px;
  font-size: 22px;
  opacity: 0.22;
  filter: drop-shadow(0 0 14px rgba(215,160,255,0.35));
}

.heroBadges{ display:flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.badge{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  font-size: 12px;
  opacity: 0.22;
}

/* ---------- Cards / code ---------- */
.cardGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 980px){
  .cardGrid{ grid-template-columns: 1fr; }
}
.card{
  border-radius: var(--radius2);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.24);
  padding: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.26);
}
pre.code{
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.26);
  overflow:auto;
  color: rgba(255,255,255,0.86);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}
.note{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.82);
}

/* ---------- Tester shell ---------- */
.testerShell{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 980px){
  .testerShell{ grid-template-columns: 1fr; }
}
.testerBlock{
  border-radius: var(--radius2);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  padding: 14px;
  margin-top: 14px;
}
.testerTitle{ font-weight: 900; margin-bottom: 10px; }
.testerTitle2{ font-weight: 900; margin-bottom: 8px; font-size: 14px; opacity: .94; }
.label{
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: 0.22;
  margin: 10px 0 8px;
}
.row{ display:flex; gap: 10px; flex-wrap: wrap; }
.hint{ margin-top: 10px; font-size: 12px; color: rgba(255,255,255,0.70); line-height: 1.5; }

/* ----- Live tester flow card ----- */
.flowHeader{
  display:flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.flowHeader .field{ min-width: 240px; flex: 1; }
.miniStats{ display:flex; gap: 10px; }
.miniStat{
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  padding: 8px 10px;
  display:flex;
  gap: 8px;
  align-items: center;
}
.miniStat span{ opacity: 0.28; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.miniStat strong{ font-weight: 900; }

.flowGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
@media (max-width: 720px){
  .flowGrid{ grid-template-columns: 1fr; }
  .flowHeader .field{ min-width: 0; }
}

.startInput{
  width: 100%;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  color: rgba(255,255,255,0.92);
  outline: none;
}
.startInput:focus{ border-color: rgba(215,160,255,0.42); box-shadow: 0 0 0 3px rgba(215,160,255,0.10); }

.twoWay{ border-radius: 16px; border: 1px solid rgba(255,255,255,0.10); background: rgba(0,0,0,0.16); padding: 10px; }
.rangeRow{ display:grid; grid-template-columns: 64px 1fr 78px; gap: 10px; align-items:center; }
.rangeLab{ opacity: 0.28; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.miniInput{
  width: 78px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  color: rgba(255,255,255,0.92);
  text-align: right;
}
.miniInput:focus{ border-color: rgba(215,160,255,0.42); box-shadow: 0 0 0 3px rgba(215,160,255,0.10); outline:none; }

.flipRow{ align-items:center; }
.flipRow .wide{ flex: 1; min-width: 180px; }

.chip{
  border-radius: 999px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.92);
  cursor:pointer;
}
.chip.active{
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 0 40px rgba(215,160,255,0.18);
}

.statGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.stat{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  padding: 10px;
  display:flex;
  justify-content: space-between;
  align-items:center;
}
.stat span{ opacity: 0.22; font-size: 12px; }

.chartPh{
  border-radius: var(--radius2);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
  padding: 14px;
  min-height: 260px;
}
.chartPhInner{
  height: 240px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.18);
  position: relative;
  overflow: hidden;
}
.chartLine{
  position:absolute;
  left: 10%;
  top: 55%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, rgba(215,160,255,0.0), rgba(215,160,255,0.5), rgba(215,160,255,0.0));
  opacity: 0.22;
}
.chartDots{
  position:absolute;
  inset:0;
  background-image: radial-gradient(circle at 18% 62%, rgba(255,255,255,0.25) 0 2px, transparent 3px),
                    radial-gradient(circle at 32% 54%, rgba(255,255,255,0.18) 0 2px, transparent 3px),
                    radial-gradient(circle at 62% 40%, rgba(255,255,255,0.22) 0 2px, transparent 3px),
                    radial-gradient(circle at 72% 48%, rgba(255,255,255,0.16) 0 2px, transparent 3px);
  opacity: 0.22;
}
.chartCaption{
  position:absolute;
  left: 12px;
  bottom: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.68);
}

/* ---------- Buttons ---------- */
.btn{
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.22);
  color: rgba(255,255,255,0.92);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}
.btn:hover{ transform: translateY(-1px); filter: drop-shadow(0 0 18px rgba(215,160,255,0.15)); }
.btn:disabled{ opacity: 0.22; cursor:not-allowed; transform:none; filter:none; }
.btn.primary{
  background: linear-gradient(180deg, rgba(215,160,255,0.18), rgba(0,0,0,0.24));
  border-color: rgba(215,160,255,0.28);
  box-shadow: 0 18px 80px rgba(215,160,255,0.10);
}
.btn.ghost{
  background: transparent;
}
.btn.wide{ width: 100%; }
.btn.small{ padding: 9px 10px; border-radius: 14px; font-size: 13px; }

.ctaRow{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Rune divider ---------- */
.runeDivider{
  margin: 18px auto;
  width: min(820px, 92%);
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  opacity: 0.22;
}
.runeDivider span{
  position:absolute;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  padding: 0 12px;
  background: rgba(0,0,0,0.0);
  font-size: 16px;
  opacity: 0.22;
  filter: drop-shadow(0 0 12px rgba(215,160,255,0.32));
}

/* ---------- Footer ---------- */
.footer{
  margin-top: 26px;
  padding: 18px;
  border-radius: var(--radius2);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  display:flex;
  gap: 14px;
  align-items:center;
}
.footerSigil{
  width: 48px;
  height: 48px;
  border-radius: 18px;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.14);
  opacity: 0.22;
}
.footerTitle{ font-weight: 900; }
.footerSub{ font-size: 12px; opacity: 0.22; margin-top: 2px; }

/* ---------- Controls cluster ---------- */
.controls{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99;
  display:flex;
  gap: 10px;
}
.ctlBtn{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
  color: rgba(255,255,255,0.92);
  cursor:pointer;
  display:grid;
  place-items:center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.ctlBtn:hover{ filter: drop-shadow(0 0 18px rgba(215,160,255,0.15)); transform: translateY(-1px); }

/* Dropdown panel */
.panel{
  position: fixed;
  right: 16px;
  bottom: 72px;
  width: 280px;
  z-index: 99;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.46);
  backdrop-filter: blur(16px);
  padding: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
  display:none;
}
.panel.open{ display:block; }
.panelTitle{
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
  opacity: 0.22;
  margin: 0 0 10px;
}
.panelDivider{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 10px 0;
}
.toggleRow{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.toggleRow:last-of-type{ border-bottom:none; }
.toggleRow span{ font-size: 13px; opacity: 0.22; }
.toggleRow input[type="checkbox"]{ width: 18px; height: 18px; }
.toggleRow select{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  color: rgba(255,255,255,0.90);
  padding: 8px 10px;
}

.debugBox{
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.86);
  white-space: pre-wrap;
  display:none;
}
.debugBox.show{ display:block; }

/* Reduced motion */
html.reduce-motion *{
  scroll-behavior: auto !important;
  transition: none !important;
  animation: none !important;
}


/* ---------- Orb / bubble frame effect ---------- */
.orbFrame{
  position: relative;
  overflow: hidden;
}
.orbFrame::before{
  content:"";
  position:absolute;
  inset:-120px;
  pointer-events:none;
  background:
    radial-gradient(420px 420px at 18% 18%, rgba(215,160,255,0.14), rgba(0,0,0,0) 65%),
    radial-gradient(520px 520px at 84% 34%, rgba(255,130,130,0.12), rgba(0,0,0,0) 68%),
    radial-gradient(460px 460px at 32% 82%, rgba(130,220,255,0.08), rgba(0,0,0,0) 65%);
  filter: blur(1px);
  opacity: 0.22;
}
.orbFrame::after{
  content:"";
  position:absolute;
  inset:-60px;
  pointer-events:none;
  background:
    radial-gradient(circle at 30% 35%, rgba(255,255,255,0.08) 0 42%, rgba(255,255,255,0.0) 43%),
    radial-gradient(circle at 75% 40%, rgba(255,255,255,0.07) 0 40%, rgba(255,255,255,0.0) 41%),
    radial-gradient(circle at 40% 78%, rgba(255,255,255,0.06) 0 38%, rgba(255,255,255,0.0) 39%);
  mix-blend-mode: screen;
  opacity: 0.22;
}
.orbFrame > *{ position: relative; z-index: 1; }


/* ---------- iOS-style switches ---------- */
.switch{
  position: relative;
  display: inline-block;
  width: 46px;
  height: 28px;
  flex: 0 0 auto;
}
.switch input{
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider{
  position:absolute;
  cursor:pointer;
  inset:0;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.14);
  transition: 220ms ease;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15);
}
.switch .slider:before{
  content:"";
  position:absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 2px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  transition: 220ms ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.switch input:checked + .slider{
  background: rgba(215,160,255,0.28);
  border-color: rgba(215,160,255,0.35);
  box-shadow: 0 0 0 3px rgba(215,160,255,0.08), inset 0 0 0 2px rgba(0,0,0,0.14);
}
.switch input:checked + .slider:before{
  transform: translateX(18px);
}

/* Theme picker in topbar */
.topbarRight{ display:flex; align-items:center; gap: 10px; }
.themePicker{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
}
.themeLabel{
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
  opacity: 0.22;
}
#themeSelect{
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.92);
  padding: 8px 10px;
}
@media (max-width: 900px){
  .nav{ display:none; }
}

/* ---------- Theme variants ---------- */
html.theme-ritual{
  /* default already matches ritual; keep hook for clarity */
}
html.theme-orbs body{
  background:
    radial-gradient(1200px 900px at 50% 0%, rgba(255,70,70,0.18), transparent 60%),
    radial-gradient(980px 760px at 28% 18%, rgba(210,120,255,0.18), transparent 60%),
    radial-gradient(980px 760px at 72% 70%, rgba(60,180,255,0.10), transparent 62%),
    linear-gradient(180deg, #06020c, #020109);
}

html.theme-orbs .heroGlow{
  background:
    radial-gradient(520px 420px at 20% 25%, rgba(255,130,130,0.16), transparent 62%),
    radial-gradient(520px 420px at 75% 35%, rgba(215,160,255,0.22), transparent 62%),
    radial-gradient(520px 420px at 55% 80%, rgba(130,220,255,0.10), transparent 62%);
}


/* ---------- Orbs layer (Cult-of-the-Lamb-ish warm rings) ---------- */
#fx-orbs{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 0; /* behind grain/vignette, above canvases */
  overflow:hidden;
}
.fx-no-orbs #fx-orbs{ display:none !important; }
#fx-orbs .orb{
  position:absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  opacity: 0.22;
  filter: blur(0.2px);
  transform: translate3d(0,0,0);
  will-change: transform;
}
#fx-orbs .orb::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius: 999px;
  /* ring + inner glow, tuned to screenshot */
  background:
    radial-gradient(circle at 50% 50%,
      rgba(0,0,0,0) 56%,
      rgba(255,66,66,0.10) 57%,
      rgba(255,66,66,0.13) 60%,
      rgba(255,80,80,0.00) 66%),
    radial-gradient(circle at 50% 50%,
      rgba(255,110,110,0.12) 0%,
      rgba(255,120,120,0.00) 58%);
  border: 1px solid rgba(255,70,70,0.07);
  box-shadow:
    inset 0 0 120px rgba(255,66,66,0.08),
    0 0 140px rgba(255,66,66,0.08);
}
#fx-orbs .orb.big{ width: 720px; height: 720px; opacity: 0.42; }
#fx-orbs .orb.med{ width: 560px; height: 560px; opacity: 0.22; }
#fx-orbs .orb.sm{ width: 420px; height: 420px; opacity: 0.22; }

html.theme-orbs #fx-vignette{ opacity: 0.22; }
html.theme-orbs #fx-grain{ opacity: 0.16; }


.fx-orb-motion-off #fx-orbs .orb{ animation: none !important; }


/* ---------- Per-card inner bubble float (independent per section) ---------- */
@keyframes orbFloatA{
  0%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(14px,-10px,0) scale(1.01); }
  100%{ transform: translate3d(0,0,0) scale(1); }
}
@keyframes orbFloatB{
  0%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(-10px,12px,0) scale(1.01); }
  100%{ transform: translate3d(0,0,0) scale(1); }
}
@keyframes orbFloatC{
  0%{ transform: translate3d(0,0,0) rotate(0.001deg); }
  50%{ transform: translate3d(8px,8px,0) rotate(0.001deg); }
  100%{ transform: translate3d(0,0,0) rotate(0.001deg); }
}

html:not(.reduce-motion) .orbFrame::before{
  animation: orbFloatA var(--orbDur, 11s) ease-in-out infinite;
  animation-delay: var(--orbDelay, 0s);
}
html:not(.reduce-motion) .orbFrame::after{
  animation: orbFloatB var(--orbDur2, 13s) ease-in-out infinite;
  animation-delay: var(--orbDelay2, 0.5s);
}

/* Give different elements different timings via nth-child (lightweight) */
.orbFrame:nth-of-type(1){ --orbDur: 10.5s; --orbDur2: 12.5s; --orbDelay: -1.2s; --orbDelay2: -0.6s; }
.orbFrame:nth-of-type(2){ --orbDur: 12.0s; --orbDur2: 14.0s; --orbDelay: -2.1s; --orbDelay2: -1.4s; }
.orbFrame:nth-of-type(3){ --orbDur: 13.5s; --orbDur2: 15.0s; --orbDelay: -0.7s; --orbDelay2: -2.4s; }
.orbFrame:nth-of-type(4){ --orbDur: 11.2s; --orbDur2: 13.2s; --orbDelay: -3.0s; --orbDelay2: -1.0s; }
.orbFrame:nth-of-type(5){ --orbDur: 14.5s; --orbDur2: 16.0s; --orbDelay: -1.8s; --orbDelay2: -3.1s; }

/* Optional: float the "bubble pill" chips a hair too */
html:not(.reduce-motion) .pill{
  animation: orbFloatC 9.5s ease-in-out infinite;
}


.fx-no-card-float .orbFrame::before, .fx-no-card-float .orbFrame::after, .fx-no-card-float .pill{ animation: none !important; }


/* ---------- Demo flip UI helpers ---------- */
.betBtn.active, .sideBtn.active{
  border-color: rgba(215,160,255,0.55) !important;
  box-shadow: 0 0 0 4px rgba(215,160,255,0.10) !important;
}
#toast{
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.48);
  color: rgba(255,255,255,0.92);
  opacity: 0;
  pointer-events: none;
  transition: 200ms ease;
  z-index: 60;
}
#toast.show{ opacity: 1; }
#recentFlips{ display:flex; flex-direction:column; gap: 8px; }
.receiptRow{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  font-size: 13px;
  opacity: 0.22;
}


:root{ --vignetteOpacity: 0.72; }

html.theme-orbs{ --vignetteOpacity: 0.58; }
html.theme-ritual{ --vignetteOpacity: 0.74; }


#fxVignetteStrength{ width: 180px; accent-color: rgba(215,160,255,0.75); }


/* ---------- Click pulses ---------- */
#fx-pulses{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 2;
  overflow:hidden;
}
.pulse{
  position:absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(1);
  border: 1px solid rgba(255,90,90,0.28);
  box-shadow: 0 0 24px rgba(255,90,90,0.14), inset 0 0 16px rgba(215,160,255,0.10);
  opacity: 0.22;
  animation: pulseOut 900ms ease-out forwards;
}
@keyframes pulseOut{
  0%{ transform: translate(-50%, -50%) scale(1); opacity: 0.22; }
  100%{ transform: translate(-50%, -50%) scale(14); opacity: 0.0; }
}
.fx-no-clickpulse #fx-pulses{ display:none !important; }


/* ---------- Settings layout: single column ---------- */
.settingsPanel .panelBody{
  display:flex;
  flex-direction:column;
  gap: 12px;
  align-items: stretch;
}
.settingsPanel .toggleRow{
  display:flex;
  flex-direction:row;
  justify-content:space-between;
  align-items:center;
  width: 100%;
  gap: 12px;
  flex-wrap: nowrap;
}
.settingsPanel .toggleRow > span{
  flex: 1 1 auto;
  min-width: 0;
}
.settingsPanel .toggleRow input[type="range"]{
  flex: 0 0 180px;
  max-width: 180px;
}
@media (max-width: 640px){
  .settingsPanel .toggleRow{
    flex-direction:column;
    align-items:stretch;
  }
  .settingsPanel .toggleRow input[type="range"]{
    width: 100%;
    max-width:none;
    flex: 1 1 auto;
  }
}


/* ---------- Cursor spotlight ---------- */
#fx-spotlight{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 1;
  opacity: 0.0;
  transition: opacity 180ms ease;
  background: radial-gradient(220px 220px at var(--spotX, 50%) var(--spotY, 40%),
    rgba(255,90,90,0.18), rgba(215,160,255,0.08) 35%, rgba(0,0,0,0) 70%);
  mix-blend-mode: screen;
}
html.fx-spotlight-on #fx-spotlight{ opacity: 1.0; }

/* ---------- Occult glyph shimmer ---------- */
#fx-glyphs{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 3;
  opacity: 0;
  transition: opacity 200ms ease;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0 1px, rgba(0,0,0,0) 1px 6px),
    radial-gradient(800px 500px at 50% 0%, rgba(215,160,255,0.06), rgba(0,0,0,0) 60%);
  filter: blur(0.2px);
  mix-blend-mode: overlay;
}
html.fx-glyphs-on #fx-glyphs{ opacity: 0.22; }
@keyframes glyphFlicker{
  0%, 100%{ opacity: 0.22; transform: translate3d(0,0,0); }
  50%{ opacity: 0.22; transform: translate3d(0.5px,-0.5px,0); }
}
html.fx-glyphs-on:not(.reduce-motion) #fx-glyphs{
  animation: glyphFlicker 2.8s steps(2,end) infinite;
}

/* ---------- Card parallax tilt ---------- */
.parallaxTarget{ transform-style: preserve-3d; will-change: transform; }
html.fx-parallax-on:not(.reduce-motion) .parallaxTarget{ transition: transform 120ms ease; }


.poolSelect{
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
  color: rgba(255,255,255,0.92);
  outline: none;
}
.poolSelect option{ background: #090311; }
.hint{ font-size: 12px; opacity: 0.22; margin-top: 6px; }


.testerTopRow{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.testerTopRow .field label{
  display:block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .10em;
  opacity: .72;
  margin-bottom: 6px;
}
#poolSelect{
  min-width: 240px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.92);
  padding: 10px 12px;
}
.miniStat{
  display:flex;
  gap: 8px;
  align-items:baseline;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.16);
}
.miniStat span{ font-size: 12px; opacity:.72; letter-spacing:.08em; text-transform: uppercase; }
.miniStat strong{ font-size: 13px; }


/* ---------- Window drift + animated borders ---------- */
.fx-no-window-drift .windowDriftTarget{ transform: none !important; }

.windowBorderGlow{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.0;
  transition: opacity 180ms ease;
}
.windowDriftTarget:hover .windowBorderGlow{ opacity: 1.0; }

/* Animated border ring that "reveals" motion */
.windowBorderGlow::before{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius: inherit;
  padding: 2px;
  background:
    conic-gradient(from 0deg,
      rgba(255,70,70,0.00),
      rgba(255,70,70,0.20),
      rgba(215,160,255,0.16),
      rgba(60,180,255,0.10),
      rgba(255,70,70,0.00));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: blur(0.2px);
  animation: borderSpin 3.2s linear infinite;
  opacity: 0.22;
}
@keyframes borderSpin{
  to{ transform: rotate(360deg); }
}


/* ---------- Fix inner bubble border artifacts ---------- */
.quoteCard, .quotePreview, .quoteShell, .glassInner{
  overflow: hidden;
  outline: none !important;
}
.quoteCard *{
  outline: none !important;
}
.quoteCard::before, .quoteCard::after,
.quotePreview::before, .quotePreview::after{
  content: none !important;
}

pre, code{ overflow:auto; scrollbar-width: thin; }
pre::-webkit-scrollbar{ height:8px; width:8px; }
pre::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.10); border-radius: 999px; }
pre::-webkit-scrollbar-track{ background: rgba(0,0,0,0.10); }


.simpleFlowTop{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.simpleFlowTop .field label{
  display:block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .10em;
  opacity: .72;
  margin-bottom: 6px;
}
.simpleFlowTop #poolSelect{ min-width: 220px; }
.miniStats{ display:flex; gap: 10px; flex-wrap: wrap; justify-content:flex-end; }

.hintLine{ margin-top:10px; font-size:12px; opacity:.76; }


/* panel scrolling */
#ctlPanel{ max-height: calc(100vh - 120px); overflow:auto; }
#ctlPanel .toggleRow{ width:100%; }


/* --- Layout safety: prevent side cut-off --- */
html, body { width:100%; overflow-x:hidden; }
.container, .wrap, .page { max-width: 1180px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
@media (max-width: 720px){ .container, .wrap, .page { padding-left: 14px; padding-right: 14px; } }
#fx{ overflow:hidden; }

#fx-scanlines, .scanlines{ opacity: 0.18 !important; mix-blend-mode: overlay; }


/* --- Extra edge breathing room (v6.5) --- */
.container, .wrap, .page { padding-left: 36px !important; padding-right: 36px !important; }
@media (max-width: 980px){ .container, .wrap, .page { padding-left: 20px !important; padding-right: 20px !important; } }
@media (max-width: 520px){ .container, .wrap, .page { padding-left: 14px !important; padding-right: 14px !important; } }
body{ padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }


/* --- Hover glow for panels & inner bubbles (v6.7) --- */
.card, .panel, .glass, .bubble, .kv, .pillStat, .controlGroup{
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease, filter .18s ease;
}
.card:hover, .panel:hover, .glass:hover{
  border-color: rgba(215,160,255,0.22) !important;
  box-shadow:
    0 0 0 1px rgba(215,160,255,0.10),
    0 0 28px rgba(215,160,255,0.12),
    0 18px 60px rgba(0,0,0,0.35);
}
.controlGroup:hover, .kv:hover, .pillStat:hover{
  border-color: rgba(215,160,255,0.20) !important;
  box-shadow:
    0 0 0 1px rgba(215,160,255,0.10),
    0 0 18px rgba(215,160,255,0.10);
}
.contractRow{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:8px;
}
.textInput{
  flex:1;
  min-width:0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.22);
  color:rgba(255,255,255,.92);
  outline:none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.textInput:focus{
  border-color: rgba(160,120,255,.45);
  box-shadow: 0 0 0 3px rgba(160,120,255,.14), inset 0 0 0 1px rgba(0,0,0,.18);
}
.miniLine{
  margin-top:8px;
  font-size:12px;
  opacity:.75;
  letter-spacing:.02em;
}
.iconBtn{
  width:36px;
  height:36px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.24);
  color:rgba(255,255,255,.9);
  display:grid;
  place-items:center;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.iconBtn:hover{
  transform: translateY(-1px);
  border-color: rgba(160,120,255,.35);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 3px rgba(160,120,255,.10);
}

.allocLine{ opacity:.78; margin-top:10px; }
.allocLine span{ opacity:.92; }
/* Bet buttons layout */
.betRow{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; margin-top:8px; }
.betRow .chipBtn{ width:100%; justify-content:center; }
/* Side buttons layout */
.sideRow{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; margin-top:8px; }
.sideRow .chipBtn{ width:100%; justify-content:center; }
/* Mobile padding + prevent edge hugging */
@media (max-width: 720px){
  .container{ padding-left:18px !important; padding-right:18px !important; }
  .testerGrid{ grid-template-columns: 1fr !important; }
  .testerCard{ padding:18px !important; }
  .statGrid{ grid-template-columns: 1fr !important; }
  .topbar{ padding-left:14px !important; padding-right:14px !important; }
}
