/* style.css */
/* ==========================================================
   THE PALIMPSEST — style.css
   Mobile-first · Offline · Atmospheric · Accessible
   ========================================================== */

:root{
  --bg0:#041012;
  --bg1:#071417;
  --bg2:#0b1d20;
  --ink:#e9f2f2;
  --muted:#a6b9bb;

  --panel: rgba(18, 28, 32, 0.68);
  --panel2: rgba(10, 16, 18, 0.72);
  --edge: rgba(255,255,255,0.12);
  --edge2: rgba(0,0,0,0.45);

  --glow: rgba(160, 255, 229, 0.12);
  --danger: #ff4b4b;

  --radius: 16px;
  --radius2: 20px;

  --shadow: 0 18px 50px rgba(0,0,0,0.55);
  --shadow2: 0 10px 25px rgba(0,0,0,0.45);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  --textSize: 1; /* 0.92 sm, 1 md, 1.08 lg */
  --contrast: 0; /* toggled */
  --reduceMotion: 0;

  /* adaptive mood knobs (JS will nudge subtly) */
  --m-vignette: 0.72;
  --m-glitch: 0;
  --m-fog: 1;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1200px 900px at 50% 30%, rgba(32,74,70,0.24), transparent 55%),
              radial-gradient(900px 700px at 20% 65%, rgba(10,50,55,0.22), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* Faux "gothic" display font without external deps */
.game-title, .panel-title, .modal-title{
  font-family: ui-serif, "Georgia", "Times New Roman", Times, serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Canvas */
#fx{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Grain overlay */
.grain{
  position: fixed;
  inset: -30%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image:
    repeating-radial-gradient(circle at 10% 20%, rgba(255,255,255,0.03), rgba(255,255,255,0.03) 1px, transparent 2px, transparent 6px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018), rgba(255,255,255,0.018) 1px, transparent 2px, transparent 5px);
  transform: rotate(-2deg);
  filter: blur(0.4px);
  animation: grainMove 7s infinite linear;
}
@keyframes grainMove{
  0%{ transform: translate3d(-2%, -2%,0) rotate(-2deg); }
  50%{ transform: translate3d(2%, 2%,0) rotate(-2deg); }
  100%{ transform: translate3d(-2%, -2%,0) rotate(-2deg); }
}

/* Vignette */
.vignette{
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(1200px 900px at 50% 45%, transparent 40%, rgba(0,0,0, calc(var(--m-vignette))) 100%),
    radial-gradient(900px 700px at 50% 55%, rgba(0,0,0,0.25), transparent 60%);
}

/* App root */
.app{
  position: relative;
  height: 100%;
  z-index: 3;
  padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
}

.screen{
  position: absolute;
  inset: 0;
  padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(18px + var(--safe-b)) calc(14px + var(--safe-l));
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 10px, 0);
  transition: opacity 420ms ease, transform 520ms ease, filter 520ms ease;
  filter: blur(3px);
}
.screen--active{
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0,0,0);
  filter: blur(0px);
}

/* Center stack for splash/loading */
.center-stack{
  width: min(780px, 92vw);
  display: grid;
  place-items: center;
  gap: 18px;
}

.title-block{
  text-align: center;
  padding: 22px 18px;
}
.title-block--small{
  padding: 14px 18px;
}
.game-title{
  margin: 0;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.03;
  text-shadow: 0 0 28px rgba(140,255,225,0.12), 0 20px 60px rgba(0,0,0,0.7);
}
.game-subtitle{
  margin: 10px 0 0 0;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
}

/* Loader */
.loader{
  width: min(560px, 92vw);
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(12,18,20,0.68), rgba(6,10,12,0.62));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
}
.loader-bar{
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.32);
}
.loader-fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(160,255,229,0.16), rgba(160,255,229,0.42), rgba(160,255,229,0.18));
  box-shadow: 0 0 22px rgba(160,255,229,0.22);
  border-right: 1px solid rgba(255,255,255,0.14);
  transition: width 140ms linear;
}
.loader-meta{
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Menu panel - "Paused" vibe */
.menu-panel{
  width: min(520px, 92vw);
  border-radius: 14px;
  padding: 18px 16px 14px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,0.10), transparent 40%),
    linear-gradient(180deg, rgba(20,28,32,0.78), rgba(8,12,14,0.76));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 30px 90px rgba(0,0,0,0.62);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.menu-panel::before{
  content:"";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent 40%),
    radial-gradient(300px 200px at 50% 10%, rgba(160,255,229,0.10), transparent 65%);
  opacity: 0.9;
  pointer-events: none;
}
.menu-panel::after{
  content:"";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5);
  pointer-events: none;
}

