:root{
  --ink:#eaf1f2;
  --muted: rgba(234,242,246,0.72);
  --accent:#86fbff;

  --bg:#05141c;
  --stroke: rgba(255,255,255,0.14);

  --danger:#ff5f6f;
  --ok:#5dffb2;

  --lux:#ffd6ff;
  --wave:#86fbff;
  --dig:#ffd27a;
  --atoz:#b9ff9c;

  --radius: 18px;
  --shadow: 0 16px 42px rgba(0,0,0,0.45);




  /* Font */
  --font-ui: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: var(--font-ui);
  background: radial-gradient(1100px 700px at 20% 0%, rgba(134,251,255,0.10), transparent 60%),
              radial-gradient(900px 600px at 70% 20%, rgba(255,95,111,0.06), transparent 55%),
              var(--bg);
  color: var(--ink);
}



/* Ensure form controls follow the same font */
button, input, textarea, select{
  font-family: var(--font-ui);
}

/* ====== BAR v2 HOME SHELL ====== */

/* ====== BAR v2 HOME SHELL ====== */

/* 1) Fullscreen home video layer (BEHIND everything) */
.barHomeVideo {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #000;
}

.barHomeVideo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05) contrast(1.05);
}

/* 2) Home UI shell (ABOVE the video) */
.barShell {
  position: relative;
  z-index: 1;
  
  min-height: 100vh;
  padding: 18px;
  
  /* keep gradients, REMOVE png */
  background:
    radial-gradient(1100px 700px at 20% 0%, rgba(134, 251, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at 70% 20%, rgba(255, 95, 111, 0.06), transparent 55%);
  
  background-size: cover;
  background-position: center;
}




.barNeonTitle{
  text-align:center;
  font-weight: 900;
  letter-spacing: 0.18em;
  font-size: 28px;
  margin-top: 10px;
  margin-bottom: 14px;
  color: rgba(255,190,210,0.95);
  text-shadow:
    0 0 6px rgba(255,120,160,0.30),
    0 0 18px rgba(255,120,160,0.22),
    0 0 42px rgba(255,120,160,0.14);
  animation: neonFlicker 5.8s infinite;
}

@keyframes neonFlicker{
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: .65; }
  94% { opacity: 1; }
  96% { opacity: .78; }
  97% { opacity: 1; }
}

.barBigBtn{
  width:100%;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 14px;
  margin: 8px 0;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor:pointer;
}
.barMarketBtn{ border-color: rgba(134,251,255,0.35); }
.barAltBtn{
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.16);
  opacity: 0.88;
}
.barBigBtn:active{ transform: scale(0.99); filter: brightness(1.06); }

.barSmallNote{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.barExitBtn{
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(234, 242, 246, 0.82);
  border-radius: 14px;
  padding: 12px 12px;
  cursor: pointer;
  letter-spacing: 0.08em;
  font-weight: 800;
}

/* ====== Progress bar ====== */
.barProgWrap{ margin: 6px auto 10px; max-width: 520px; }
.barProgBtn{ width: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; }
.barProgTrack{
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  overflow:hidden;
}
.barProgFill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(134,251,255,0.75);
  box-shadow: 0 0 18px rgba(134,251,255,0.22);
  transition: width 220ms ease;
}
.barProgHint{
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}






