/* ==========================================================================
   Hyperstition Studio — Unified Group 3 Style System (Preferred Default)
   "Stealth Basalt Plate & Micro-Pip Signal Ribbon" (haiperdohp × hyperstitionstud.io)
   - 90% Quiet Matte Basalt (#020617 Void / #070d1b Well / #0c1324-#111a2e Zebra / #26344d Border)
   - 7% Interactive Affordance Layer (#132038 Fill / #38bdf8 Sky-Cyan Edge)
   - 3% Explicit Attention Beacons (#f59e0b Amber-Gold / #f43f5e Rose / #10b981 Emerald)
   - Universal 10px/4px 45-Deg Chamfered Plates + 24px × 3px Left-Shoulder Signal Pip
   - Retained border-radius: 999px Stadium-Pill Donate Buttons (.btn-donate-pill & .tactile-donate-btn)
   ========================================================================== */

:root {
  --font-mono: 'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --bg-void: #020617;
  --bg-deep: #020617;
  --bg-well: #070d1b;
  --bg-card: #0c1324;
  --bg-panel: #0c1324;
  --bg-surface: #0c1324;
  --bg-elevated: #111a2e;
  --bg-bezel: #182338;
  --bg-interact: #132038;
  --border: #26344d;
  --border-subtle: #26344d;
  --text-main: #e2e8f0;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --gold: #f59e0b;
  --accent-gold: #f59e0b;
  --cyan: #38bdf8;
  --accent-cyan: #38bdf8;
  --emerald: #10b981;
  --accent-emerald: #10b981;
  --rose: #f43f5e;
  --accent-rose: #f43f5e;
  --violet: #a855f7;
  --accent-violet: #a855f7;
}

body,
button,
input,
select,
textarea,
code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

body {
  background-color: var(--bg-void);
  background-image:
    linear-gradient(0deg, rgba(14, 22, 40, 0.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 22, 40, 0.38) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-main);
}

/* Group 3: 10px Top-Shoulder / 4px Bottom-Corner 45-Deg Chamfered Basalt Plates
   + Matte Basalt Stipple Top Rail + 28px × 3px Left-Shoulder Signal Pip */
header,
.card,
.panel,
.hero-panel,
.stat-card,
.module-card,
.lesson-panel,
.custody-card,
.allocation-card,
.hs-plate-g3,
.phraseGemContainer,
#BreakTableContainer,
#ChartSpot {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 !important;
  clip-path: polygon(
    10px 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% calc(100% - 4px),
    calc(100% - 4px) 100%,
    4px 100%,
    0 calc(100% - 4px),
    0 10px
  );
  background-image:
    linear-gradient(90deg, transparent 0px, transparent 14px, var(--pip-color, #475569) 14px, var(--pip-color, #475569) 42px, var(--bg-bezel) 42px, var(--bg-bezel) calc(100% - 10px), transparent calc(100% - 10px)),
    radial-gradient(rgba(30, 45, 72, 0.32) 1px, transparent 0);
  background-size: 100% 3px, 6px 6px;
  background-position: 0 0, 0 0;
  background-repeat: no-repeat, repeat;
  min-width: 0;
  overflow-wrap: anywhere;
}

header {
  --pip-color: #f59e0b;
}

.panel.interactive-plate,
.lesson-panel,
#BreakTableContainer,
#ChartSpot {
  --pip-color: #38bdf8;
}

.plate-lock-gold {
  --pip-color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.65) !important;
}

.plate-lock-emerald {
  --pip-color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.65) !important;
}

.plate-lock-rose {
  --pip-color: #f43f5e !important;
  border-color: rgba(244, 63, 94, 0.72) !important;
}

/* Recessed Wells (#BreakdownSpot / #ChartSpot / Code & Address Copy Boxes) */
pre,
code,
.code-well,
.address-box,
#BreakdownSpot,
#ChartSpot {
  background-color: var(--bg-well);
}

/* .HistoryTable / Zebra Tables (Calm Matte Slate Rows at Rest) */
table {
  border-collapse: collapse;
  border-spacing: 0;
  border: 1px solid var(--border);
}

