:root {
  --bg: #0b080b;
  --bg-soft: #130d12;
  --panel: rgba(22, 14, 20, .94);
  --panel-2: rgba(29, 18, 26, .9);
  --line: rgba(231, 207, 164, .16);
  --line-strong: rgba(231, 207, 164, .34);
  --gold: #e7cfa4;
  --gold-strong: #f0bd61;
  --burgundy: #771c31;
  --red: #e94f64;
  --blue: #4c9bea;
  --green: #35c98a;
  --text: #f5eee7;
  --muted: #9e8e96;
  --cell-size: 34px;
  --radius: 18px;
  color-scheme: dark;
  font-family: Bahnschrift, "Segoe UI Variable", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 2%, rgba(119, 28, 49, .23), transparent 31%),
    radial-gradient(circle at 88% 78%, rgba(182, 128, 51, .09), transparent 32%),
    linear-gradient(142deg, #090608, #100a0e 54%, #080607);
  overflow-x: hidden;
}

body.access-locked { overflow: hidden; }

button,
input { font: inherit; }

button { color: inherit; }

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  background-image:
    linear-gradient(rgba(231, 207, 164, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 207, 164, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.ambient-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, transparent 0 46%, rgba(119, 28, 49, .08) 47% 48%, transparent 49% 100%);
  background-size: 150px 150px;
  animation: grid-drift 35s linear infinite;
}

.ambient-orb {
  position: fixed;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(231, 207, 164, .055);
  border-radius: 50%;
  pointer-events: none;
}

.orb-one { left: -330px; top: 25%; }
.orb-two { right: -390px; top: -260px; }

.app-frame {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-bottom: 128px;
}

.license-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 32%, rgba(119, 28, 49, .34), transparent 34%),
    linear-gradient(145deg, rgba(8, 5, 8, .98), rgba(16, 9, 14, .99));
  transition: opacity .55s ease, visibility .55s ease;
}

.license-gate::before,
.license-gate::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.license-gate::before {
  inset: 0;
  opacity: .45;
  background-image:
    linear-gradient(rgba(231, 207, 164, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 207, 164, .035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, #000, transparent 78%);
  animation: access-grid 28s linear infinite;
}

.license-gate::after {
  width: min(820px, 92vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 189, 97, .72), transparent);
  box-shadow: 0 0 36px rgba(240, 189, 97, .24);
  animation: access-scan 4.8s ease-in-out infinite;
}

.license-gate.access-granted { opacity: 0; visibility: hidden; }
.license-gate.hidden { display: none; }

.access-card {
  position: relative;
  width: min(520px, 100%);
  padding: 42px clamp(24px, 6vw, 54px) 30px;
  text-align: center;
  overflow: hidden;
  border: 1px solid rgba(231, 207, 164, .32);
  border-radius: 28px 7px 28px 7px;
  background:
    linear-gradient(145deg, rgba(119,28,49,.09), transparent 48%),
    rgba(18, 11, 16, .96);
  box-shadow: 0 38px 120px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.04), 0 0 70px rgba(119,28,49,.14);
  animation: access-card-enter .75s cubic-bezier(.2,.8,.2,1) both;
}

.access-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.035) 48%, transparent 61%);
  transform: translateX(-120%);
  animation: card-sheen 5.5s 1.2s ease-in-out infinite;
}

.access-orbit { position: relative; width: 132px; height: 132px; margin: 0 auto 18px; display: grid; place-items: center; }
.access-orbit > i { position: absolute; border: 1px solid rgba(231,207,164,.2); border-radius: 50%; }
.access-orbit > i:nth-child(1) { inset: 0; border-style: dashed; animation: orbit-spin 16s linear infinite; }
.access-orbit > i:nth-child(2) { inset: 14px; border-color: rgba(233,79,100,.3); animation: orbit-spin 9s linear infinite reverse; }
.access-orbit > i:nth-child(3) { inset: 27px; border-color: rgba(240,189,97,.42); box-shadow: 0 0 28px rgba(240,189,97,.08); }
.brand-logo { display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.access-logo {
  z-index: 1;
  width: 94px;
  height: 94px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.38)) drop-shadow(0 0 13px rgba(240,189,97,.16));
  animation: logo-breathe 3.8s ease-in-out infinite;
}

.access-card h1 { margin: 7px 0 10px; font-size: clamp(28px, 7vw, 38px); letter-spacing: 4px; }
.access-subtitle { margin: 0 0 27px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.access-form { text-align: left; }
.access-form label { display: block; margin-bottom: 8px; color: var(--gold); font-size: 11px; letter-spacing: 1.6px; }
.access-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 16px 5px 16px 5px; background: rgba(6,4,6,.72); transition: border-color .2s, box-shadow .2s; }
.access-input-row:focus-within { border-color: var(--gold-strong); box-shadow: 0 0 0 4px rgba(240,189,97,.07), 0 0 34px rgba(119,28,49,.15); }
.access-input-row input { min-width: 0; height: 44px; padding: 0 13px; border: 0; outline: 0; color: var(--text); background: transparent; font-family: Consolas, monospace; letter-spacing: 1px; text-transform: uppercase; }
.access-input-row input::placeholder { color: #62545c; }
.access-input-row button { min-width: 116px; border: 1px solid rgba(240,189,97,.55); border-radius: 11px 3px 11px 3px; color: #24160b; background: linear-gradient(135deg, #f0cf8a, #c78c39); font-weight: 800; cursor: pointer; transition: transform .2s, box-shadow .2s, opacity .2s; }
.access-input-row button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(240,189,97,.18); }
.access-input-row button:disabled { opacity: .55; cursor: wait; }
.access-error { min-height: 21px; margin: 8px 4px 0; color: #ff8096; font-size: 12px; }
.access-status { margin-top: 24px; padding-top: 17px; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); color: #685c63; font-size: 8px; letter-spacing: 1.4px; }
.access-status i { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); animation: engine-pulse 1.8s ease-in-out infinite; }

body.access-locked .app-frame { opacity: 0; transform: translateY(14px); pointer-events: none; }
body.access-ready .app-frame { animation: app-reveal .65s .18s cubic-bezier(.2,.8,.2,1) both; }
body.access-ready .stats-ribbon { animation: section-rise .55s .3s ease both; }
body.access-ready .road-panel { animation: section-rise .5s ease both; }
body.access-ready .road-panel:nth-child(1) { animation-delay: .36s; }
body.access-ready .analysis-card { animation: section-rise .5s ease both; }
body.access-ready .analysis-card:nth-child(1) { animation-delay: .42s; }
body.access-ready .analysis-card:nth-child(2) { animation-delay: .48s; }
body.access-locked .input-dock { opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 18px); }
body.access-ready .input-dock { animation: dock-rise .5s .32s ease both; }