/* ====== Top info row ====== */
.barTopInfo{
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0 14px;
}
.barUserName{
  font-weight: 900;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.barTinyBtn{
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 10px;
  cursor:pointer;
  font-weight: 900;
  font-size: 12px;
}
.barTinyBtn:active{ transform: scale(0.99); }
.barMiniTokens{
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* ====== Modals ====== */
.barModal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(5px);
  padding: 18px;
}
.barModal.on{ display:flex; align-items:center; justify-content:center; }
.barModalCard{
  width: min(520px, 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(0,0,0,0.30);
  box-shadow: var(--shadow);
}
.barModalTitle{
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.barInput{
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 12px;
  font-size: 16px;
  outline: none;
}
.barModalBtns{ margin-top: 12px; }
.barModalBtnsCol{ display:flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ====== Overlay ====== */
.barOverlay{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
  pointer-events: auto;
}
.barOverlay.on{ display:block; }

.barStage{
  position: absolute;
  inset: 0;
  padding: 14px;
  display:flex;
  flex-direction: column;
  overflow:hidden;
}

/* global dim + blur */
.barStage::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.12);
  backdrop-filter: blur(0.2px);
  z-index: 1;
}
.barStage > *{ position: relative; z-index: 2; }

.barOverlayTop{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.barTitle{
  flex:1;
  text-align:center;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(234,242,246,0.92);
  font-size: 14px;
  text-transform: uppercase;
  opacity: 0.95;
}

.barLeave{
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.30);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor:pointer;
  font-weight: 900;
  font-size: 12px;
}

/* BG crossfade layers (injected) */
.barSceneBox{ position:absolute; inset:0; pointer-events:none; z-index: 0; }
.barBGWrap{ position:absolute; inset:0; }
.barBGLayer{
  position:absolute; inset:0;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  transition: opacity 520ms ease;
  will-change: opacity;
  filter: saturate(1.05) contrast(1.05);
}
.barBGA{ opacity:1; }
.barBGB{ opacity:0; }
.barVignette{
  position:absolute; inset:0;
  pointer-events:none;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 36%,
    rgba(0,0,0,.22) 66%,
    rgba(0,0,0,.62) 100%);
  mix-blend-mode: multiply;
}

/* Bottom stack */
.barBottom{
  margin-top: auto;
  width: 100%;
  display:flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
}

/* Subtitle text box: 3 lines visible, scroll if longer */
.barSubtitleBox{
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px 12px;
  background: rgba(0,0,0,0.26);
  box-shadow: var(--shadow);

  font-size: 16px;
  line-height: 1.35;
  white-space: pre-line;

  /* 3 lines + padding */
  max-height: calc(1.35em * 3 + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Choices always at bottom */
.barChoices{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.barChoiceBtn{
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 8px;
  cursor:pointer;
  text-align:left;
  line-height: 1.2;
  font-weight: 700;
}
.barChoiceBtn small{
  display:block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.scoreBox{
  border: 1px solid rgba(134,251,255,0.25);
  background: rgba(0,0,0,0.28);
  border-radius: var(--radius);
  padding: 12px;
}
.scoreRow{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin: 6px 0;
  color: rgba(234,242,246,0.92);
}
.scoreRow small{ color: var(--muted); font-weight: 700; }


/* ===== Subtitle box sizing + scroll (3 lines default, 8 lines expanded) ===== */
.barSubtitleBox {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.26);
  box-shadow: var(--shadow);
  
  padding: 12px;
  
  /* Keep it subtitle-like */
  line-height: 1.35;
  
  /* NEW: 3 lines tall by default; scroll if longer */
  --lines: 3;
  max-height: calc(1.35em * var(--lines) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.barSubtitleBox.isExpanded {
  --lines: 8;
}

/* =========================================================
   BAR UI v2 — ADDITIONS
   Append to end of ./css/bar.css
========================================================= */

/* -------------------------
   STATUS STRIP (effects)
-------------------------- */
.barStatusStrip {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.55);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  z-index: 5;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.barStatus {
  padding: 4px 8px;
  border-radius: 10px;
  opacity: 0.9;
}

.barStatus.cig {
  background: rgba(200,200,200,0.15);
}

.barStatus.coffee {
  background: rgba(160,120,60,0.25);
}

.barStatus.pressure {
  background: rgba(200,60,60,0.35);
  font-weight: 600;
}


/* -------------------------
   SCENE MODE (Steak, etc)
-------------------------- */
.barSubtitleBox.scene {
  font-size: 1.05em;
  line-height: 1.55em;
  padding-top: 22px;
  padding-bottom: 22px;
  opacity: 0.95;
}

.barSubtitleBox.scene::after {
  content: "";
  display: block;
  margin-top: 10px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255,255,255,0.15),
    transparent
  );
}


/* -------------------------
   PIN / RIDDLE MODAL
-------------------------- */
.barPinInput {
  width: 100%;
  font-size: 24px;
  letter-spacing: 6px;
  text-align: center;
  padding: 10px;
  margin: 16px 0;
  background: #000;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
}

.barModalNote {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 8px;
  text-align: center;
}


/* -------------------------
   PRESSURE FEEL
-------------------------- */
.barStatus.pressure {
  animation: pressurePulse 1s infinite;
}

@keyframes pressurePulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  50%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1);   opacity: 0.9; }
}


/* -------------------------
   CHOICE HOVER INTENT
-------------------------- */
.barChoiceBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}


/* -------------------------
   LOW-KEY SCENE DARKEN
-------------------------- */
.barSceneBox::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.15);
  pointer-events: none;
}

/* Toast
   ========================= */

.barToastHost{
  position: fixed;
  left: 50%;
  top: clamp(72px, 14vh, 160px);
  transform: translateX(-50%);
  z-index: 999999;

  /* no stretching */
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;

  width: auto !important;
  height: auto !important;

  pointer-events: none;
}

.barToast{
  /* hard stop on the “pillar” */
  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  width: fit-content !important;
  height: fit-content !important;
  min-height: 0 !important;
  max-height: none !important;

  max-width: min(78vw, 340px);

  padding: 8px 10px;
  border-radius: 14px;

  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.18;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);

  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barToast.on{
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: barToastPop .20s ease-out;
}

.barToast--info{
  background: rgba(15, 20, 28, .78);
  color: rgba(255,255,255,.92);
}