table th {
  background-color: var(--bg-well);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

table tr:nth-child(odd) td {
  background-color: var(--bg-card);
}

table tr:nth-child(even) td {
  background-color: var(--bg-elevated);
}

/* 7% Interactive Layer: 34px Height-Locked 45-Deg Chamfered Controls */
.top-nav a.btn:not(.btn-donate-pill),
.top-nav button.btn:not(.btn-donate-pill),
button.btn:not(.tactile-donate-btn),
a.btn:not(.btn-donate-pill):not(.tactile-donate-btn),
.intBtn,
#queryDBbtn,
#enterPhraseBtn,
#autoMatchBtn,
#hltModeBtn {
  height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-interact);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 0 !important;
  clip-path: polygon(
    4px 0,
    calc(100% - 4px) 0,
    100% 4px,
    100% calc(100% - 4px),
    calc(100% - 4px) 100%,
    4px 100%,
    0 calc(100% - 4px),
    0 4px
  );
  line-height: 1;
}

.top-nav a.btn:not(.btn-donate-pill):hover,
button.btn:not(.tactile-donate-btn):hover,
.intBtn:hover {
  border-color: var(--cyan);
  background-color: #192b4b;
  color: #f8fafc;
}

/* RETAINED DONATION BUTTON STYLE (Deliberate border-radius: 999px Stadium-Pill Contrast — v2.4.0 Canonical Single Source of Truth) */
.nav-donate-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.2rem;
  display: inline-block;
  flex-shrink: 0;
  align-self: center;
}

.btn-donate-pill {
  height: 34px !important;
  box-sizing: border-box !important;
  border-radius: 999px !important;
  clip-path: none !important;
  padding: 0.28rem 0.9rem 0.28rem 0.35rem !important;
  background: linear-gradient(180deg, #ffd86b 0%, #f59e0b 52%, #d97706 100%) !important;
  color: #020617 !important;
  border: 1px solid #f5c630 !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(245, 158, 11, 0.22) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  line-height: 1 !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
}

.btn-donate-pill:hover {
  filter: brightness(1.06) !important;
  transform: translateY(-1px) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.65), 0 4px 12px rgba(245, 158, 11, 0.32) !important;
  color: #020617 !important;
}

.donate-pill-emblem {
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  clip-path: none !important;
  background: #0f172a !important;
  color: var(--rose) !important;
  border: 1px solid rgba(245, 198, 48, 0.7) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.68rem !important;
  line-height: 1 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
}

.tactile-donate-btn {
  border-radius: 999px !important;
  clip-path: none !important;
}

.tactile-emblem {
  border-radius: 50% !important;
  clip-path: none !important;
}

/* ============================================================================
   ADDITIVE POLYGLOT PEDAGOGICAL LENS (GUILE / TS / RUST / ALL 3) & REPL (v2.3.0)
   ============================================================================ */
.hs-polyglot-segmented {
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  background: var(--bg-void) !important;
  border: 1px solid rgba(56, 189, 248, 0.55) !important;
  padding: 0 0.2rem !important;
  gap: 0.15rem !important;
}

.hs-polyglot-prefix {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0 0.35rem;
  letter-spacing: 0.05em;
}

.hs-polyglot-seg {
  height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  padding: 0 0.48rem !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-secondary) !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  font-family: inherit !important;
  cursor: pointer !important;
}

.hs-polyglot-seg:hover {
  color: var(--cyan) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

.hs-polyglot-seg.hs-seg-active,
.hs-polyglot-seg[aria-checked="true"] {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: var(--emerald) !important;
  color: var(--emerald) !important;
}

.hs-guile-toggle {
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  padding: 0 0.72rem !important;
  background: var(--bg-panel) !important;
  border: 1px solid rgba(56, 189, 248, 0.55) !important;
  color: var(--cyan) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}

html[data-guile-scheme-mode="on"] .hs-guile-toggle {
  background: rgba(16, 185, 129, 0.16) !important;
  border-color: var(--emerald) !important;
  color: var(--emerald) !important;
}

.hs-guile-lambda-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  background: var(--bg-void);
  border: 1px solid currentColor;
  font-weight: 700;
  font-size: 0.65rem;
}

.hs-guile-cartridge {
  display: none;
  margin-top: 0.65rem;
  margin-bottom: 0.9rem;
  padding: 0.95rem 1.15rem;
  border-left: 3px solid var(--cyan) !important;
}

html[data-guile-scheme-mode="on"] .hs-guile-cartridge {
  display: block;
}

html[data-polyglot-lens="guile"] .hs-lang-box-ts,
html[data-polyglot-lens="guile"] .hs-lang-box-rust {
  display: none;
}

html[data-polyglot-lens="ts"] .hs-lang-box-guile,
html[data-polyglot-lens="ts"] .hs-lang-box-rust {
  display: none;
}