.road-panel,
.analysis-card { transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.road-panel:hover,
.analysis-card:hover { border-color: rgba(231,207,164,.28); box-shadow: 0 22px 68px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.035); }
.score-gauge { filter: drop-shadow(0 0 18px rgba(240,189,97,.08)); }
.engine-status b { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: inherit; font-weight: 600; }

.topbar {
  min-height: 96px;
  padding: 18px clamp(20px, 3.8vw, 58px);
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(460px, 1.3fr) auto;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 7, 9, .84);
  backdrop-filter: blur(24px);
  box-shadow: 0 16px 50px rgba(0,0,0,.23);
}

.brand-block,
.session-strip,
.header-actions,
.panel-heading,
.analysis-card-heading,
.legend,
.pair-controls,
.result-controls { display: flex; align-items: center; }

.brand-block { gap: 16px; }

.header-logo {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  filter: drop-shadow(0 7px 13px rgba(0,0,0,.34)) drop-shadow(0 0 9px rgba(240,189,97,.12));
  transition: transform .28s ease, filter .28s ease;
}

.brand-block:hover .header-logo { transform: translateY(-2px) scale(1.04); filter: drop-shadow(0 10px 17px rgba(0,0,0,.42)) drop-shadow(0 0 13px rgba(240,189,97,.2)); }

.micro-label {
  margin: 0 0 5px;
  color: var(--gold-strong);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
}

.brand-block h1 { margin: 0; font-size: 27px; letter-spacing: 6px; line-height: 1; }
.brand-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 2px; }

.session-strip { justify-content: center; gap: 12px; }

.session-meta,
.engine-status {
  min-height: 54px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: rgba(24, 14, 21, .58);
}

.session-meta span { display: block; color: var(--muted); font-size: 9px; letter-spacing: 1.5px; }
.session-meta { min-width: 135px; border-radius: 4px 14px 4px 14px; }
.session-meta strong { display: block; margin-top: 4px; color: var(--gold); font-size: 13px; letter-spacing: 1px; }

.engine-status {
  min-height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #b7aaa8;
  font-size: 9px;
  letter-spacing: 1.4px;
}
.engine-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.header-actions { justify-content: flex-end; gap: 9px; }
.ghost-btn,
.outline-btn,
.danger-btn {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 12px 4px 12px 4px;
  cursor: pointer;
  background: rgba(24, 15, 21, .72);
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}
.ghost-btn:hover:not(:disabled),
.outline-btn:hover { border-color: var(--gold); background: rgba(231, 207, 164, .08); }
.ghost-btn:active:not(:disabled), .outline-btn:active { transform: translateY(1px); }
.ghost-btn:disabled { cursor: not-allowed; opacity: .35; }
.outline-btn { color: var(--gold); }
.danger-btn { border-color: rgba(233,79,100,.48); color: #fff; background: linear-gradient(135deg, #8d2539, #5b1727); }

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 3px;
}

.workspace { width: min(1780px, calc(100% - 38px)); margin: 0 auto; padding: 26px 0 40px; }

.stats-ribbon {
  display: grid;
  grid-template-columns: .8fr repeat(3, .72fr) 1.45fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px 5px 20px 5px;
  background: var(--line);
  box-shadow: 0 18px 54px rgba(0,0,0,.22);
}

.stats-ribbon article {
  min-height: 94px;
  padding: 18px 22px;
  position: relative;
  background: rgba(20, 12, 18, .94);
}
.stats-ribbon article::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 2px; transition: width .45s ease; }
.stats-ribbon article:hover::after { width: 100%; background: var(--gold); }
.stats-ribbon span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.stats-ribbon strong { display: block; margin-top: 6px; font-size: 28px; line-height: 1; }
.stats-ribbon small { display: block; margin-top: 6px; color: #72656c; font-size: 9px; letter-spacing: 1px; }
.stats-ribbon .banker-stat strong { color: var(--red); }
.stats-ribbon .player-stat strong { color: var(--blue); }
.stats-ribbon .tie-stat strong { color: var(--green); }
.stats-ribbon .text-stat { margin-top: 10px; color: var(--gold); font-size: 17px; letter-spacing: 1px; }

.content-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 18px;
}

.roads-stack { min-width: 0; display: grid; gap: 14px; }
.road-panel,
.analysis-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius) 5px var(--radius) 5px;
  background:
    linear-gradient(135deg, rgba(119,28,49,.055), transparent 34%),
    var(--panel);
  box-shadow: 0 18px 55px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025);
}