.panel-header{
  text-align: center;
  position: relative;
  z-index: 1;
}
.panel-title{
  margin: 4px 0 6px 0;
  font-size: 26px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(160,255,229,0.08);
}
.panel-sub{
  margin: 0 0 10px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-actions{
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}
.panel-footer{
  position: relative;
  z-index: 1;
  padding: 6px 10px 4px;
}
.hint{
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.hint-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(160,255,229,0.28);
  box-shadow: 0 0 18px rgba(160,255,229,0.18);
}

/* Buttons */
.btn{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: calc(14px * var(--textSize));
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 10px 25px rgba(0,0,0,0.25);
  touch-action: manipulation;
}
.btn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.btn:active{
  transform: translateY(0px) scale(0.99);
}
.btn:focus-visible{
  outline: 2px solid rgba(160,255,229,0.45);
  outline-offset: 2px;
}
.btn[disabled], .btn[aria-disabled="true"]{
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}
.btn-primary{
  background: linear-gradient(180deg, rgba(160,255,229,0.20), rgba(160,255,229,0.06));
  border-color: rgba(160,255,229,0.22);
  box-shadow: 0 0 0 1px rgba(160,255,229,0.10), 0 14px 30px rgba(0,0,0,0.32);
}
.btn-danger{
  background: linear-gradient(180deg, rgba(255,75,75,0.18), rgba(255,75,75,0.06));
  border-color: rgba(255,75,75,0.28);
}
.btn-ghost{
  background: transparent;
  border-color: rgba(255,255,255,0.14);
}

/* Game layout */
.game-top{
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(6px + var(--safe-t)) calc(6px + var(--safe-r)) 10px calc(6px + var(--safe-l));
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}
.top-left, .top-right{
  pointer-events: auto;
}
.depth-chip{
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(10,16,18,0.58);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow2);
}
.depth-label{
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
}
.depth-value{
  font-family: ui-serif, Georgia, serif;
  letter-spacing: 0.16em;
  font-size: 14px;
}

.icon-btn{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 10px 25px rgba(0,0,0,0.25);
}
.icon-btn--sm{
  width: 34px;
  height: 34px;
}
.icon-btn:hover{ background: rgba(255,255,255,0.10); transform: translateY(-1px); }
.icon-btn:active{ transform: translateY(0px); }
.icon-btn:focus-visible{
  outline: 2px solid rgba(160,255,229,0.45);
  outline-offset: 2px;
}

.game-wrap{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding-top: 64px;
}

/* ==========================================================
   FIX THAT ACTUALLY UNBLOCKS YOU:
   - The card is the scroll container
   - The choices STICK to the bottom (always reachable)
   ========================================================== */

.segment-card{
  width: min(860px, 94vw);
  max-height: calc(100vh - 110px - var(--safe-b));
  border-radius: var(--radius2);
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(160,255,229,0.10), transparent 60%),
    linear-gradient(180deg, rgba(22,30,34,0.72), rgba(8,12,14,0.76));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  position: relative;

  /* make THIS the scroll container */
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  /* layout */
  display: flex;
  flex-direction: column;
}
.segment-card::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.52);
  border-radius: var(--radius2);
}

