/* =========================================
   THE LAST LIGHT SURVIVAL GUIDE
   style.css v1.0
   Zero external dependencies. Works offline.
   ========================================= */

/* === RESET & ROOT === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds — dark green-black tones */
  --bg-0: #070a09;
  --bg-1: #0c110f;
  --bg-2: #121a16;
  --bg-3: #182019;
  --bg-4: #1e2820;
  --bg-5: #243028;

  /* Text */
  --text-0: #eceee0;    /* warm white — readable by flashlight */
  --text-1: #c4cebc;
  --text-2: #8a9e86;
  --text-3: #4d6048;

  /* Accent — amber/gold primary (best flashlight contrast) */
  --amber:       #c9a94e;
  --amber-light: #e8c96e;
  --amber-dim:   #7a6430;
  --green:       #4b9e6a;
  --green-dim:   #2a5a3c;
  --red:         #c84848;
  --red-dim:     #6e2828;
  --orange:      #c87a40;
  --orange-dim:  #6e4020;
  --blue:        #4a80b5;
  --blue-dim:    #28486a;

  /* Borders */
  --border:      #243028;
  --border-hi:   #3a4838;

  /* Spacing */
  --sp-xs: 0.25rem;
  --sp-sm: 0.5rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2rem;
  --sp-2xl: 3rem;

  /* Layout */
  --sidebar-w: 290px;
  --header-h:  62px;
  --aria-w:    370px;
  --content-max: 920px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Courier New', Courier, monospace;

  /* Transitions */
  --ease: 0.2s ease;
  --ease-slow: 0.35s ease;
}

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-1);
  color: var(--text-0);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* =============================================
   OVERLAY (sidebar + ARIA backdrop on mobile)
   ============================================= */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 150;
}
.overlay.active { display: block; }

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: transform var(--ease-slow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  text-decoration: none;
  color: var(--amber);
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logo-glow 4s ease-in-out infinite;
}
.logo-icon svg { width: 22px; height: 22px; display: block; }
.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--amber-light);
}
.logo-sub {
  display: block;
  font-size: 0.65rem;
  color: var(--text-2);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Search inside sidebar */
.sidebar-search {
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: var(--sp-sm) var(--sp-md);
  color: var(--text-0);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--ease);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--amber-dim); }

.search-results {
  position: absolute;
  top: 100%;
  left: var(--sp-lg);
  right: var(--sp-lg);
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 300;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.search-results.active { display: block; }

.search-result-item {
  display: block;
  padding: var(--sp-sm) var(--sp-md);
  text-decoration: none;
  color: var(--text-0);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.focused { background: var(--bg-5); }
.search-result-item .result-title { font-size: 0.9rem; font-weight: 600; color: var(--amber); }
.search-result-item .result-section { font-size: 0.75rem; color: var(--text-2); }
.search-result-item .result-snippet { font-size: 0.8rem; color: var(--text-1); margin-top: 2px; }
.search-no-results { padding: var(--sp-md); color: var(--text-2); font-size: 0.85rem; text-align: center; }
.search-count { padding: 4px var(--sp-md); font-size: 0.72rem; color: var(--text-3); border-bottom: 1px solid var(--border); }
.search-group-label { padding: 6px var(--sp-md) 2px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--amber-dim); font-weight: 700; }

/* Nav list */
.nav-list {
  list-style: none;
  padding: var(--sp-sm) 0;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  padding: var(--sp-sm) var(--sp-lg);
  font-size: 0.65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  margin-top: var(--sp-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 0.55rem var(--sp-lg);
  text-decoration: none;
  color: var(--text-1);
  font-size: 0.92rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--ease);
}
.nav-item:hover {
  background: var(--bg-3);
  color: var(--text-0);
}
.nav-item.active {
  color: var(--amber);
  border-left-color: var(--amber);
  background: var(--bg-3);
  position: relative;
  overflow: hidden;
}
/* Subtle scan-line shimmer on the active nav item */
.nav-item.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(201,169,78,.06) 50%,
    transparent 100%
  );
  background-size: 100% 200%;
  animation: nav-scan 3.5s ease-in-out infinite;
  pointer-events: none;
}
.nav-item .nav-icon { width: 1.25rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .nav-icon svg { width: 15px; height: 15px; display: block; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  background: var(--amber-dim);
  color: var(--amber-light);
  padding: 1px 6px;
  border-radius: 999px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--sp-md) var(--sp-lg);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.sidebar-live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.35rem;
}
.sidebar-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: breathe 2.8s ease-in-out infinite;
}
.sidebar-live-label {
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* =============================================
   HEADER
   ============================================= */
.site-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--bg-0);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-xl);
  gap: var(--sp-md);
  z-index: 100;
}