html[data-polyglot-lens="rust"] .hs-lang-box-guile,
html[data-polyglot-lens="rust"] .hs-lang-box-ts {
  display: none;
}

.hs-guile-triview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.65rem;
  margin: 0.55rem 0;
}

.hs-guile-box {
  background: var(--bg-void);
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  font-size: 0.71rem;
  overflow-x: auto;
}

#hsGuileReplDrawer {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(560px, calc(100vw - 32px));
  z-index: 90;
  background: var(--bg-well);
  border: 1px solid var(--cyan);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.82);
  padding: 0.75rem 0.9rem;
}

html[data-guile-scheme-mode="on"] #hsGuileReplDrawer {
  display: block;
}

#hsGuileReplDrawer.hs-repl-minimized .hs-repl-body {
  display: none;
}

/* ==========================================================================
   Subtle Basalt-Phosphor Matrix Code Rain & Cybernetic/Occult Micro-Sigils
   ========================================================================== */
@font-face {
  font-family: "matrix-font";
  src: url("matrix-font.woff2") format("woff2");
  font-display: swap;
}

#hsMatrixCodeRainCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

body > .container,
body > header,
body > main,
body > section,
body > footer,
#hsGuileReplDrawer {
  position: relative;
  z-index: 1;
}

.hs-sigil {
  display: inline-block;
  font-family: 'DejaVu Sans Mono', monospace;
  opacity: 0.78;
  margin-right: 0.28rem;
  font-weight: 400;
}

.hs-sigil-seal {
  display: inline-block;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 0.7rem;
  color: var(--gold);
  opacity: 0.72;
  letter-spacing: 0.08em;
  margin-left: 0.35rem;
}

.hs-sigil-colophon {
  display: inline-block;
  font-family: 'DejaVu Sans Mono', monospace;
  color: var(--cyan);
  opacity: 0.68;
  letter-spacing: 0.08em;
}

.hs-plate-g3.plate-lock-gold::after,
.card.plate-lock-gold::after,
.panel.plate-lock-gold::after {
  content: "\260D \00B7 37\00D73k";
  position: absolute;
  top: 6px;
  right: 12px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 0.64rem;
  color: var(--gold);
  opacity: 0.32;
  pointer-events: none;
  letter-spacing: 0.04em;
}

.hs-plate-g3.plate-lock-emerald::after,
.card.plate-lock-emerald::after,
.panel.plate-lock-emerald::after {
  content: "\263F \00B7 \0394=0";
  position: absolute;
  top: 6px;
  right: 12px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 0.64rem;
  color: var(--emerald);
  opacity: 0.32;
  pointer-events: none;
  letter-spacing: 0.04em;
}

.hs-plate-g3.plate-lock-rose::after,
.card.plate-lock-rose::after,
.panel.plate-lock-rose::after {
  content: "\2297 \00B7 S\00D7S6";
  position: absolute;
  top: 6px;
  right: 12px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 0.64rem;
  color: var(--rose);
  opacity: 0.32;
  pointer-events: none;
  letter-spacing: 0.04em;
}

html[data-sigil-accents="off"] .hs-sigil,
html[data-sigil-accents="off"] .hs-sigil-seal,
html[data-sigil-accents="off"] .hs-sigil-colophon,
html[data-sigil-accents="off"] .hs-plate-g3::after,
html[data-sigil-accents="off"] .card::after,
html[data-sigil-accents="off"] .panel::after {
  display: none !important;
}

.hs-rain-toggle-btn {
  padding: 0.18rem 0.52rem !important;
  font-size: 0.67rem !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: var(--cyan) !important;
  background: var(--bg-void) !important;
  cursor: pointer;
}

/* ==========================================================================
   Homepage 2x2 Quadrant Frame Geometry & Single Interactive Chamfered Tab Row
   (Strategy 1C-3: Top=16px, Bottom=16px, Left=20px, Right=20px, 6px Tab Gap)
   ========================================================================== */
.showcase-grid .card {
  padding: 16px 20px !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;
  gap: 6px !important;
}

.closeup-tab-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  width: 100%;
  margin: 2px 0 6px 0;
  padding: 0;
}

.closeup-tab-btn {
  height: 32px;
  padding: 0 12px;
  font-family: 'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: #0b0f17;
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.closeup-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--pip-color, var(--cyan));
}

.closeup-tab-btn[aria-selected="true"] {
  background: #121c2e;
  color: var(--text-main);
  border-color: var(--pip-color, var(--cyan));
  box-shadow: inset 3px 0 0 var(--pip-color, var(--cyan)), inset 0 -2px 0 var(--pip-color, var(--cyan));
}