.segment-top{
  flex: 0 0 auto;
  padding: 18px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.segment-kicker{
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.segment-title{
  margin: 8px 0 0 0;
  font-family: ui-serif, Georgia, serif;
  letter-spacing: 0.08em;
  font-size: 22px;
  text-shadow: 0 0 18px rgba(160,255,229,0.08);
}

.segment-body{
  flex: 0 0 auto;
  padding: 14px 18px 6px;
  overflow: visible;       /* card handles scroll */
  max-height: none;        /* remove clamp that was hiding choices */
}
.segment-text{
  margin: 0;
  font-size: calc(16px * var(--textSize));
  line-height: 1.55;
  color: rgba(233,242,242,0.95);
  white-space: pre-wrap;
}
.echo-line{
  margin-top: 14px;
  font-size: calc(13px * var(--textSize));
  color: rgba(160,255,229,0.62);
  letter-spacing: 0.04em;
  min-height: 18px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 420ms ease, transform 520ms ease;
}
.echo-line--show{
  opacity: 1;
  transform: translateY(0px);
}

.segment-side{
  flex: 0 0 auto;
  padding: 10px 18px 0px;
  display: grid;
  gap: 10px;
}
.side-panel{
  border-radius: 14px;
  padding: 12px 12px 10px;
  background: rgba(10,16,18,0.62);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow2);

  /* keep inspect content nice without taking over */
  max-height: 240px;
  overflow: auto;
}
.side-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.side-title{
  font-family: ui-serif, Georgia, serif;
  letter-spacing: 0.08em;
  font-size: 14px;
}
.side-content{
  padding-top: 10px;
  color: rgba(233,242,242,0.92);
  font-size: calc(14px * var(--textSize));
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Choices: ALWAYS reachable (sticky footer inside scroll card) */
.segment-actions{
  flex: 0 0 auto;
  padding: 12px 18px calc(18px + var(--safe-b));
  display: grid;
  gap: 10px;

  position: sticky;
  bottom: 0;

  /* subtle “glass lip” so text under it looks intentional */
  background:
    linear-gradient(180deg,
      rgba(8,12,14,0.00),
      rgba(8,12,14,0.68) 28%,
      rgba(8,12,14,0.86));
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 5;
}

.choice{
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 12px 26px rgba(0,0,0,0.25);
  touch-action: manipulation;
}
.choice:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.choice:active{ transform: translateY(0px); }
.choice:focus-visible{
  outline: 2px solid rgba(160,255,229,0.45);
  outline-offset: 2px;
}
.choice .choice-title{
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: calc(12px * var(--textSize));
  color: rgba(233,242,242,0.92);
}
.choice .choice-desc{
  display: block;
  margin-top: 6px;
  color: rgba(166,185,187,0.92);
  font-size: calc(13px * var(--textSize));
  line-height: 1.35;
}

/* Title card */
.titlecard{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 520ms ease, transform 720ms ease, filter 720ms ease;
  filter: blur(2px);
}
.titlecard--show{
  opacity: 1;
  transform: translateY(0px);
  filter: blur(0px);
}
.titlecard-inner{
  padding: 18px 18px;
  border-radius: 16px;
  background: rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 30px 80px rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  text-align: center;
}
.titlecard-kicker{
  color: rgba(166,185,187,0.9);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.titlecard-title{
  margin-top: 8px;
  font-family: ui-serif, Georgia, serif;
  letter-spacing: 0.12em;
  font-size: 22px;
  color: rgba(233,242,242,0.96);
  text-shadow: 0 0 18px rgba(160,255,229,0.10);
}

/* Toast */
.toast{
  position: absolute;
  bottom: calc(16px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(10,16,18,0.72);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
  color: rgba(233,242,242,0.92);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}
.toast--show{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Modals */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 30;
  backdrop-filter: blur(6px);
}
.modal{
  position: fixed;
  z-index: 31;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  border-radius: 16px;
  background:
    radial-gradient(400px 200px at 50% 0%, rgba(160,255,229,0.10), transparent 60%),
    linear-gradient(180deg, rgba(20,28,32,0.88), rgba(8,12,14,0.86));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 40px 120px rgba(0,0,0,0.70);
  overflow: hidden;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.modal-title{
  margin: 0;
  letter-spacing: 0.12em;
  font-size: 18px;
}
.modal-body{
  padding: 14px 14px 10px;
}
.modal-foot{
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-foot--split{
  justify-content: space-between;
}
.confirm-text{
  margin: 0;
  line-height: 1.55;
  color: rgba(233,242,242,0.94);
}
.muted{
  color: rgba(166,185,187,0.92);
}

/* Settings */
.setting{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.10);
}
.setting:last-child{ border-bottom: none; }
.setting-label{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.setting-label span:first-child{
  letter-spacing: 0.06em;
}
.setting-hint{
  color: rgba(166,185,187,0.92);
  font-size: 12px;
}

/* Toggle */
.toggle{
  position: relative;
  width: 54px;
  height: 32px;
  display: inline-block;
}
.toggle input{
  position:absolute;
  opacity:0;
  width: 1px;
  height: 1px;
}
.toggle-ui{
  position:absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
  transition: background 180ms ease, border-color 180ms ease;
}
.toggle-ui::after{
  content:"";
  position:absolute;
  top: 50%;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: rgba(233,242,242,0.86);
  box-shadow: 0 10px 22px rgba(0,0,0,0.35);
  transition: left 180ms ease, background 180ms ease;
}
.toggle input:checked + .toggle-ui{
  background: rgba(160,255,229,0.18);
  border-color: rgba(160,255,229,0.22);
}
.toggle input:checked + .toggle-ui::after{
  left: 26px;
  background: rgba(233,242,242,0.96);
}
.toggle input:focus-visible + .toggle-ui{
  outline: 2px solid rgba(160,255,229,0.45);
  outline-offset: 2px;
}

.segmented{
  display:flex;
  gap: 8px;
}
.seg{
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  cursor:pointer;
  letter-spacing: 0.06em;
  transition: background 180ms ease, border-color 180ms ease, transform 120ms ease;
}
.seg:hover{ background: rgba(255,255,255,0.10); transform: translateY(-1px); }
.seg:active{ transform: translateY(0px); }
.seg--active{
  background: rgba(160,255,229,0.16);
  border-color: rgba(160,255,229,0.22);
}
.seg:focus-visible{
  outline: 2px solid rgba(160,255,229,0.45);
  outline-offset: 2px;
}

/* Pause menu */
.pause-actions{
  display: grid;
  gap: 10px;
}
.pause-split{
  display:flex;
  gap: 10px;
}
.pause-split .btn{
  flex: 1;
}
.pause-help{
  margin: 8px 2px 0;
  color: rgba(166,185,187,0.92);
  font-size: 12px;
  line-height: 1.4;
}

/* Credits */
.credits{
  color: rgba(233,242,242,0.92);
  line-height: 1.55;
}
.credits-small{
  color: rgba(166,185,187,0.92);
  font-size: 13px;
}

/* Debug */
.debug{
  position: absolute;
  top: calc(64px + var(--safe-t));
  left: calc(14px + var(--safe-l));
  width: min(290px, 80vw);
  padding: 10px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow2);
}
.debug-title{
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(166,185,187,0.92);
  font-size: 11px;
  margin-bottom: 6px;
}
.debug-pre{
  margin: 0;
  font-size: 12px;
  color: rgba(233,242,242,0.92);
  white-space: pre-wrap;
}

/* High contrast mode */
body.hc{
  --edge: rgba(255,255,255,0.18);
  --panel: rgba(6,8,9,0.82);
  --panel2: rgba(0,0,0,0.82);
  --m-vignette: 0.80;
}
body.hc .segment-text{ color: rgba(255,255,255,0.96); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  :root{ --reduceMotion: 1; }
  .grain{ animation: none; }
  .screen{ transition: none; }
}
body.rm .grain{ animation: none; opacity: 0.12; }
body.rm .screen{ transition: opacity 260ms ease; transform: none; filter: none; }

/* Responsive */
@media (min-width: 860px){
  .panel-title{ font-size: 28px; }
  .menu-panel{ padding: 20px 18px 16px; }
  .segment-title{ font-size: 24px; }
}

/* Short screens: tighten without breaking layout */
@media (max-height: 720px){
  .game-wrap{ padding-top: 56px; }
  .segment-title{ font-size: 20px; }
}

/* Subtle "glitch" flicker class (JS toggles briefly) */
@keyframes microGlitch{
  0%{ transform: translate3d(0,0,0); opacity: 1; }
  20%{ transform: translate3d(-1px,0,0); opacity: 0.98; }
  40%{ transform: translate3d(1px,0,0); opacity: 1; }
  60%{ transform: translate3d(-1px,1px,0); opacity: 0.985; }
  100%{ transform: translate3d(0,0,0); opacity: 1; }
}
.glitch{
  animation: microGlitch 220ms linear 1;
}

/* Scrollbar (subtle) */
.segment-card::-webkit-scrollbar{ width: 10px; }
.segment-card::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.25);
}
.segment-card::-webkit-scrollbar-track{ background: transparent; }

/* ADD THIS AT THE VERY BOTTOM OF style.css */

/* Consent modal: slightly more “warning” vibe without breaking your existing modal system */
#modal-consent .modal-title{
  letter-spacing: 0.14em;
}
#modal-consent .confirm-text{
  font-size: calc(15px * var(--textSize));
}
#modal-consent .muted{
  display: inline-block;
  margin-top: 6px;
}