#menu-toggle {
  display: none;
}

.header-breadcrumb {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.header-breadcrumb .crumb-parent {
  font-size: 0.7rem;
  color: var(--text-2);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.header-breadcrumb .crumb-parent:hover { color: var(--amber); }
.header-breadcrumb .page-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-0);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
  transition: margin-right var(--ease-slow);
}
.main-content.aria-open {
  margin-right: var(--aria-w);
}

.content-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-2xl) var(--sp-xl);
}

/* Section metadata bar */
.section-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}
.meta-item {
  font-size: 0.8rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1 { font-size: 2.2rem; font-weight: 800; color: var(--amber-light); line-height: 1.2; margin-bottom: var(--sp-md); }
h2 { font-size: 1.55rem; font-weight: 700; color: var(--text-0); margin: var(--sp-2xl) 0 var(--sp-md); padding-bottom: var(--sp-sm); border-bottom: 2px solid var(--amber-dim); }
h3 { font-size: 1.2rem; font-weight: 700; color: var(--amber); margin: var(--sp-xl) 0 var(--sp-sm); }
h4 { font-size: 1rem; font-weight: 700; color: var(--text-1); margin: var(--sp-lg) 0 var(--sp-xs); }

p { margin-bottom: var(--sp-md); color: var(--text-1); }
p:last-child { margin-bottom: 0; }

a { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--amber-light); }

strong { color: var(--text-0); font-weight: 700; }
em { color: var(--text-1); }

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-4);
  color: var(--amber-light);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-hi);
}

pre {
  background: var(--bg-0);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: var(--sp-lg);
  overflow-x: auto;
  margin: var(--sp-lg) 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--amber-light);
  line-height: 1.5;
}

blockquote {
  border-left: 4px solid var(--amber-dim);
  padding: var(--sp-md) var(--sp-lg);
  margin: var(--sp-lg) 0;
  background: var(--bg-3);
  border-radius: 0 8px 8px 0;
  color: var(--text-1);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-2xl) 0; }

/* =============================================
   LISTS
   ============================================= */
ul, ol {
  padding-left: var(--sp-xl);
  margin-bottom: var(--sp-md);
  color: var(--text-1);
}
li { margin-bottom: var(--sp-xs); }
li::marker { color: var(--amber-dim); }
ul li::marker { content: "▸ "; }