.showcase-grid .closeup-frame {
  margin: 0 !important;
  background: #05080e;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.closeup-viewport {
  display: block;
  text-decoration: none;
  color: inherit;
  line-height: 0;
}

.closeup-viewport img {
  width: 100%;
  height: auto;
  display: block;
}

.closeup-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #0a0e15;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  line-height: 1.2;
}

.closeup-bar-label {
  color: var(--text-secondary);
}

.closeup-bar-cta {
  color: var(--cyan);
  font-weight: 700;
  text-decoration: none;
}

.closeup-bar-cta:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Unified Cross-Page Navigation UI (Plan #63 & Plan #65 — Matching Homepage)
   ========================================================================== */
.title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  flex-shrink: 0;
}

.top-nav.hs-global-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.38rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

@media (max-width: 1180px) {
  .top-nav.hs-global-nav {
    flex-wrap: wrap;
  }
}

.top-nav.hs-global-nav .btn {
  text-decoration: none;
  background-color: var(--bg-interact);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.55);
  padding: 0.34rem 0.62rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-mono);
  transition: all 0.15s ease;
}

.top-nav.hs-global-nav .btn:hover,
.meta-badges .btn:hover {
  border-color: var(--cyan) !important;
  background-color: #192b4b !important;
  color: #f8fafc !important;
}

.top-nav.hs-global-nav .btn.primary,
.meta-badges .btn.primary,
a.btn.primary:not(.btn-donate-pill),
button.btn.primary:not(.tactile-donate-btn),
button.btn.active:not(.tactile-donate-btn) {
  background-color: var(--cyan) !important;
  color: #020617 !important;
  border-color: var(--cyan) !important;
  font-weight: 700;
}

.hs-subnav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.65rem 1rem;
  margin-bottom: 0.9rem;
}

.hs-subnav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
}

/* ==========================================================================
   Adaptive Group 3 Mobile UI (Plan #66 — Affirmed Strategies 1A, 2A, 3A, 4A)
   Strictly scoped under html[data-device-ui="mobile"] (0 Desktop UI changes)
   ========================================================================== */
.hs-mobile-menu-btn,
.hs-mobile-nav-sheet {
  display: none;
}

html[data-device-ui="mobile"] body {
  padding: 0.65rem 0.65rem !important;
}

html[data-device-ui="mobile"] header {
  flex-wrap: wrap !important;
  padding: 0.75rem 0.85rem !important;
  gap: 0.5rem !important;
  margin-bottom: 0.65rem !important;
}

html[data-device-ui="mobile"] header h1 {
  white-space: normal !important;
  font-size: 0.85rem !important;
  line-height: 1.3 !important;
}

html[data-device-ui="mobile"] .subtitle {
  font-size: 0.66rem !important;
  line-height: 1.35 !important;
}

html[data-device-ui="mobile"] .hs-mobile-menu-btn {
  display: inline-flex !important;
  margin-left: auto;
  height: 30px !important;
  padding: 0 0.55rem !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  flex-shrink: 0;
}

html[data-device-ui="mobile"] .meta-badges,
html[data-device-ui="mobile"] .top-nav.hs-global-nav {
  width: 100% !important;
  margin-left: 0 !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  gap: 0.35rem !important;
}

html[data-device-ui="mobile"] .hs-mobile-nav-sheet.open {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--cyan);
}

html[data-device-ui="mobile"] .hs-mobile-sheet-link {
  width: 100%;
  min-height: 38px !important;
  justify-content: center !important;
  text-align: center;
}

html[data-device-ui="mobile"] .hs-subnav-bar {
  padding: 0.5rem 0.65rem !important;
  overflow-x: auto !important;
}

html[data-device-ui="mobile"] .hs-polyglot-segmented {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

html[data-device-ui="mobile"] #hsGuileReplDrawer {
  left: 8px !important;
  right: 8px !important;
  bottom: 8px !important;
  width: auto !important;
}

html[data-device-ui="mobile"] #quantInfoPopover {
  left: 8px !important;
  right: 8px !important;
  bottom: 8px !important;
  top: auto !important;
  width: auto !important;
  max-width: none !important;
}

html[data-device-ui="mobile"] #guildPills,
html[data-device-ui="mobile"] #modePills,
html[data-device-ui="mobile"] #tutEpisodeTabs {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding-bottom: 3px;
}