/* Optional: make the “Continue” button feel a bit more deliberate */
#consent-accept.btn-primary{
  box-shadow: 0 0 0 1px rgba(160,255,229,0.12), 0 18px 42px rgba(0,0,0,0.35);
}

/* ==========================================================
   FIX: Inspect panel should NOT slide under the choice buttons
   (keeps Inspect scroll contained + separate lane)
   Paste at bottom of style.css
   ========================================================== */

/* Make sure the card stacks nicely */
#segment-card{
  display:flex;
  flex-direction:column;
}

/* The Inspect panel becomes a self-contained scroll box */
#side-panel{
  /* this is the key: stop it from expanding into the choices lane */
  max-height: clamp(160px, 26vh, 260px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  /* breathing room so it never "touches" the choices */
  margin-bottom: 14px;

  /* keep it visually above the card background */
  position: relative;
  z-index: 1;
}

/* Keep the choices clearly in their own lane */
#choices,
.choices{
  position: relative;
  z-index: 5; /* above inspect panel */

  /* extra separation (prevents that cramped overlap vibe) */
  margin-top: 12px;
}

/* Optional: cleaner scrollbars for the Inspect panel */
#side-panel::-webkit-scrollbar{
  width: 10px;
}
#side-panel::-webkit-scrollbar-thumb{
  border-radius: 999px;
  background: rgba(200,255,240,0.16);
  border: 2px solid rgba(0,0,0,0.35);
}
#side-panel::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.18);
}

/* Firefox */
#side-panel{
  scrollbar-width: thin;
  scrollbar-color: rgba(200,255,240,0.22) rgba(0,0,0,0.18);
}