/* Checklist */
.checklist {
  list-style: none;
  padding-left: 0;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-xs) 0;
}
.checklist li::before {
  content: "☐";
  color: var(--amber-dim);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.checklist li.done::before { content: "☑"; color: var(--green); }

/* Step list */
.steps {
  list-style: none;
  padding: 0;
  counter-reset: steps;
}
.steps > li {
  counter-increment: steps;
  display: flex;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
  padding: var(--sp-md);
  background: var(--bg-3);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.steps > li::before {
  content: counter(steps);
  background: var(--amber-dim);
  color: var(--amber-light);
  font-weight: 800;
  font-size: 0.85rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* =============================================
   CALLOUT BOXES
   ============================================= */
.callout {
  border-radius: 8px;
  padding: var(--sp-md) var(--sp-lg);
  margin: var(--sp-lg) 0;
  border-left: 4px solid;
  display: flex;
  gap: var(--sp-md);
}
.callout-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.callout-content { flex: 1; }
.callout-content p { margin-bottom: var(--sp-xs); }
.callout-content p:last-child { margin-bottom: 0; }
.callout strong { display: block; margin-bottom: var(--sp-xs); font-size: 0.9rem; letter-spacing: .04em; text-transform: uppercase; }

.callout-danger {
  background: rgba(200,72,72,.12);
  border-color: var(--red);
}
.callout-danger .callout-content strong { color: var(--red); }

.callout-warning {
  background: rgba(200,122,64,.12);
  border-color: var(--orange);
}
.callout-warning .callout-content strong { color: var(--orange); }

.callout-info {
  background: rgba(74,128,181,.12);
  border-color: var(--blue);
}
.callout-info .callout-content strong { color: var(--blue); }

.callout-tip {
  background: rgba(75,158,106,.12);
  border-color: var(--green);
}
.callout-tip .callout-content strong { color: var(--green); }

.callout-amber {
  background: rgba(201,169,78,.10);
  border-color: var(--amber-dim);
}
.callout-amber .callout-content strong { color: var(--amber); }

/* =============================================
   TABLES
   ============================================= */
.table-wrap { overflow-x: auto; margin: var(--sp-lg) 0; border-radius: 8px; border: 1px solid var(--border); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead { background: var(--bg-4); }
thead th {
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  font-weight: 700;
  color: var(--amber);
  border-bottom: 2px solid var(--amber-dim);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--ease); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-3); }
td { padding: var(--sp-sm) var(--sp-md); color: var(--text-1); vertical-align: top; }
td:first-child { color: var(--text-0); font-weight: 600; }

/* =============================================
   CARDS
   ============================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-lg);
  margin: var(--sp-xl) 0;
}
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-lg);
  text-decoration: none;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--amber-dim);
  transition: background var(--ease);
}
.card:hover {
  border-color: var(--amber-dim);
  background: var(--bg-4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.card:hover::before { background: var(--amber); }

.card-icon { font-size: 2rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-0); margin: 0; }
.card-desc { font-size: 0.85rem; color: var(--text-2); flex: 1; }
.card-meta { font-size: 0.75rem; color: var(--text-3); display: flex; gap: var(--sp-sm); }
.card-arrow { color: var(--amber-dim); margin-top: auto; font-size: 1.2rem; }

/* Section cards on home */
.section-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-lg) var(--sp-xl);
  text-decoration: none;
  color: inherit;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-lg);
  transition: all var(--ease);
}
.section-card:hover {
  border-color: var(--amber-dim);
  background: var(--bg-4);
}
.section-card .sc-icon { font-size: 2rem; }
.section-card .sc-body {}
.section-card .sc-title { font-weight: 700; color: var(--text-0); font-size: 1rem; }
.section-card .sc-desc { font-size: 0.85rem; color: var(--text-2); }
.section-card .sc-meta { display: flex; gap: var(--sp-sm); margin-top: 4px; }
.section-card .sc-tag {
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-5);
  color: var(--text-2);
}
.section-card .sc-arrow { color: var(--amber-dim); font-size: 1.5rem; }

/* =============================================
   TOC (Table of Contents)
   ============================================= */
.toc {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber-dim);
  border-radius: 0 12px 12px 0;
  padding: var(--sp-lg);
  margin: var(--sp-xl) 0;
}
.toc-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--amber);
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}
.toc ol {
  margin: 0;
  padding-left: var(--sp-lg);
}
.toc li { margin-bottom: 3px; }
.toc a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--ease);
}
.toc a:hover { color: var(--amber); }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--ease);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--amber-dim);
  color: var(--amber-light);
  border-color: var(--amber-dim);
}
.btn-primary:hover { background: var(--amber); color: var(--bg-0); }

.btn-danger {
  background: var(--red-dim);
  color: #ff9999;
  border-color: var(--red-dim);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-outline {
  background: transparent;
  border-color: var(--border-hi);
  color: var(--text-1);
}
.btn-outline:hover { border-color: var(--amber-dim); color: var(--amber); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-0); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; display: block; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
}
.btn-icon:hover { background: var(--bg-3); color: var(--text-0); }

/* =============================================
   ARIA AI PANEL
   ============================================= */