.panel-heading {
  min-height: 66px;
  padding: 13px 18px;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.panel-heading.compact { min-height: 58px; }
.panel-heading h2,
.panel-heading h3 { margin: 0; font-size: 17px; letter-spacing: 1px; }
.panel-heading h2 span,
.panel-heading h3 span { margin-left: 7px; color: #74676e; font-size: 9px; letter-spacing: 1.4px; font-weight: 500; }

.legend { gap: 14px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-ring { width: 12px; height: 12px; border: 2px solid; border-radius: 50%; }
.legend-ring.banker { border-color: var(--red); }
.legend-ring.player { border-color: var(--blue); }
.legend-slash { width: 13px; height: 2px; background: var(--green); transform: rotate(-45deg); }

.road-symbol { width: 18px; height: 18px; display: block; }
.ring-symbol { border: 3px solid var(--red); border-radius: 50%; }
.dot-symbol { border-radius: 50%; background: var(--blue); }
.slash-symbol { position: relative; }
.slash-symbol::after { content: ""; position: absolute; left: 2px; top: 8px; width: 17px; height: 3px; border-radius: 3px; background: var(--red); transform: rotate(-45deg); }

.derived-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.road-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: rgba(231,207,164,.28) transparent;
  scrollbar-width: thin;
}
.road-scroll::-webkit-scrollbar { height: 6px; }
.road-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(231,207,164,.24); }

.road-canvas {
  --columns: 24;
  position: relative;
  width: calc(var(--columns) * var(--cell-size));
  min-width: 100%;
  height: calc(6 * var(--cell-size));
  background-color: rgba(8, 6, 8, .72);
  background-image:
    linear-gradient(to right, rgba(231,207,164,.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(231,207,164,.09) 1px, transparent 1px);
  background-size: var(--cell-size) var(--cell-size);
  background-position: -1px -1px;
}
.road-derived { --cell-size: 25px; }
.road-bead { --cell-size: 31px; }

.road-cell {
  position: absolute;
  left: calc(var(--col) * var(--cell-size));
  top: calc(var(--row) * var(--cell-size));
  width: var(--cell-size);
  height: var(--cell-size);
  display: grid;
  place-items: center;
  animation: mark-enter .22s ease both;
}

.big-cell b,
.bead-cell b {
  width: 72%;
  height: 72%;
  display: grid;
  place-items: center;
  border: 2px solid;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
}
.winner-b b { color: var(--red); border-color: var(--red); }
.winner-p b { color: var(--blue); border-color: var(--blue); }
.winner-t b { color: #07140f; border-color: var(--green); background: var(--green); }
.bead-cell.winner-b b { color: #fff; background: #b52c43; border-color: #d8465d; }
.bead-cell.winner-p b { color: #fff; background: #236caf; border-color: #4293dd; }
.big-cell.tie-only b { color: var(--green); border-color: transparent; background: transparent; }

.pair-dot { position: absolute; z-index: 3; width: 5px; height: 5px; border-radius: 50%; box-shadow: 0 0 5px currentColor; }
.pair-banker { left: 3px; top: 3px; color: var(--red); background: var(--red); }
.pair-player { right: 3px; bottom: 3px; color: var(--blue); background: var(--blue); }
.super-six-mark {
  position: absolute;
  z-index: 4;
  right: 1px;
  top: 1px;
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
  border: 1px solid #f4cf70;
  border-radius: 50%;
  color: #261704;
  background: #f4cf70;
  box-shadow: 0 0 8px rgba(244,207,112,.65);
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
}
.tie-mark {
  position: absolute;
  z-index: 2;
  width: 70%;
  height: 2px;
  display: grid;
  place-items: center;
  color: #d4ffe9;
  background: var(--green);
  transform: rotate(-45deg);
  font-size: 7px;
  font-style: normal;
  line-height: 1;
  text-shadow: 0 0 4px #000;
}

.derived-cell i { display: block; width: 48%; height: 48%; }
.eye-cell i { border: 2px solid; border-radius: 50%; }
.small-cell i { border-radius: 50%; background: currentColor; }
.cockroach-cell i { height: 3px; border-radius: 2px; background: currentColor; transform: rotate(-45deg); }
.derived-r { color: var(--red); }
.derived-b { color: var(--blue); }

.last-result { color: var(--gold); font-size: 11px; }

.analysis-rail { display: grid; gap: 14px; position: sticky; top: 14px; }
.analysis-card { padding: 19px; }
.analysis-card-heading { justify-content: space-between; gap: 12px; }
.analysis-card h2,
.analysis-card h3 { margin: 0; font-size: 18px; }
.result-analysis-card {
  --fire-glow: 0px;
  --fire-spread: 0px;
  --fire-blur: 0px;
  --fire-border: 0px;
  position: relative;
  overflow: visible;
  isolation: isolate;
}
.result-analysis-card > :not(.streak-fire-frame) { position: relative; z-index: 1; }
.analysis-heading-status { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.main-hit-streak-badge {
  display: none;
  padding: 6px 9px;
  border: 1px solid rgba(240,189,97,.3);
  border-radius: 999px;
  color: #ffcf73;
  background: rgba(91,35,12,.28);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.main-hit-streak-badge.visible { display: inline-flex; }
.result-analysis-card.streak-burning .main-hit-streak-badge {
  border-color: rgba(255,126,35,.75);
  color: #fff0b0;
  background: linear-gradient(135deg, rgba(173,42,5,.62), rgba(82,18,3,.72));
  box-shadow: 0 0 calc(13px + var(--fire-glow)) rgba(255,92,17,.4);
  animation: streak-badge-pulse .86s ease-in-out infinite alternate;
}
.streak-fire-frame {
  position: absolute;
  z-index: 4;
  inset: -2px;
  border-radius: calc(var(--radius) + 2px) 7px calc(var(--radius) + 2px) 7px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s ease;
}
.streak-fire-frame::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, #ffcf65, #ff5a16, #8d1503, #ff8a1f, #fff0a0, #ff5a16, #8d1503, #ffcf65);
  background-size: 180% 180%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: drop-shadow(0 0 calc(8px + var(--fire-glow)) rgba(255,86,16,.85));
  animation: streak-fire-border 1.3s linear infinite;
}
.streak-fire-frame::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: calc(-7px - var(--fire-spread));
  border: calc(2px + var(--fire-border)) solid rgba(255,80,12,.34);
  border-radius: calc(var(--radius) + 10px) 10px calc(var(--radius) + 10px) 10px;
  filter: blur(calc(7px + var(--fire-blur)));
  opacity: .72;
  animation: streak-fire-glow .72s ease-in-out infinite alternate;
}
.result-analysis-card.streak-burning .streak-fire-frame { opacity: 1; visibility: visible; }
.result-analysis-card.streak-inferno .streak-fire-frame::after { opacity: 1; }
.streak-fire-canvas {
  position: absolute;
  z-index: 2;
  max-width: none;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: saturate(1.28) contrast(1.08) drop-shadow(0 0 7px rgba(255,66,4,.42));
  transform: translateZ(0);
}
.result-analysis-divider {
  margin-top: 18px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
}
.result-analysis-divider .micro-label { margin-bottom: 4px; }
.result-analysis-divider strong { font-size: 14px; letter-spacing: 1px; }
.confidence-badge { padding: 6px 9px; border: 1px solid; border-radius: 999px; font-size: 9px; letter-spacing: 1.4px; }
.confidence-badge.low { color: #9c9096; border-color: #51464b; }
.confidence-badge.medium { color: var(--gold); border-color: rgba(231,207,164,.45); }
.confidence-badge.high { color: #ff9daf; border-color: rgba(233,79,100,.52); box-shadow: 0 0 20px rgba(233,79,100,.13); }

.score-gauge {
  width: 144px;
  height: 144px;
  margin: 24px auto 20px;
  padding: 10px;
  border-radius: 50%;
  background: conic-gradient(var(--gold-strong) calc(var(--score) * 1%), rgba(231,207,164,.07) 0);
  box-shadow: 0 0 35px rgba(240,189,97,.08);
}
.score-gauge::before {
  content: "";
  position: absolute;
}
.score-gauge > div {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: #100a0f;
  border: 1px solid var(--line);
}
.score-gauge strong { font-size: 36px; line-height: 1; }
.score-gauge span { margin-top: 5px; color: var(--muted); font-size: 7px; letter-spacing: 1.5px; }

.direction-result {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 15px 4px 15px 4px;
  background: rgba(8,6,8,.6);
  text-align: center;
}
.direction-result small { display: block; color: var(--muted); font-size: 8px; letter-spacing: 2px; }
.direction-result strong { display: block; margin-top: 5px; font-size: 24px; letter-spacing: 2px; }
.direction-result span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.direction-result.banker { border-color: rgba(233,79,100,.52); background: linear-gradient(135deg, rgba(119,28,49,.3), rgba(8,6,8,.65)); }
.direction-result.banker strong { color: #ff7e91; }
.direction-result.player { border-color: rgba(76,155,234,.52); background: linear-gradient(135deg, rgba(25,76,124,.28), rgba(8,6,8,.65)); }
.direction-result.player strong { color: #7ebdf6; }
.direction-result.observe strong { color: var(--gold); }

.reason-list { margin: 16px 0 0; padding: 0; list-style: none; }
.reason-list li { position: relative; padding: 8px 0 8px 17px; color: #b8a9af; font-size: 11px; line-height: 1.55; border-bottom: 1px solid rgba(231,207,164,.06); }
.reason-list li::before { content: ""; position: absolute; left: 1px; top: 14px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-strong); box-shadow: 0 0 8px rgba(240,189,97,.55); }

.structure-list { margin: 14px 0 0; }
.structure-list div { padding: 10px 0; display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid rgba(231,207,164,.07); }
.structure-list div:last-child { border-bottom: 0; }
.structure-list dt { color: var(--muted); font-size: 11px; }
.structure-list dd { margin: 0; color: var(--gold); font-size: 12px; font-weight: 700; }

.recent-hands { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 7px; }
.recent-chip { position: relative; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid; border-radius: 50%; font-size: 10px; font-weight: 700; }
.recent-chip.winner-b { color: var(--red); border-color: var(--red); }
.recent-chip.winner-p { color: var(--blue); border-color: var(--blue); }
.recent-chip.winner-t { color: var(--green); border-color: var(--green); }
.recent-chip[data-pair]::after { content: attr(data-pair); position: absolute; right: -1px; top: -6px; color: var(--gold); }
.recent-chip[data-super-six]::before { content: attr(data-super-six); position: absolute; left: -5px; top: -6px; width: 13px; height: 13px; display: grid; place-items: center; border-radius: 50%; color: #241400; background: #f4cf70; font-size: 8px; box-shadow: 0 0 7px rgba(244,207,112,.5); }
.empty-copy { color: #71646b; font-size: 11px; }
.analysis-note { margin: 16px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: #75696f; font-size: 10px; line-height: 1.6; }

.side-bet-limit { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; }
.side-bet-lead {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px 4px 15px 4px;
  background: rgba(8, 6, 8, .56);
}
.side-bet-lead small { display: block; color: #7f7178; font-size: 8px; letter-spacing: 1.8px; }
.side-bet-lead strong { display: block; margin-top: 6px; color: var(--gold); font-size: 20px; }
.side-bet-lead span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.side-bet-lead.active { border-color: rgba(240,189,97,.55); background: linear-gradient(135deg, rgba(119,28,49,.2), rgba(8,6,8,.62)); box-shadow: inset 0 0 25px rgba(240,189,97,.04); }
.side-bet-lead.active strong { color: #ffd983; }
.side-bet-lead.paused strong { color: #a3949b; }
.side-bet-list { margin-top: 10px; display: grid; gap: 7px; }
.side-bet-row {
  display: grid;
  grid-template-columns: 67px minmax(55px, 1fr) 24px 58px;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 7px 8px;
  border: 1px solid rgba(231,207,164,.08);
  border-radius: 10px 3px 10px 3px;
  background: rgba(9,7,8,.4);
}
.side-bet-name { display: flex; align-items: center; gap: 6px; color: #c2b4b9; font-size: 10px; }
.side-bet-name i { width: 8px; height: 8px; display: grid; place-items: center; border-radius: 50%; font-size: 7px; font-style: normal; }
.banker-pair-side i { background: var(--red); box-shadow: 0 0 7px rgba(233,79,100,.4); }
.player-pair-side i { background: var(--blue); box-shadow: 0 0 7px rgba(76,155,234,.4); }
.tie-side i { background: var(--green); box-shadow: 0 0 7px rgba(53,201,138,.4); }
.super-six-side i { width: 14px; height: 14px; color: #241400; background: #f4cf70; box-shadow: 0 0 7px rgba(244,207,112,.4); }
.side-bet-meter { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(231,207,164,.08); }
.side-bet-meter i { display: block; width: calc(var(--side-score) * 1%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--burgundy), var(--gold-strong)); transition: width .35s ease; }
.side-bet-row > strong { color: var(--gold); font-size: 10px; text-align: right; }
.side-bet-row > em { color: #83757c; font-size: 9px; font-style: normal; text-align: right; }
.side-bet-row[data-status="推薦"] { border-color: rgba(240,189,97,.42); background: linear-gradient(90deg, rgba(119,28,49,.17), rgba(240,189,97,.04)); box-shadow: inset 0 0 18px rgba(240,189,97,.03); }
.side-bet-row[data-status="推薦"] > em { color: #ffd983; }
.side-bet-row[data-status="主路衝突"] > em { color: #d56a7c; }

.input-dock {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(15px, env(safe-area-inset-bottom));
  width: min(1120px, calc(100% - 30px));
  min-height: 94px;
  max-height: calc(100dvh - 30px);
  padding: 13px 16px 13px 20px;
  display: grid;
  grid-template-columns: 190px auto minmax(420px, 1fr);
  align-items: center;
  gap: 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 22px 6px 22px 6px;
  background: rgba(16, 10, 14, .94);
  box-shadow: 0 24px 75px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(24px);
}
.dock-copy strong { display: block; font-size: 15px; }
.dock-copy > span { display: block; margin-top: 5px; color: #786a71; font-size: 9px; }
.pair-controls { gap: 8px; }
.pair-toggle {
  min-width: 74px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px 4px 12px 4px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(34,21,30,.68);
}
.pair-toggle i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #594c52; }
.pair-toggle[aria-pressed="true"] { color: #fff; }
.banker-pair[aria-pressed="true"] { border-color: var(--red); background: rgba(119,28,49,.4); }
.banker-pair[aria-pressed="true"] i { background: var(--red); box-shadow: 0 0 9px var(--red); }
.player-pair[aria-pressed="true"] { border-color: var(--blue); background: rgba(31,79,126,.35); }
.player-pair[aria-pressed="true"] i { background: var(--blue); box-shadow: 0 0 9px var(--blue); }

.result-controls { gap: 8px; }
.result-btn {
  position: relative;
  min-width: 96px;
  height: 62px;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-items: center;
  padding: 9px 12px;
  overflow: hidden;
  border: 1px solid;
  border-radius: 15px 4px 15px 4px;
  cursor: pointer;
  text-align: left;
  transition: filter .18s ease, transform .18s ease, box-shadow .18s ease;
}
.result-btn:hover { filter: brightness(1.13); box-shadow: 0 10px 25px rgba(0,0,0,.24); }
.result-btn:active { transform: translateY(1px); }
.result-btn small { grid-column: 1; color: rgba(255,255,255,.62); font-size: 8px; letter-spacing: 1.3px; }
.result-btn strong { grid-column: 1; font-size: 22px; }
.result-btn kbd { grid-column: 2; grid-row: 1 / 3; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; color: rgba(255,255,255,.68); background: rgba(0,0,0,.18); }
.banker-btn { border-color: #c23e53; background: linear-gradient(135deg, #8c263a, #591725); }
.super-six-btn { border-color: #d5a946; background: linear-gradient(135deg, #7d5520, #4a2e10); }
.super-six-btn strong { color: #ffe29a; font-size: 18px; }
.player-btn { border-color: #3985ca; background: linear-gradient(135deg, #286ea9, #194771); }
.tie-btn { max-width: 116px; border-color: #2e9f70; background: linear-gradient(135deg, #237d59, #174b39); }

.confirm-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px 6px 24px 6px;
  color: var(--text);
  background: linear-gradient(145deg, rgba(119,28,49,.12), transparent 42%), #130c11;
  box-shadow: 0 30px 110px rgba(0,0,0,.72);
}
.confirm-dialog::backdrop { background: rgba(5,3,4,.78); backdrop-filter: blur(6px); }
.confirm-dialog form { padding: 28px; text-align: center; }
.dialog-mark { width: 58px; height: 58px; margin: 0 auto 18px; display: grid; place-items: center; border: 1px solid rgba(231,207,164,.42); border-radius: 50%; color: var(--gold); font-size: 28px; }
.confirm-dialog h2 { margin: 0; }
.confirm-dialog p:not(.micro-label) { margin: 12px 0 22px; color: var(--muted); line-height: 1.6; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.toast {
  position: fixed;
  z-index: 50;
  top: 112px;
  right: 24px;
  min-width: 190px;
  padding: 13px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 14px 4px 14px 4px;
  color: var(--gold);
  background: rgba(18,11,16,.96);
  box-shadow: 0 18px 48px rgba(0,0,0,.48);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast[data-tone="b"] { color: #ff8296; border-color: rgba(233,79,100,.45); }
.toast[data-tone="p"] { color: #78baf4; border-color: rgba(76,155,234,.45); }
.toast[data-tone="t"] { color: #6ce2ae; border-color: rgba(53,201,138,.45); }

.celebration {
  position: fixed;
  z-index: 500;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(119,28,49,.24), transparent 42%);
}
.celebration.show { opacity: 1; visibility: visible; animation: celebration-layer 1.9s ease both; }
.celebration-card {
  position: relative;
  z-index: 2;
  min-width: min(360px, calc(100vw - 36px));
  padding: 28px 34px;
  border: 1px solid rgba(240,189,97,.62);
  border-radius: 26px 7px 26px 7px;
  text-align: center;
  background: linear-gradient(145deg, rgba(88,20,37,.96), rgba(16,9,14,.99) 62%);
  box-shadow: 0 30px 95px rgba(0,0,0,.66), 0 0 52px rgba(240,189,97,.16), inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
  transform: scale(.82) translateY(16px);
}
.celebration.show .celebration-card { animation: celebration-card-pop 1.9s cubic-bezier(.2,.85,.2,1) both; }
.celebration-card span { display: block; color: var(--gold-strong); font-size: 9px; font-weight: 800; letter-spacing: 3px; }
.celebration-card strong { display: block; margin-top: 8px; color: #fff0cf; font-size: clamp(30px, 7vw, 46px); letter-spacing: 5px; text-shadow: 0 0 22px rgba(240,189,97,.42); }
.celebration-card p { margin: 8px 0 0; color: #ffcf73; font-size: 16px; letter-spacing: 2px; }
.celebration-burst { position: absolute; width: 16px; height: 16px; }
.celebration-burst::before,
.celebration-burst::after { content: ""; position: absolute; inset: -78px; border: 1px solid rgba(240,189,97,.46); border-radius: 50%; }
.celebration.show .celebration-burst::before { animation: celebration-ring 1.35s ease-out both; }
.celebration.show .celebration-burst::after { animation: celebration-ring 1.35s .12s ease-out both; }
.celebration-burst i {
  --angle: 0deg;
  position: absolute;
  left: 7px;
  top: 7px;
  width: 5px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(#fff1b8, var(--gold-strong));
  box-shadow: 0 0 12px rgba(240,189,97,.72);
  transform: rotate(var(--angle)) translateY(-36px) scaleY(.25);
  transform-origin: 50% 8px;
  opacity: 0;
}
.celebration.show .celebration-burst i { animation: celebration-particle 1.1s ease-out both; }
.celebration-burst i:nth-child(1) { --angle: 0deg; }
.celebration-burst i:nth-child(2) { --angle: 30deg; }
.celebration-burst i:nth-child(3) { --angle: 60deg; }
.celebration-burst i:nth-child(4) { --angle: 90deg; }
.celebration-burst i:nth-child(5) { --angle: 120deg; }
.celebration-burst i:nth-child(6) { --angle: 150deg; }
.celebration-burst i:nth-child(7) { --angle: 180deg; }
.celebration-burst i:nth-child(8) { --angle: 210deg; }
.celebration-burst i:nth-child(9) { --angle: 240deg; }
.celebration-burst i:nth-child(10) { --angle: 270deg; }
.celebration-burst i:nth-child(11) { --angle: 300deg; }
.celebration-burst i:nth-child(12) { --angle: 330deg; }

@keyframes grid-drift { to { background-position: 150px 150px; } }
@keyframes mark-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes access-grid { to { background-position: 84px 84px; } }
@keyframes logo-breathe {
  50% { transform: translateY(-3px) scale(1.025); filter: drop-shadow(0 13px 24px rgba(0,0,0,.42)) drop-shadow(0 0 18px rgba(240,189,97,.22)); }
}
@keyframes access-scan { 0%, 100% { transform: translateY(-210px); opacity: 0; } 45%, 55% { opacity: .8; } 50% { transform: translateY(210px); } }
@keyframes access-card-enter { from { opacity: 0; transform: translateY(20px) scale(.975); } }
@keyframes card-sheen { 0%, 72% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes engine-pulse { 50% { opacity: .35; transform: scale(.7); } }
@keyframes app-reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes section-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes dock-rise { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes celebration-layer { 0%, 100% { opacity: 0; } 12%, 76% { opacity: 1; } }
@keyframes celebration-card-pop { 0% { opacity: 0; transform: scale(.72) translateY(22px); } 18%, 72% { opacity: 1; transform: scale(1) translateY(0); } 100% { opacity: 0; transform: scale(1.04) translateY(-8px); } }
@keyframes celebration-ring { 0% { opacity: 0; transform: scale(.25); } 18% { opacity: 1; } 100% { opacity: 0; transform: scale(2.45); } }
@keyframes celebration-particle { 0% { opacity: 0; transform: rotate(var(--angle)) translateY(-34px) scaleY(.2); } 18% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--angle)) translateY(-210px) scaleY(1); } }
@keyframes streak-fire-border {
  to { filter: hue-rotate(-10deg) drop-shadow(0 0 calc(8px + var(--fire-glow)) rgba(255,86,16,.85)); transform: translateZ(0); background-position: 180% 180%; }
}
@keyframes streak-fire-glow { to { opacity: .42; transform: scale(1.008); } }
@keyframes streak-badge-pulse { to { filter: brightness(1.2); transform: translateY(-1px); } }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .engine-status { display: none; }
  .content-layout { grid-template-columns: minmax(0, 1fr) 290px; }
  .input-dock { grid-template-columns: auto minmax(0, 1fr); }
  .dock-copy { display: none; }
}

@media (max-width: 900px) {
  .app-frame { padding-bottom: 190px; }
  .topbar { grid-template-columns: 1fr auto; gap: 14px; padding: 15px 18px; }
  .session-strip { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .content-layout { grid-template-columns: 1fr; }
  .analysis-rail { position: static; grid-template-columns: 1.25fr 1fr; }
  .recent-card { grid-column: 1 / -1; }
  .derived-grid { grid-template-columns: 1fr; }
  .input-dock { min-height: 0; grid-template-columns: 1fr; gap: 10px; overflow-y: auto; overscroll-behavior: contain; }
  .pair-controls { justify-content: center; }
  .result-controls { width: 100%; }
}

@media (max-width: 620px) {
  :root { --cell-size: 31px; }
  .app-frame { padding-bottom: 180px; }
  .topbar { min-height: 0; }
  .header-logo { width: 54px; height: 54px; }
  .brand-block h1 { font-size: 22px; letter-spacing: 4px; }
  .brand-block .micro-label,
  .brand-subtitle { display: none; }
  .header-actions .ghost-btn { width: 42px; padding: 0; font-size: 0; }
  .header-actions .ghost-btn span { font-size: 20px; }
  .header-actions .outline-btn { padding: 0 12px; }
  .session-strip { gap: 8px; }
  .session-meta { min-width: 120px; }
  .workspace { width: calc(100% - 20px); padding-top: 14px; }
  .stats-ribbon { grid-template-columns: repeat(4, 1fr); border-radius: 15px 4px 15px 4px; }
  .stats-ribbon article { min-height: 76px; padding: 13px 10px; text-align: center; }
  .stats-ribbon article:last-child { grid-column: 1 / -1; min-height: 64px; text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .stats-ribbon article:last-child span { grid-column: 1; }
  .stats-ribbon article:last-child strong { grid-column: 1; }
  .stats-ribbon article:last-child small { grid-column: 2; grid-row: 1 / 3; }
  .stats-ribbon strong { font-size: 22px; }
  .panel-heading { min-height: 58px; padding: 11px 13px; }
  .panel-heading h2,
  .panel-heading h3 { font-size: 15px; }
  .legend { gap: 8px; }
  .legend span { font-size: 0; }
  .road-derived { --cell-size: 24px; }
  .road-bead { --cell-size: 29px; }
  .analysis-rail { grid-template-columns: 1fr; }
  .recent-card { grid-column: auto; }
  .analysis-card { padding: 16px; }
  .input-dock { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); padding: 10px; border-radius: 17px 5px 17px 5px; }
  .pair-toggle { height: 38px; }
  .result-controls { gap: 6px; }
  .result-btn { min-width: 0; height: 58px; padding: 8px 9px; }
  .result-btn strong { font-size: 20px; }
  .result-btn kbd { display: none; }
  .tie-btn { max-width: none; }
  .toast { top: auto; right: 12px; bottom: 178px; left: 12px; text-align: center; }
  .license-gate { padding: 10px; }
  .access-card { padding: 28px 18px 22px; border-radius: 20px 5px 20px 5px; }
  .access-orbit { width: 104px; height: 104px; margin-bottom: 13px; }
  .access-orbit > i:nth-child(2) { inset: 11px; }
  .access-orbit > i:nth-child(3) { inset: 22px; }
  .access-logo { width: 76px; height: 76px; }
  .access-subtitle { margin-bottom: 20px; }
  .access-input-row { grid-template-columns: 1fr; }
  .access-input-row button { height: 43px; }
  .access-status { font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* LUMERIS brand layer ----------------------------------------------------- */
body.lumeris-theme {
  --bg: #041014;
  --bg-soft: #071a20;
  --panel: rgba(7, 28, 34, .94);
  --panel-2: rgba(9, 38, 45, .9);
  --line: rgba(49, 242, 194, .15);
  --line-strong: rgba(143, 232, 255, .42);
  --gold: #31f2c2;
  --gold-strong: #8fe8ff;
  --burgundy: #0a8190;
  --text: #edf7f4;
  --muted: #7fa5a6;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 12%, rgba(20, 196, 178, .16), transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(42, 123, 167, .14), transparent 32%),
    linear-gradient(145deg, #02090c, #06171c 52%, #020b0e);
}

body.lumeris-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .46;
  background-image:
    linear-gradient(rgba(49, 242, 194, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 232, 255, .028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(120deg, #000, transparent 76%);
  animation: lumeris-grid-scan 22s linear infinite;
}

.lumeris-theme .license-gate {
  background:
    radial-gradient(circle at 50% 30%, rgba(49, 242, 194, .14), transparent 34%),
    linear-gradient(155deg, #02090c, #071c22 58%, #020a0d);
}

.lumeris-theme .license-gate::before,
.lumeris-theme .license-gate::after {
  border-color: rgba(49, 242, 194, .17);
  box-shadow: 0 0 85px rgba(49, 242, 194, .08);
}

.lumeris-theme .access-card {
  border-color: rgba(143, 232, 255, .34);
  border-radius: 8px 34px 8px 34px;
  background:
    linear-gradient(135deg, rgba(49, 242, 194, .09), transparent 42%),
    rgba(4, 22, 27, .95);
  box-shadow: 0 44px 150px rgba(0, 0, 0, .62), 0 0 70px rgba(49, 242, 194, .1);
}

.lumeris-theme .access-card::before {
  background: linear-gradient(90deg, transparent, #31f2c2, #8fe8ff, transparent);
  animation: lumeris-card-scan 4.6s ease-in-out infinite;
}

.lumeris-theme .access-orbit > i { border-color: rgba(49, 242, 194, .26); }
.lumeris-theme .access-orbit > i:nth-child(2) { border-color: rgba(143, 232, 255, .3); }
.lumeris-theme .access-logo,
.lumeris-theme .header-logo {
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .44)) drop-shadow(0 0 16px rgba(49, 242, 194, .22));
}

.lumeris-theme .access-logo { animation: lumeris-mark-float 4s ease-in-out infinite; }
.lumeris-theme .micro-label { color: #31f2c2; }
.lumeris-theme .access-input-row input:focus {
  border-color: #31f2c2;
  box-shadow: 0 0 0 3px rgba(49, 242, 194, .09), inset 0 0 18px rgba(49, 242, 194, .04);
}

.lumeris-theme .primary-btn,
.lumeris-theme .access-input-row button {
  color: #021215;
  border-color: #8fe8ff;
  background: linear-gradient(105deg, #31f2c2, #8fe8ff);
  box-shadow: 0 10px 28px rgba(49, 242, 194, .15);
}

.lumeris-theme .panel,
.lumeris-theme .road-panel,
.lumeris-theme .analysis-card,
.lumeris-theme .stats-ribbon {
  border-color: var(--line);
  border-radius: 5px 22px 5px 22px;
  background:
    linear-gradient(135deg, rgba(49, 242, 194, .035), transparent 38%),
    var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .27), inset 0 1px rgba(255, 255, 255, .025);
}

.lumeris-theme .panel-heading,
.lumeris-theme .analysis-card-heading {
  border-bottom-color: rgba(49, 242, 194, .09);
}

.lumeris-theme .stats-ribbon article::after {
  background: linear-gradient(90deg, #31f2c2, #8fe8ff);
}

.lumeris-theme .score-gauge {
  filter: drop-shadow(0 0 18px rgba(49, 242, 194, .14));
}

.lumeris-theme .input-dock {
  border-color: rgba(143, 232, 255, .35);
  border-radius: 5px 22px 5px 22px;
  background: rgba(3, 19, 24, .96);
  box-shadow: 0 -20px 80px rgba(0, 0, 0, .44), 0 0 36px rgba(49, 242, 194, .08);
}

@media (min-width: 1101px) {
  .lumeris-theme .app-frame {
    min-height: 100vh;
    padding-bottom: 128px;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    align-items: start;
  }

  .lumeris-theme .topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    width: 272px;
    height: 100vh;
    min-height: 720px;
    padding: 30px 22px 150px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 28px;
    border-right: 1px solid rgba(49, 242, 194, .16);
    border-bottom: 0;
    background:
      linear-gradient(180deg, rgba(49, 242, 194, .055), transparent 30%),
      rgba(3, 18, 23, .94);
    backdrop-filter: blur(24px);
  }

  .lumeris-theme .brand-block {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 13px;
  }

  .lumeris-theme .header-logo { width: 74px; height: 74px; }
  .lumeris-theme .brand-block h1 { font-size: 23px; letter-spacing: 4px; }
  .lumeris-theme .brand-block .micro-label { font-size: 7px; letter-spacing: 1.2px; }

  .lumeris-theme .session-strip {
    width: 100%;
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .lumeris-theme .session-meta,
  .lumeris-theme .engine-status {
    width: 100%;
    min-height: 54px;
    justify-content: flex-start;
    border: 1px solid rgba(49, 242, 194, .09);
    border-radius: 4px 14px 4px 14px;
    background: rgba(4, 27, 33, .72);
  }

  .lumeris-theme .header-actions {
    width: 100%;
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lumeris-theme .header-actions button { width: 100%; }
  .lumeris-theme .workspace {
    width: min(1600px, calc(100% - 42px));
    padding: 30px 0 48px;
  }

  .lumeris-theme .stats-ribbon {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    animation: lumeris-panel-in .6s ease both;
  }

  .lumeris-theme .input-dock {
    left: calc(272px + clamp(14px, 1.5vw, 24px));
    right: clamp(14px, 1.5vw, 24px);
    bottom: max(14px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: none;
    border-radius: 5px 22px 5px 22px;
  }

  body.access-ready.lumeris-theme .input-dock { animation-name: lumeris-dock-rise; }
  body.access-locked.lumeris-theme .input-dock { transform: translateY(18px); }
}

@media (max-width: 1100px) {
  .lumeris-theme .app-frame { display: block; }
  .lumeris-theme .topbar {
    background: rgba(3, 18, 23, .93);
    border-bottom-color: rgba(49, 242, 194, .15);
  }
}

@media (max-width: 620px) {
  .lumeris-theme .stats-ribbon,
  .lumeris-theme .access-card,
  .lumeris-theme .analysis-card,
  .lumeris-theme .road-panel,
  .lumeris-theme .input-dock { border-radius: 4px 16px 4px 16px; }
  .lumeris-theme .access-logo { width: 84px; height: 84px; }
}

@keyframes lumeris-grid-scan {
  to { background-position: 96px 48px, 48px 96px; }
}

@keyframes lumeris-card-scan {
  0%, 72%, 100% { transform: translateX(-120%); opacity: 0; }
  82% { opacity: 1; }
  96% { transform: translateX(120%); opacity: 0; }
}

@keyframes lumeris-dock-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes lumeris-mark-float {
  50% { transform: translateY(-6px) rotate(-1deg); filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .42)) drop-shadow(0 0 24px rgba(49, 242, 194, .3)); }
}

@keyframes lumeris-panel-in {
  from { opacity: 0; transform: translateX(14px); }
}

@media (prefers-reduced-motion: reduce) {
  .lumeris-theme *,
  .lumeris-theme *::before,
  .lumeris-theme *::after { animation: none !important; transition: none !important; }
}

/* LUMERIS spectral command layer ---------------------------------------- */
body.lumeris-theme {
  --bg: #050b18;
  --bg-soft: #09142a;
  --panel: rgba(8, 18, 39, .94);
  --panel-2: rgba(12, 28, 56, .9);
  --line: rgba(78, 140, 255, .16);
  --line-strong: rgba(255, 181, 71, .42);
  --gold: #ffca78;
  --gold-strong: #ffb547;
  --burgundy: #2259bb;
  --text: #f5f8ff;
  --muted: #8497bb;
  background:
    radial-gradient(circle at 10% 4%, rgba(78, 140, 255, .19), transparent 29%),
    radial-gradient(circle at 88% 84%, rgba(255, 181, 71, .12), transparent 31%),
    linear-gradient(148deg, #030712, #08152d 55%, #050915);
}

body.lumeris-theme::before {
  opacity: .6;
  background-image:
    linear-gradient(rgba(78, 140, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 181, 71, .028) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 52% 30%, #000, transparent 82%);
  animation: lumeris-grid-drift 26s linear infinite;
}

.lumeris-spectrum {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.lumeris-spectrum i {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(92vw, 1320px);
  aspect-ratio: 1;
  border: 1px solid rgba(78, 140, 255, .09);
  border-radius: 50%;
  transform: translate(-50%, -50%) scaleY(.34) rotate(8deg);
  animation: lumeris-spectrum-spin 30s linear infinite;
}

.lumeris-spectrum i:nth-child(2) {
  width: min(70vw, 980px);
  border-color: rgba(255, 181, 71, .11);
  border-style: dashed;
  animation-duration: 21s;
  animation-direction: reverse;
}

.lumeris-spectrum i:nth-child(3) {
  width: min(46vw, 640px);
  border-color: rgba(220, 233, 255, .1);
  transform: translate(-50%, -50%) scaleY(.34) rotate(-18deg);
  animation-duration: 15s;
}

.lumeris-theme .license-gate {
  background:
    radial-gradient(circle at 50% 35%, rgba(78, 140, 255, .2), transparent 34%),
    radial-gradient(circle at 50% 65%, rgba(255, 181, 71, .08), transparent 30%),
    linear-gradient(150deg, #020611, #09162e 58%, #040817);
}

.lumeris-theme .license-gate::before,
.lumeris-theme .license-gate::after {
  border-color: rgba(78, 140, 255, .2);
  box-shadow: 0 0 95px rgba(78, 140, 255, .1);
}

.lumeris-theme .access-card {
  border-color: rgba(255, 181, 71, .36);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(78, 140, 255, .12), transparent 40%),
    rgba(5, 13, 30, .96);
  box-shadow: 0 42px 140px rgba(0, 0, 0, .62), 0 0 78px rgba(78, 140, 255, .12);
}

.lumeris-theme .access-card::before {
  background: linear-gradient(90deg, transparent, #4e8cff, #ffb547, transparent);
  animation: lumeris-spectral-scan 4.8s ease-in-out infinite;
}

.lumeris-theme .access-orbit > i { border-color: rgba(78, 140, 255, .34); }
.lumeris-theme .access-orbit > i:nth-child(2) { border-color: rgba(255, 181, 71, .36); }
.lumeris-theme .access-logo,
.lumeris-theme .header-logo {
  filter: drop-shadow(0 12px 25px rgba(0, 0, 0, .5)) drop-shadow(0 0 19px rgba(78, 140, 255, .28));
}
.lumeris-theme .access-logo { animation: lumeris-core-pulse 4.2s ease-in-out infinite; }
.lumeris-theme .micro-label { color: #ffb547; }

.lumeris-theme .access-input-row input:focus {
  border-color: #4e8cff;
  box-shadow: 0 0 0 3px rgba(78, 140, 255, .11), inset 0 0 18px rgba(78, 140, 255, .05);
}

.lumeris-theme .primary-btn,
.lumeris-theme .access-input-row button {
  color: #07101f;
  border-color: #ffca78;
  background: linear-gradient(110deg, #4e8cff, #ffb547);
  box-shadow: 0 12px 30px rgba(78, 140, 255, .17);
}

.lumeris-theme .topbar {
  position: sticky;
  z-index: 45;
  top: 12px;
  width: min(1580px, calc(100% - 28px));
  margin: 0 auto;
  border: 1px solid rgba(255, 181, 71, .22);
  border-radius: 24px;
  background: rgba(5, 13, 30, .88);
  box-shadow: 0 18px 62px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 255, 255, .04);
}

.lumeris-theme .road-panel,
.lumeris-theme .analysis-card,
.lumeris-theme .stats-ribbon {
  border-color: rgba(78, 140, 255, .15);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(78, 140, 255, .05), transparent 38%),
    var(--panel);
  box-shadow: 0 22px 72px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .025);
}

.lumeris-theme .stats-ribbon { gap: 8px; overflow: visible; border: 0; background: transparent; box-shadow: none; }
.lumeris-theme .stats-ribbon article {
  border: 1px solid rgba(78, 140, 255, .13);
  border-radius: 16px;
  background: rgba(7, 17, 37, .9);
}
.lumeris-theme .stats-ribbon article::after { background: linear-gradient(90deg, #4e8cff, #ffb547); }
.lumeris-theme .panel-heading,
.lumeris-theme .analysis-card-heading { border-bottom-color: rgba(78, 140, 255, .1); }
.lumeris-theme .score-gauge { filter: drop-shadow(0 0 20px rgba(78, 140, 255, .16)); }

.lumeris-theme .input-dock {
  left: 50%;
  right: auto;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(1180px, calc(100% - 30px));
  max-width: 1180px;
  transform: translateX(-50%);
  border-color: rgba(255, 181, 71, .34);
  border-radius: 22px;
  background: rgba(5, 13, 29, .97);
  box-shadow: 0 -18px 75px rgba(0, 0, 0, .5), 0 0 38px rgba(78, 140, 255, .09);
}

body.access-ready.lumeris-theme .input-dock { animation-name: lumeris-dock-arrive; }
body.access-locked.lumeris-theme .input-dock { transform: translateX(-50%) translateY(18px); }

@media (min-width: 1101px) {
  .lumeris-theme .app-frame { display: block; min-height: 100vh; padding: 14px 0 132px; }
  .lumeris-theme .topbar {
    height: auto;
    min-height: 88px;
    padding: 14px 22px;
    display: grid;
    grid-template-columns: minmax(270px, .85fr) minmax(360px, 1.2fr) auto;
    align-items: center;
    gap: 24px;
  }
  .lumeris-theme .brand-block { display: flex; gap: 15px; }
  .lumeris-theme .header-logo { width: 62px; height: 62px; }
  .lumeris-theme .brand-block h1 { font-size: 25px; letter-spacing: 5px; }
  .lumeris-theme .session-strip { width: auto; margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
  .lumeris-theme .session-meta,
  .lumeris-theme .engine-status { width: auto; min-height: 50px; border-radius: 14px; background: rgba(12, 28, 56, .66); }
  .lumeris-theme .header-actions { width: auto; margin: 0; display: flex; gap: 8px; }
  .lumeris-theme .header-actions button { width: auto; }
  .lumeris-theme .workspace { width: min(1580px, calc(100% - 30px)); padding: 28px 0 44px; }
  .lumeris-theme .content-layout { grid-template-columns: 336px minmax(0, 1fr); }
  .lumeris-theme .analysis-rail { order: -1; top: 116px; }
  .lumeris-theme .roads-stack { order: 1; }
}

@media (max-width: 1100px) {
  .lumeris-theme .app-frame { display: block; padding-top: 9px; }
  .lumeris-theme .topbar { top: 8px; width: calc(100% - 16px); }
}

@media (max-width: 620px) {
  .lumeris-theme .stats-ribbon { gap: 6px; }
  .lumeris-theme .stats-ribbon article,
  .lumeris-theme .access-card,
  .lumeris-theme .analysis-card,
  .lumeris-theme .road-panel,
  .lumeris-theme .input-dock { border-radius: 15px; }
  .lumeris-theme .input-dock { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); }
  .lumeris-spectrum i { width: 150vw; }
}

@keyframes lumeris-grid-drift { to { background-position: 108px 54px, 54px 108px; } }
@keyframes lumeris-spectrum-spin { to { transform: translate(-50%, -50%) scaleY(.34) rotate(368deg); } }
@keyframes lumeris-spectral-scan {
  0%, 70%, 100% { transform: translateX(-120%); opacity: 0; }
  80% { opacity: 1; }
  96% { transform: translateX(120%); opacity: 0; }
}
@keyframes lumeris-core-pulse {
  50% { transform: scale(1.045); filter: drop-shadow(0 16px 27px rgba(0, 0, 0, .48)) drop-shadow(0 0 27px rgba(255, 181, 71, .33)); }
}
@keyframes lumeris-dock-arrive {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .lumeris-spectrum *,
  .lumeris-theme *,
  .lumeris-theme *::before,
  .lumeris-theme *::after { animation: none !important; transition: none !important; }
}