.barToast--pos{
  background: rgba(10, 30, 30, .78);
  color: rgba(255,255,255,.95);
  border-color: rgba(134, 251, 255, .35);
  box-shadow: 0 10px 30px rgba(134, 251, 255, .14), 0 10px 30px rgba(0,0,0,.35);
}

.barToast--neg{
  background: rgba(30, 10, 12, .82);
  color: rgba(255,255,255,.95);
  border-color: rgba(255, 120, 120, .28);
  box-shadow: 0 10px 30px rgba(255, 120, 120, .12), 0 10px 30px rgba(0,0,0,.35);
}

@keyframes barToastPop{
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.audio-toggle{
  position: fixed;
  left: 14px;
  bottom: 18px; /* pavement level */
  z-index: 99999;

  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;

  font-size: 18px;
  line-height: 1;

  color: rgba(255,255,255,0.85);
  opacity: 0.8;

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.audio-toggle:active{
  opacity: 1;
  transform: translateY(1px);
}

/* =========================
   INDEX-ONLY AUDIO TOGGLE
   ========================= */

/* Hidden everywhere by default */
.audio-toggle{
  display: none;
}

/* Show only when the page says it is index/home */
body.is-index .audio-toggle{
  display: inline-flex;
}

/* Optional: move kebab to right + remove box look */
.barMenuBtn{
  position: fixed;
  top: 22px;
  right: 14px;
  left: auto;
  z-index: 99999;

  border: 0;
  background: transparent;
  padding: 8px 10px;

  color: rgba(134,251,255,0.90);
  font-size: 26px;
  line-height: 1;

  opacity: 0.9;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.barMenuBtn:active{
  opacity: 1;
  transform: translateY(1px);
}

/* Audio toggle visible ONLY on home (when body has .is-home) */
.audio-toggle{ display:none; }

body.is-home .audio-toggle{
  display: inline-flex;
}

/* ===== FIX: kebab/menu button must NOT float above overlay ===== */
.barShell{ position: relative; }



.barMenuBtn:active{ opacity: 1; transform: translateY(1px); }

/* ===== FIX: push overlay top row down ===== */
.barOverlayTop{
  padding-top: 55px;
}

/* ===== FIX: audio toggle should be visible on index only ===== */
/* Overlay is before audioToggle now, so we can hide it like this */
.barOverlay.on ~ .audio-toggle{
  display: none !important;
}

/* Safety: make sure it stays above home screen, but below overlay */
/* AUDIO TOGGLE */
.audio-toggle {
  position: fixed;
  left: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  
  font-size: 18px;
  line-height: 1;
  
  color: rgba(255, 255, 255, 0.85);
  opacity: 0.85;
  
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.audio-toggle:active {
  opacity: 1;
  transform: translateY(1px);
}

/* Hide while overlay is open */
.barOverlay.on~.audio-toggle {
  display: none !important;
}


/* --- Fade from black overlay --- */
#barFade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  z-index: 9999;
}
#barFade.is-on {
  opacity: 1;
}

/* --- Text panel expanded/collapsed (start expanded) --- */
#barTextWrap {
  transition: transform 1s ease, max-height 1s ease, opacity 0.4s ease;
  transform-origin: bottom center;
}

/* Expanded = your current expanded size */
#barTextWrap.is-expanded {
  transform: scale(1);
  max-height: 60vh; /* tune */
}

/* Collapsed = your compact mode */
#barTextWrap.is-collapsed {
  transform: scale(0.94);
  max-height: 22vh; /* tune */
}

/* --- Choices: hidden until reveal --- */
#barChoices {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#barChoices.is-revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* =========================
   STORY ALARM: subtle red light
   ========================= */

/* 1) Kill the box-shadow pulse (it muddies everything) */
.sn-alarm #barOverlay,
.sn-alarm #barRoot,
.sn-alarm body {
  animation: none !important;
  box-shadow: none !important;
}

/* 2) A soft red “light wash” that never blocks UI */
html.sn-alarm::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;

  /* IMPORTANT: keep it BELOW Bar overlay UI but ABOVE background */
  z-index: 999997;

  /* Subtle: use gradient instead of flat red */
  background:
    radial-gradient(120% 90% at 50% 55%,
      rgba(255, 60, 60, 0.38) 0%,
      rgba(255, 40, 40, 0.85) 45%,
      rgba(0, 0, 0, 0.20) 72%);

  /* More natural than screen. Keeps contrast. */
  mix-blend-mode: multiply;

  /* Softens it further */
  filter: saturate(1.15) blur(0.2px);

  animation: snAlarmLight 3.2s ease-in-out infinite;
}

/* 3) Tiny “flicker” so it feels like a real beacon light */
@keyframes snAlarmLight{
  0%   { opacity: 0.35; }
  35%  { opacity: 0.55; }
  55%  { opacity: 0.40; }
  75%  { opacity: 0.62; }
  100% { opacity: 0.35; }
}

body.is-overlay-open .barHomeVideo{ display:none; }