.aria-panel {
  position: fixed;
  top: 0; right: 0;
  width: var(--aria-w);
  height: 100vh;
  background: var(--bg-0);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 175;
  transform: translateX(100%);
  transition: transform var(--ease-slow);
}
.aria-panel.open { transform: translateX(0); }

.aria-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  min-height: var(--header-h);
}
.aria-title {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.aria-avatar {
  width: 2.2rem;
  height: 2.2rem;
  background: var(--amber-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.aria-avatar svg { width: 1.1rem; height: 1.1rem; display: block; color: var(--bg-0); }
.aria-title-text { line-height: 1.2; }
.aria-title-text strong { font-size: 0.95rem; color: var(--amber-light); display: block; }
.aria-title-text small { font-size: 0.68rem; color: var(--text-3); }

.aria-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}
.status-dot.checking { background: var(--orange); animation: pulse 1.5s infinite; }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

@keyframes breathe {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.18); }
}

@keyframes logo-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(201,169,78,.25)); }
  50%       { filter: drop-shadow(0 0 10px rgba(201,169,78,.65)); }
}

@keyframes nav-scan {
  0%   { background-position: 0 -100%; }
  100% { background-position: 0 200%; }
}

.aria-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.aria-message {
  max-width: 90%;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.aria-message.from-aria {
  background: var(--bg-3);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.aria-message.from-user {
  background: var(--amber-dim);
  color: var(--bg-0);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  max-width: 85%;
}
.aria-message.aria-welcome {
  background: var(--bg-3);
  border: 1px solid var(--amber-dim);
  align-self: flex-start;
  max-width: 100%;
}
.aria-note {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-top: var(--sp-xs);
  padding-top: var(--sp-xs);
  border-top: 1px solid var(--border);
}

.aria-thinking {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: var(--sp-sm) var(--sp-md);
}
.aria-thinking span {
  width: 6px; height: 6px;
  background: var(--amber-dim);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.aria-thinking span:nth-child(2) { animation-delay: .2s; }
.aria-thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.aria-input-area {
  padding: var(--sp-md);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--sp-sm);
  background: var(--bg-2);
}
#aria-input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: var(--sp-sm) var(--sp-md);
  color: var(--text-0);
  font-family: var(--font);
  font-size: 0.88rem;
  resize: none;
  outline: none;
  transition: border-color var(--ease);
  line-height: 1.5;
}
#aria-input::placeholder { color: var(--text-3); }
#aria-input:focus { border-color: var(--amber-dim); }

/* =============================================
   BACK TO TOP
   ============================================= */
#back-to-top {
  position: fixed;
  bottom: var(--sp-xl);
  right: var(--sp-xl);
  background: var(--bg-3);
  color: var(--amber);
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: all var(--ease);
}
#back-to-top.visible { display: flex; }
#back-to-top:hover { background: var(--amber-dim); color: var(--amber-light); }

/* =============================================
   HERO (Home Page)
   ============================================= */
.hero {
  padding: var(--sp-2xl) 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2xl);
}
.hero-icon { font-size: 4rem; margin-bottom: var(--sp-md); }
.hero h1 {
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--amber-light), var(--amber), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--sp-md);
}
.hero-tagline { font-size: 1.1rem; color: var(--text-2); max-width: 600px; margin: 0 auto var(--sp-xl); }
.hero-actions { display: flex; gap: var(--sp-md); justify-content: center; flex-wrap: wrap; }

/* =============================================
   HOME GRID
   ============================================= */
.home-section { margin-bottom: var(--sp-2xl); }
.home-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: var(--sp-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.home-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* =============================================
   SECTION CONTENT ELEMENTS
   ============================================= */
.section-header {
  margin-bottom: var(--sp-2xl);
  padding-bottom: var(--sp-xl);
  border-bottom: 2px solid var(--border);
}
.section-header h1 { margin-bottom: var(--sp-sm); }
.section-header .section-desc { font-size: 1.05rem; color: var(--text-2); }

/* Ratio / measurement boxes */
.ratio-box {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--bg-0);
  border: 2px solid var(--amber-dim);
  border-radius: 8px;
  padding: var(--sp-sm) var(--sp-lg);
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--amber-light);
  font-weight: 700;
  margin: var(--sp-md) 0;
}

/* ASCII/SVG diagrams */
.diagram {
  background: var(--bg-0);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: var(--sp-lg);
  margin: var(--sp-lg) 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  line-height: 1.4;
}

/* Quick facts ribbon */
.quick-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-sm);
  margin: var(--sp-lg) 0;
}
.quick-fact {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-md);
  text-align: center;
}
.quick-fact .qf-value { font-size: 1.6rem; font-weight: 800; color: var(--amber); display: block; }
.quick-fact .qf-label { font-size: 0.75rem; color: var(--text-2); }

/* Tag / badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-danger { background: var(--red-dim); color: #ff9999; }
.badge-warning { background: var(--orange-dim); color: #ffaa77; }
.badge-success { background: var(--green-dim); color: #77dd99; }
.badge-info { background: var(--blue-dim); color: #88bbee; }
.badge-amber { background: var(--amber-dim); color: var(--amber-light); }

/* Skill level tags */
.skill-tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  margin-right: 4px;
}
.skill-beginner     { background: var(--green-dim);  color: #77dd99; }
.skill-intermediate { background: var(--amber-dim);  color: var(--amber-light); }
.skill-advanced     { background: var(--red-dim);    color: #ff9999; }

/* Timeline tags */
.timeline-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.68rem; font-family: var(--mono);
  font-weight: 600; border: 1px solid;
  margin-right: 3px;
}
.tag-72hr   { color: var(--red);       border-color: var(--red-dim);    background: rgba(192,57,43,.1); }
.tag-2week  { color: var(--orange);    border-color: var(--orange-dim); background: rgba(204,120,50,.1); }
.tag-3month { color: var(--amber);     border-color: var(--amber-dim);  background: rgba(201,169,78,.1); }
.tag-1year  { color: var(--green);     border-color: var(--green-dim);  background: rgba(39,174,96,.1); }
.tag-5year  { color: var(--blue);      border-color: var(--blue-dim);   background: rgba(74,128,181,.1); }

/* Climate zone tags */
.climate-tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 0.67rem; color: var(--text-2);
  background: var(--bg-4); border: 1px solid var(--border);
  margin-right: 3px;
}

/* SVG technical diagram wrapper */
.svg-diagram {
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  margin: var(--sp-lg) 0;
  overflow: hidden;
}
.svg-diagram svg { display: block; width: 100%; height: auto; }
.svg-diagram figcaption {
  font-size: 0.75rem; color: var(--text-2);
  padding: .4rem var(--sp-md);
  border-top: 1px solid var(--border);
  font-style: italic;
}

/* Section tag row (skill + timeline + climate together) */
.section-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: var(--sp-sm) 0 var(--sp-md); }

/* Quick-reference print card */
.print-card {
  background: var(--bg-3);
  border: 2px solid var(--amber-dim);
  border-radius: 8px;
  padding: var(--sp-lg);
  margin: var(--sp-xl) 0;
  page-break-inside: avoid;
}
.print-card h3 {
  color: var(--amber);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: var(--sp-md);
  border-bottom: 1px solid var(--amber-dim);
  padding-bottom: .4rem;
}
@media print {
  .print-card { border-color: #000; background: #fff; color: #000; }
  .print-card h3 { color: #000; border-color: #000; }
}

/* Two column layout within content */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-xl); }
.col-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-lg); }

/* Inline key-value pairs */
.kv-list { list-style: none; padding: 0; }
.kv-list li { display: flex; gap: var(--sp-md); padding: var(--sp-xs) 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.kv-list li:last-child { border-bottom: none; }
.kv-list .k { color: var(--text-2); min-width: 140px; flex-shrink: 0; }
.kv-list .v { color: var(--text-0); font-weight: 600; }

/* =============================================
   AI SETUP PAGE
   ============================================= */
.setup-step {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-xl);
  margin-bottom: var(--sp-lg);
  position: relative;
}
.setup-step-num {
  position: absolute;
  top: var(--sp-lg);
  right: var(--sp-lg);
  font-size: 3rem;
  font-weight: 900;
  color: var(--bg-5);
  line-height: 1;
  user-select: none;
}

/* Hardware tier table colors */
.tier-low td:first-child { color: var(--green); }
.tier-mid td:first-child { color: var(--amber); }
.tier-high td:first-child { color: var(--red); }

/* =============================================
   QUICK REFERENCE PAGE
   ============================================= */
.qr-page {
  max-width: 800px;
  margin: 0 auto;
}
.qr-header {
  text-align: center;
  border: 3px solid var(--amber);
  border-radius: 12px;
  padding: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}
.qr-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: var(--sp-md);
  overflow: hidden;
}
.qr-section-title {
  background: var(--bg-3);
  padding: var(--sp-sm) var(--sp-md);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.qr-content { padding: var(--sp-md); }
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.qr-item { font-size: 0.85rem; }
.qr-item strong { display: block; color: var(--text-0); }
.qr-item span { color: var(--text-2); }

/* =============================================
   RESPONSIVE / MOBILE
   ============================================= */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .site-header {
    left: 0;
  }
  #menu-toggle {
    display: flex;
  }
  .main-content {
    margin-left: 0;
  }
  .main-content.aria-open {
    margin-right: 0;
  }
  .content-wrapper {
    padding: var(--sp-xl) var(--sp-md);
  }
  .hero h1 { font-size: 2rem; }
  .col-2 { grid-template-columns: 1fr; }
  .col-3 { grid-template-columns: 1fr; }
  .aria-panel {
    width: 100%;
  }
  #back-to-top {
    right: var(--sp-md);
    bottom: var(--sp-md);
  }
}

@media (max-width: 600px) {
  html { font-size: 16px; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.3rem; }
  .card-grid { grid-template-columns: 1fr; }
  .quick-facts { grid-template-columns: repeat(2, 1fr); }
  .section-card {
    grid-template-columns: auto 1fr;
  }
  .section-card .sc-arrow { display: none; }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
  :root { --text-0: #000; --text-1: #111; --text-2: #444; --bg-1: #fff; }

  .sidebar,
  .site-header,
  .aria-panel,
  #back-to-top,
  .btn,
  .header-actions,
  .section-meta,
  .overlay { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .content-wrapper { max-width: 100%; padding: 0.5in; }

  h1 { color: #000; font-size: 22pt; page-break-after: avoid; -webkit-text-fill-color: #000; }
  h2 { color: #000; font-size: 16pt; page-break-after: avoid; border-bottom: 2px solid #999; }
  h3 { color: #333; font-size: 13pt; page-break-after: avoid; }

  pre, .diagram {
    background: #f5f5f5;
    border: 1px solid #ccc;
    color: #333;
    page-break-inside: avoid;
  }
  code { background: #f0f0f0; color: #333; border: 1px solid #ccc; }

  .callout { background: #f9f9f9; border: 1px solid #ccc; page-break-inside: avoid; }
  .card, .setup-step { border: 1px solid #ccc; page-break-inside: avoid; }
  table { page-break-inside: avoid; }
  thead { background: #eee; }
  td, th { border: 1px solid #ccc; color: #000; }

  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; }

  .toc { border: 1px solid #ccc; background: #f9f9f9; }
  .badge { border: 1px solid #999; }

  @page {
    margin: 0.75in;
    size: letter;
  }
  @page :first { margin-top: 0.5in; }
}

/* Quick reference print override */
@media print {
  .qr-page { max-width: 100%; }
  .qr-header { border: 2px solid #000; }
  .qr-section { border: 1px solid #999; }
  .qr-section-title { background: #eee; color: #000; }
}

/* =============================================
   COMPREHENSIVE PRINT STYLESHEET
   ============================================= */
@media print {
  /* Hide navigation chrome and UI elements */
  #sidebar,
  .sidebar,
  #overlay,
  .aria-panel,
  .top-bar,
  .site-header,
  #back-to-top,
  .btn,
  #aria-panel,
  .tool-nav,
  .search-results,
  .no-print { display: none !important; }

  /* Base typography */
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
  }

  /* Links */
  a { color: black; text-decoration: underline; }

  /* Print URLs after links */
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.75em; }

  /* But NOT for anchor links */
  a[href^="#"]::after { content: ""; }

  /* And NOT for nav links */
  .nav-item::after { content: ""; }

  /* Page margins and numbering */
  @page { margin: 1.5cm; }
  body::after { content: counter(page); counter-increment: page; }

  /* Content layout */
  .content-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* SVG images */
  svg { max-width: 100% !important; height: auto !important; }

  /* Code and diagrams */
  pre,
  .diagram {
    white-space: pre-wrap;
    font-size: 8pt;
    border: 1px solid #ccc;
    background: #f5f5f5 !important;
    color: black !important;
  }

  /* Data tables */
  .data-table { width: 100%; border-collapse: collapse; }
  .data-table td,
  .data-table th { border: 1px solid #aaa; }

  /* Table header backgrounds */
  table th { background: #ddd !important; color: black !important; }

  /* Prevent orphaned headings */
  h1, h2, h3, h4 { page-break-after: avoid; break-after: avoid; }
  orphans: 3;
  widows: 3;

  /* Skip nav hidden in print */
  .skip-nav { display: none !important; }

  /* ARIA toolbar/actions hidden in print */
  .aria-toolbar, .aria-actions, .aria-system-prompt { display: none !important; }

  /* Page counter footer */
  @page {
    @bottom-right { content: counter(page) " / " counter(pages); font-size: 8pt; color: #666; }
    @bottom-left  { content: "The Last Light Survival Guide"; font-size: 8pt; color: #666; }
  }

  /* Force page break before major sections (except the first) */
  .section-hero { page-break-before: always; break-before: always; }
  .section-hero:first-of-type { page-break-before: auto; break-before: auto; }

  /* Alert and card styles */
  .alert-box,
  .callout,
  .card {
    border: 1px solid #aaa !important;
    background: white !important;
    color: black !important;
  }

  /* Print-only elements */
  .print-only { display: block !important; }

  /* Non-print elements */
  .no-print { display: none !important; }

  /* Quick reference cards — 2 per page width */
  .quick-ref-card {
    width: 48%;
    display: inline-block;
    vertical-align: top;
    page-break-inside: avoid;
  }

  /* Expand details/summary elements in print */
  details > summary::after { content: ""; }
  details { display: block; }

  /* Force black on all inline-colored text */
  [style*="color"] { color: black !important; }
}

/* =============================================
   HIGH CONTRAST MODE
   ============================================= */
body.mode-hc {
  --bg-0: #000000;
  --bg-1: #000000;
  --bg-2: #0a0a0a;
  --bg-3: #111111;
  --bg-4: #1a1a1a;
  --bg-5: #222222;
  --text-0: #ffffff;
  --text-1: #ffffff;
  --text-2: #dddddd;
  --amber: #ffdd44;
  --amber-light: #ffee66;
  --border: #444444;
  --border-hi: #666666;
}

/* =============================================
   NIGHT VISION MODE
   Night vision mode — red tones preserve scotopic vision for outdoor use
   ============================================= */
body.mode-nv {
  --bg-0: #110000;
  --bg-1: #1a0000;
  --bg-2: #200000;
  --bg-3: #2a0000;
  --bg-4: #330000;
  --bg-5: #3d0000;
  --text-0: #ff4444;
  --text-1: #dd3333;
  --text-2: #aa2222;
  --amber: #ff6666;
  --amber-light: #ff8888;
  --green: #cc2222;
  --border: #330000;
  --border-hi: #550000;
}

/* =============================================
   FONT SIZE MODES
   ============================================= */
body.font-lg { font-size: 19px; }
body.font-xl { font-size: 22px; }

/* =============================================
   MODE TOGGLE BAR
   ============================================= */
.mode-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: 2rem;
  padding: 0.4rem 0.8rem;
  z-index: 800;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.mode-bar:hover { opacity: 1; }
.mode-bar button {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  transition: all 0.15s;
}
.mode-bar button:hover,
.mode-bar button.active { background: var(--bg-5); color: var(--amber); }

/* === SECTION PAGINATION === */
.section-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-1);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  white-space: nowrap;
}
.pagination-btn:hover { border-color: var(--amber); color: var(--amber); background: var(--bg-3); }
.pagination-home { color: var(--amber-dim); }
@media (max-width: 600px) {
  .section-pagination { flex-wrap: wrap; justify-content: center; }
}

/* =============================================
   SKIP NAVIGATION (accessibility)
   ============================================= */
.skip-nav {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--amber);
  color: var(--bg-0);
  font-weight: 700;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-nav:focus {
  top: 0;
  outline: 3px solid var(--amber-light);
  outline-offset: 2px;
}

/* =============================================
   ARIA TOOLBAR (model selector, temp, tokens)
   ============================================= */
.aria-toolbar {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-2);
}
.aria-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.aria-toolbar-label {
  font-size: 0.7rem;
  color: var(--text-2);
  min-width: 2.5rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.aria-select {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-1);
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}
.aria-select:focus { border-color: var(--amber); outline: none; }
.aria-slider {
  flex: 1;
  accent-color: var(--amber);
  cursor: pointer;
}
.aria-slider-val {
  font-size: 0.7rem;
  color: var(--amber);
  min-width: 2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.aria-token-count {
  font-size: 0.7rem;
  color: var(--text-2);
  white-space: nowrap;
}

/* ARIA provider toggle */
.aria-provider-toggle {
  display: flex;
  flex: 1;
  gap: 0.3rem;
}
.aria-provider-btn {
  flex: 1;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.aria-provider-btn:hover {
  border-color: var(--text-2);
  color: var(--text-1);
}
.aria-provider-btn.active {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--bg-4);
}

/* ARIA API key input */
.aria-apikey-input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-1);
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
  font-family: monospace;
  min-width: 0;
}
.aria-apikey-input:focus {
  border-color: var(--amber);
  outline: none;
}
.aria-apikey-input::placeholder {
  color: var(--text-3);
}

/* ARIA action buttons row */
.aria-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.aria-actions .btn {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}
.aria-actions .btn.emergency-on {
  border-color: var(--red);
  color: var(--red);
}

/* ARIA system prompt collapsible */
.aria-system-prompt {
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.aria-system-prompt summary {
  padding: 0.4rem 0.75rem;
  font-size: 0.7rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.aria-system-prompt summary::before { content: '▶ '; }
.aria-system-prompt[open] summary::before { content: '▼ '; }
.aria-system-prompt pre {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem;
  line-height: 1.5;
  color: var(--text-2);
  white-space: pre-wrap;
  background: var(--bg-1);
  border: none;
  border-radius: 0;
  max-height: 160px;
  overflow-y: auto;
}

/* =================== PWA SAFE AREAS =================== */
/* Runs only when launched as installed PWA (standalone mode).
   Pads fixed elements away from iPhone notch / Dynamic Island / home bar. */
@media (display-mode: standalone) {
  .site-header {
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    height: calc(var(--header-h) + env(safe-area-inset-top));
  }
  .main-content {
    padding-top: calc(var(--header-h) + env(safe-area-inset-top));
  }
  .sidebar {
    padding-top: env(safe-area-inset-top);
  }
  .mode-bar {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

/* =================== INSTALL BANNER =================== */
#install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--bg-2);
  border-top: 1px solid var(--border-hi);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  animation: banner-slide-up 0.3s ease;
}
@keyframes banner-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.ib-icon { font-size: 1.6rem; flex-shrink: 0; }
.ib-text { flex: 1; min-width: 0; }
.ib-text strong { display: block; font-size: 0.85rem; color: var(--text-1); }
.ib-text small  { font-size: 0.72rem; color: var(--text-2); }
.ib-dismiss {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.1rem;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.ib-dismiss:hover { color: var(--text-1); }
.ib-install { flex-shrink: 0; }
