/* ==========================================================================
 * ZONE v135 - HAND-DRAWN SKETCHBOOK TOPBAR, DRAWER & MOBILE SHELL
 * 100% 4-Way Parity: Light+EN, Dark+EN, Light+AR (RTL), Dark+AR (RTL)
 * Exclusive Ownership: mobile-shell (aaa-topbar-sidebar.css / .js)
 * Design System: Inherits --zwc-* Cold-Press Paper & Fountain-Pen/Chalk Ink
 * Mobile Shell: Native-Feel iOS HIG + Material 3 Sticky App Bar, Off-Canvas
 *               Logical RTL/LTR Drawer, & 5-Tab Thumb-Zone Bottom Bar (<=900px)
 * ========================================================================== */

/* --------------------------------------------------------------------------
 * 1. SEMANTIC SKETCHBOOK CHROME TOKENS (ZERO NAVY, ZERO WHITE SAAS, ZERO NEON)
 *    Light & Dark share 100% identical geometry, borders, radii & shadows;
 *    ONLY semantic --zwc-* paper/ink palette flips.
 * -------------------------------------------------------------------------- */
:root,
html:not([data-theme="light"]),
html:not([data-theme="light"]) body {
  --zaaa-bg-canvas: var(--zwc-paper, #141210);
  --zaaa-bg-topbar: var(--zwc-surface, var(--zwc-paper-elevated, #1e1b17));
  --zaaa-bg-sidebar: var(--zwc-sidebar-bg, #191613);
  --zaaa-bg-card: var(--zwc-surface, var(--zwc-paper-elevated, #1e1b17));
  --zaaa-bg-elevated: var(--zwc-surface-alt, var(--zwc-paper-subcard, #25211c));
  --zaaa-bg-hover: var(--zwc-row-hover, rgba(142, 178, 102, 0.18));
  --zaaa-bg-active: var(--zwc-row-active, linear-gradient(90deg, rgba(134, 175, 98, 0.34) 0%, rgba(134, 175, 98, 0.12) 100%));
  --zaaa-btn-bg: var(--zwc-btn-bg, #2a251f);
  --zaaa-btn-hover: var(--zwc-btn-hover, #352f27);

  --zaaa-border-subtle: var(--zwc-ink-rule, rgba(242, 234, 217, 0.14));
  --zaaa-border-strong: var(--zwc-border-strong, rgba(242, 234, 217, 0.44));
  --zaaa-shadow-solid: var(--zwc-shadow-solid, #090807);
  --zaaa-shadow-card: var(--zwc-shadow-card, 3px 4px 0 rgba(0, 0, 0, 0.62));
  --zaaa-shadow-topbar: var(--zwc-topbar-shadow, 0 3px 0 rgba(0, 0, 0, 0.5));

  --zaaa-text-1: var(--zwc-ink, #f3ecdc);
  --zaaa-text-2: var(--zwc-ink-soft, #d8ccb6);
  --zaaa-text-3: var(--zwc-ink-muted, #aca08a);
  --zaaa-title-ink: var(--zwc-title-ink, #faf4e6);

  --zaaa-accent: var(--zwc-accent, var(--zwc-row-active-bar, #8ec364));
  --zaaa-cash: var(--zwc-green-ink, #92d17e);
  --zaaa-energy: var(--zwc-green-ink, #92d17e);
  --zaaa-nerve: var(--zwc-bad-ink, #ef7d68);
  --zaaa-life: var(--zwc-gold-ink, #f0c465);
  --zaaa-city: var(--zwc-blue-ink, #8ab8e8);

  --zaaa-scrim: rgba(12, 10, 8, 0.62);
  --zaaa-drawer-from: -100%;

  --zaaa-font-ui: var(--zwc-font-hand, "Patrick Hand", "Rubik", system-ui, sans-serif);
  --zaaa-font-display: var(--zwc-font-brush, "Caveat Brush", "Patrick Hand", "Oswald", sans-serif);
  --zaaa-font-mono: var(--zwc-font-hand, "Patrick Hand", "Rubik", monospace);
  --zaaa-radius-sm: var(--zwc-sketch-radius-sm, 185px 8px 165px 8px / 7px 165px 7px 185px);
}

html[data-theme="light"],
html[data-theme="light"] body {
  --zaaa-bg-canvas: var(--zwc-paper, #f2ebdc);
  --zaaa-bg-topbar: var(--zwc-surface, var(--zwc-paper-elevated, #f8f3e6));
  --zaaa-bg-sidebar: var(--zwc-sidebar-bg, #f7f1e3);
  --zaaa-bg-card: var(--zwc-surface, var(--zwc-paper-elevated, #f8f3e6));
  --zaaa-bg-elevated: var(--zwc-surface-alt, var(--zwc-paper-subcard, #fcf8ee));
  --zaaa-bg-hover: var(--zwc-row-hover, rgba(154, 176, 116, 0.26));
  --zaaa-bg-active: var(--zwc-row-active, linear-gradient(90deg, rgba(154, 176, 116, 0.52) 0%, rgba(154, 176, 116, 0.22) 100%));
  --zaaa-btn-bg: var(--zwc-btn-bg, #ede4cf);
  --zaaa-btn-hover: var(--zwc-btn-hover, #e3d7bd);

  --zaaa-border-subtle: var(--zwc-ink-rule, rgba(34, 30, 25, 0.16));
  --zaaa-border-strong: var(--zwc-border-strong, #23201c);
  --zaaa-shadow-solid: var(--zwc-shadow-solid, #23201c);
  --zaaa-shadow-card: var(--zwc-shadow-card, 3px 4px 0 rgba(36, 33, 29, 0.15));
  --zaaa-shadow-topbar: var(--zwc-topbar-shadow, 0 3px 0 rgba(30, 27, 24, 0.1));

  --zaaa-text-1: var(--zwc-ink, #1e1b18);
  --zaaa-text-2: var(--zwc-ink-soft, #3a342d);
  --zaaa-text-3: var(--zwc-ink-muted, #594f43);
  --zaaa-title-ink: var(--zwc-title-ink, #1a1714);

  --zaaa-accent: var(--zwc-accent, var(--zwc-row-active-bar, #4d7332));
  --zaaa-cash: var(--zwc-green-ink, #27582e);
  --zaaa-energy: var(--zwc-green-ink, #27582e);
  --zaaa-nerve: var(--zwc-bad-ink, #a93522);
  --zaaa-life: var(--zwc-gold-ink, #9a6519);
  --zaaa-city: var(--zwc-blue-ink, #27528a);

  --zaaa-scrim: rgba(30, 27, 24, 0.44);
}

html[dir="rtl"],
html[lang="ar"] {
  --zaaa-drawer-from: 100%;
  --zaaa-font-ui: "Noto Sans Arabic", "Rubik", sans-serif;
  --zaaa-font-display: "Noto Sans Arabic", "Rubik", sans-serif;
}

/* --------------------------------------------------------------------------
 * 2. HAND-INKED SKETCHBOOK SVG ICON ENGINE (SHARED LIGHT/DARK/EN/AR)
 *    Clean fountain-pen/chalk stroke + soft watercolor wash; never neon 3D
 * -------------------------------------------------------------------------- */
svg.zaaa-vivid-svg,
svg.zaaa-duotone-svg,
svg.zwc-sketch-ico {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: var(--zaaa-text-1);
}

svg.zwc-sketch-ico .zwc-ink-stroke {
  stroke: var(--zwc-svg-ink, currentColor);
}

svg.zwc-sketch-ico .zwc-wash-fill {
  fill-opacity: 0.56;
}

html:not([data-theme="light"]) svg.zwc-sketch-ico .zwc-wash-fill {
  fill-opacity: 0.74;
}

/* Directional icons mirror automatically in Arabic RTL */
html[dir="rtl"] svg.zwc-sketch-ico[data-rtl-flip="1"] {
  transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
 * 3. STICKY SKETCHBOOK TOPBAR (.zone-topbar & [data-zheaderbar])
 * -------------------------------------------------------------------------- */
html body .zone-app .zone-topbar,
html body #dc-root#dc-root .zone-app .zone-topbar {
  position: sticky !important;
  inset-block-start: 0 !important;
  z-index: 940 !important;
  background-color: var(--zaaa-bg-topbar) !important;
  background-image: var(--zwc-pencil-shade, none) !important;
  border-block-end: 2px solid var(--zaaa-border-strong) !important;
  box-shadow: var(--zaaa-shadow-topbar) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-family: var(--zaaa-font-ui) !important;
  color: var(--zaaa-text-1) !important;
}

html body .zone-topbar [data-zheaderbar],
html body #dc-root#dc-root .zone-app .zone-topbar [data-zheaderbar="1"] {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  max-width: 1440px !important;
  min-height: 50px !important;
  margin-inline: auto !important;
  padding-block: 5px !important;
  padding-inline: 14px !important;
  box-sizing: border-box !important;
}

/* Docked Mobile Drawer Trigger: hidden on desktop >= 901px, active on <= 900px */
#zaaa-mobile-rail-toggle {
  display: none;
}

#zaaa-drawer-backdrop,
#zaaa-drawer-header {
  display: none;
}

/* Engraved Sketchbook Brand Plaque ("ZONE") - High-contrast in Light & Dark */
html body .zone-topbar .zone-brand,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand {
  order: 1 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 36px !important;
  padding-block: 3px !important;
  padding-inline: 14px !important;
  background-color: var(--zaaa-bg-elevated) !important;
  background-image: none !important;
  border: 2px solid var(--zaaa-border-strong) !important;
  border-radius: 4px !important;
  box-shadow: 2px 2px 0 var(--zaaa-shadow-solid) !important;
  color: var(--zaaa-title-ink) !important;
  cursor: pointer !important;
  user-select: none !important;
  text-decoration: none !important;
  transition: transform 0.14s ease, background-color 0.14s ease !important;
}

html body .zone-topbar .zone-brand:hover,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand:hover {
  background-color: var(--zaaa-btn-hover) !important;
  transform: translateY(-1px) !important;
}

html body .zone-topbar .zone-brand::before,
html body .zone-topbar .zone-brand .zaaa-brand-crest,
html body .zone-topbar .zone-brand .zaaa-brand-meta,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand .zaaa-brand-crest,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand .zaaa-brand-meta {
  display: none !important;
}

html body .zone-topbar .zone-brand > span[data-zfig="1"],
html body .zone-topbar .zone-brand > span:first-of-type,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand > span[data-zfig="1"],
html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand > span:first-of-type {
  font-family: "Oswald", var(--zaaa-font-display), sans-serif !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0.08em !important;
  color: var(--zaaa-title-ink) !important;
  background: none !important;
  -webkit-text-fill-color: var(--zaaa-title-ink) !important;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

/* Desktop Header Nav Links (.zone-header-links) */
html body .zone-topbar .zone-header-links,
html body #dc-root#dc-root .zone-app .zone-header-links {
  order: 2 !important;
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  gap: 3px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
}

html body .zone-topbar .zone-header-links::-webkit-scrollbar,
html body #dc-root#dc-root .zone-app .zone-header-links::-webkit-scrollbar {
  display: none !important;
}

html body .zone-topbar .zone-header-links button.zone-header-link,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-links button.zone-header-link {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-height: 36px !important;
  padding-block: 4px !important;
  padding-inline: 9px !important;
  background-color: transparent !important;
  border: 1.5px solid transparent !important;
  border-radius: var(--zaaa-radius-sm) !important;
  box-shadow: none !important;
  color: var(--zaaa-text-1) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

html body .zone-topbar .zone-header-links button.zone-header-link .zaaa-link-icon {
  order: -1;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--zaaa-text-1);
}

html body .zone-topbar .zone-header-links button.zone-header-link:hover,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-links button.zone-header-link:hover {
  background-color: var(--zaaa-btn-bg) !important;
  border-color: var(--zaaa-border-strong) !important;
}

html body .zone-topbar .zone-header-links button.zone-header-link[aria-current="page"],
html body .zone-topbar .zone-header-links button.zone-header-link[data-zaaa-active="true"],
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-links button.zone-header-link[aria-current="page"],
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-links button.zone-header-link[data-zaaa-active="true"] {
  background-color: var(--zaaa-bg-elevated) !important;
  background-image: var(--zaaa-bg-active) !important;
  border-color: var(--zaaa-border-strong) !important;
  box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
  color: var(--zaaa-title-ink) !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

/* --------------------------------------------------------------------------
 * 4. UNIFIED SKETCHBOOK TELEMETRY CAPSULE (#zone-topbar-hud)
 *    Inherits --zwc-surface-alt & --zwc-ink in BOTH Light and Dark modes
 * -------------------------------------------------------------------------- */
html body .zone-topbar #zone-topbar-hud,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud {
  order: 3 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  min-height: 36px !important;
  padding-block: 2px !important;
  padding-inline: 6px !important;
  background-color: var(--zaaa-bg-elevated) !important;
  background-image: none !important;
  border: 1.5px solid var(--zaaa-border-strong) !important;
  border-radius: var(--zaaa-radius-sm) !important;
  box-shadow: 1.5px 2px 0 var(--zaaa-shadow-solid) !important;
  color: var(--zaaa-text-1) !important;
}

html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  min-height: 30px !important;
  padding-block: 3px !important;
  padding-inline: 8px !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-inline-end: 1px dashed var(--zaaa-border-subtle) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  color: var(--zaaa-text-1) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill:last-child,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill:last-child {
  border-inline-end: 0 !important;
}

html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill.zaaa-hud-life,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill.zaaa-hud-life {
  display: none !important;
}

html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill:hover,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill:hover {
  background-color: var(--zaaa-btn-bg) !important;
}

html body .zone-topbar #zone-topbar-hud :is(bdi, span),
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud :is(bdi, span) {
  color: var(--zaaa-text-1) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
}

html body .zone-topbar #zone-topbar-hud bdi,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud bdi {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  font-variant-numeric: tabular-nums !important;
}

html body .zone-topbar #zone-topbar-hud [data-hud="cash"] .zaaa-hud-val,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud [data-hud="cash"] .zaaa-hud-val {
  color: var(--zaaa-cash) !important;
}

html body .zone-topbar #zone-topbar-hud [data-hud="city"] .zaaa-hud-city-code,
html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud [data-hud="city"] .zaaa-hud-city-code {
  color: var(--zaaa-city) !important;
  font-size: 12px !important;
  padding-inline: 4px !important;
  border: 1px solid var(--zaaa-border-subtle) !important;
  border-radius: 3px !important;
}

.zaaa-hud-ico {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--zaaa-text-1);
}

[data-hud="cash"] .zaaa-hud-ico { color: var(--zaaa-cash) !important; }
[data-hud="energy"] .zaaa-hud-ico { color: var(--zaaa-energy) !important; }
[data-hud="nerve"] .zaaa-hud-ico { color: var(--zaaa-nerve) !important; }
[data-hud="life"] .zaaa-hud-ico { color: var(--zaaa-life) !important; }
[data-hud="city"] .zaaa-hud-ico { color: var(--zaaa-city) !important; }

/* Subtle hand-inked bottom progress underline for Energy & Nerve */
.zaaa-hud-pill[data-hud="energy"]::after,
.zaaa-hud-pill[data-hud="nerve"]::after {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  inset-block-end: 2px;
  height: 2px;
  width: calc((100% - 12px) * var(--zaaa-pct-num, 1));
  max-width: calc(100% - 12px);
  border-radius: 999px;
  background-color: var(--zaaa-energy);
  opacity: 0.78;
  pointer-events: none;
}

.zaaa-hud-pill[data-hud="nerve"]::after {
  background-color: var(--zaaa-nerve);
}

@media (max-width: 1220px) and (min-width: 901px) {
  html body .zone-topbar #zone-topbar-hud [data-hud="city"] .zaaa-hud-val,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud [data-hud="city"] .zaaa-hud-val {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
 * 5. TOPBAR UTILITY ACTIONS (.zone-header-actions)
 *    100% Identical Sketchbook Button Chrome Across Light/Dark/EN/AR
 * -------------------------------------------------------------------------- */
html body .zone-topbar .zone-header-actions,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions {
  order: 4 !important;
  margin-inline-start: auto !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

html body .zone-topbar .zone-header-actions > span:first-child,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > span:first-child {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-height: 34px !important;
  padding-block: 3px !important;
  padding-inline: 8px !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--zaaa-text-2) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 14px !important;
  white-space: nowrap !important;
}

html body .zone-topbar .zone-header-actions > span:first-child > span:not(.zaaa-chrono-ico) {
  display: none !important;
}

html body .zone-topbar .zone-header-actions > span:first-child .zaaa-chrono-ico {
  order: -1;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--zaaa-text-2);
}

html body .zone-topbar .zone-header-actions > span:first-child bdi,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > span:first-child bdi {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  font-variant-numeric: tabular-nums !important;
  color: var(--zaaa-text-1) !important;
  font-weight: 700 !important;
}

@media (max-width: 1120px) {
  html body .zone-topbar .zone-header-actions > span:first-child,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > span:first-child {
    display: none !important;
  }
}

html body .zone-topbar .zone-header-actions > button,
html body .zone-topbar .zone-header-actions > a,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  min-height: 36px !important;
  padding-block: 4px !important;
  padding-inline: 11px !important;
  background-color: var(--zaaa-btn-bg) !important;
  background-image: none !important;
  border: 1.5px solid var(--zaaa-border-strong) !important;
  border-radius: var(--zaaa-radius-sm) !important;
  box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
  color: var(--zaaa-text-1) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: background-color 0.14s ease, transform 0.12s ease !important;
}

html body .zone-topbar .zone-header-actions > button:hover,
html body .zone-topbar .zone-header-actions > a:hover,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button:hover,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > a:hover {
  background-color: var(--zaaa-btn-hover) !important;
  transform: translateY(-1px) !important;
}

/* Hand-Inked Sun & Crescent Moon Theme Indicator */
html body .zone-topbar .zone-header-actions .zone-theme-indicator,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions .zone-theme-indicator {
  width: 17px !important;
  height: 17px !important;
  flex: 0 0 17px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--zaaa-text-1) !important;
}

.zaaa-theme-svg {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html:not([data-theme="light"]) .zaaa-sun-svg {
  display: none !important;
}

html:not([data-theme="light"]) .zaaa-moon-svg {
  display: block !important;
}

html[data-theme="light"] .zaaa-moon-svg {
  display: none !important;
}

html[data-theme="light"] .zaaa-sun-svg {
  display: block !important;
}

.zaaa-admin-ico {
  order: -1;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--zaaa-text-1);
}

/* Logical RTL/LTR Crosshatch Mission Strip (.zone-bulletin / .zwc-mission-strip) on Desktop */
html body .zone-topbar .zone-bulletin,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin,
html body .zwc-mission-strip {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 31px !important;
  padding-block: 4px !important;
  padding-inline: max(18px, calc((100% - 1340px) / 2 + 18px)) !important;
  background: var(--zwc-crosshatch-bg, #221f1c) !important;
  border-block-start: 2px solid var(--zwc-crosshatch-border, #1e1b18) !important;
  border-block-end: 2px solid var(--zwc-crosshatch-border, #1e1b18) !important;
  color: #fcf9f2 !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 15.5px !important;
  overflow: hidden !important;
}

html body .zone-topbar .zone-bulletin *,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin *,
html body .zwc-mission-strip * {
  color: #fcf9f2 !important;
  font-family: var(--zaaa-font-ui) !important;
}

html body .zone-topbar .zone-bulletin > span:first-child,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin > span:first-child {
  position: relative !important;
  z-index: 3 !important;
  flex: 0 0 auto !important;
  padding-block: 1px !important;
  padding-inline: 8px !important;
  background: var(--zwc-bulletin-cap, #1c1916) !important;
  background-image: none !important;
  border: 1px solid rgba(252, 249, 242, 0.28) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  color: #fcf9f2 !important;
  font-weight: 700 !important;
}

html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin > span:first-child::before {
  display: none !important;
}

html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin > span:first-child[data-zwc-mission-label]::after {
  color: #fcf9f2 !important;
}

html body .zone-topbar .zone-bulletin [data-zticker="1"] span,
html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin [data-zticker="1"] span {
  color: #fcf9f2 !important;
  font-family: var(--zaaa-font-ui) !important;
}

/* --------------------------------------------------------------------------
 * 6. SKETCHBOOK OPERATIVE SIDEBAR (aside.zone-sidebar) - DESKTOP & SHARED
 *    100% Logical Properties (inset-inline, border-inline, margin-inline)
 * -------------------------------------------------------------------------- */
@media (min-width: 901px) {
  html body aside.zone-sidebar,
  html body #dc-root#dc-root .zone-app aside.zone-sidebar {
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding: 5px !important;
    background-color: var(--zaaa-bg-sidebar) !important;
    border: 2px solid var(--zaaa-border-strong) !important;
    border-radius: 4px !important;
    box-shadow: inset 0 0 0 1.5px var(--zaaa-border-subtle), var(--zaaa-shadow-card) !important;
    color: var(--zaaa-text-1) !important;
  }
}

/* Sidebar Section Headings - Semantic Paper/Ink in BOTH Light & Dark */
html body aside.zone-sidebar .zone-panel-heading,
html body aside.zone-sidebar .zone-nav-group,
html body #dc-root#dc-root .zone-app aside.zone-sidebar .zone-panel-heading,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation .zone-nav-group {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 28px !important;
  margin-block: 2px 0 !important;
  margin-inline: 0 !important;
  padding-block: 3px !important;
  padding-inline: 9px !important;
  background-color: var(--zaaa-btn-bg) !important;
  background-image: none !important;
  border: 0 !important;
  border-block-start: 1.5px solid var(--zaaa-border-strong) !important;
  border-block-end: 1.5px solid var(--zaaa-border-strong) !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  color: var(--zaaa-title-ink) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  text-align: start !important;
}

html body #dc-root#dc-root .zone-app aside.zone-sidebar [data-zplayercard="1"] > .zone-panel-heading[data-zwc-info-label]::after,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation .zone-nav-group * {
  color: var(--zaaa-title-ink) !important;
}

/* Operative Dossier Crest (#zone-operative-crest) */
html body aside.zone-sidebar .zone-profile-body,
html body #dc-root#dc-root .zone-app aside.zone-sidebar .zone-profile-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  padding: 6px 8px !important;
  background: transparent !important;
  color: var(--zaaa-text-1) !important;
}

html body aside.zone-sidebar #zone-operative-crest,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-operative-crest {
  order: -10 !important;
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 6px 8px !important;
  margin-block: 0 4px !important;
  margin-inline: 0 !important;
  background-color: var(--zaaa-bg-elevated) !important;
  border: 1.4px solid var(--zaaa-border-strong) !important;
  border-radius: var(--zaaa-radius-sm) !important;
  box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
  color: var(--zaaa-text-1) !important;
  cursor: pointer !important;
}

.zaaa-op-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  background-color: var(--zaaa-btn-bg);
  border: 1.4px solid var(--zaaa-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zaaa-text-1);
}

.zaaa-op-lvl {
  position: absolute;
  inset-block-end: -5px;
  inset-inline-end: -5px;
  padding-inline: 4px;
  padding-block: 0;
  border-radius: 4px;
  background-color: var(--zaaa-btn-bg);
  border: 1.2px solid var(--zaaa-border-strong);
  color: var(--zaaa-title-ink) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1.3;
  direction: ltr;
  unicode-bidi: isolate;
}

.zaaa-op-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zaaa-op-top,
.zaaa-op-xp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.zaaa-op-rank {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--zaaa-title-ink) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zaaa-op-id,
.zaaa-op-xp-val {
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 12px !important;
  color: var(--zaaa-text-2) !important;
  font-variant-numeric: tabular-nums;
}

.zaaa-op-xp-lbl {
  font-size: 12px !important;
  color: var(--zaaa-text-3) !important;
}

.zaaa-op-xp-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background-color: var(--zwc-track-bg, rgba(128, 120, 105, 0.22));
  border: 1px solid var(--zaaa-border-subtle);
  overflow: hidden;
}

.zaaa-op-xp-fill {
  height: 100%;
  width: var(--zaaa-xp-pct, 42%);
  background-color: var(--zaaa-accent);
  border-radius: 999px;
}

/* Sidebar Vitals Timers - Prevent "FULL" Overlap */
aside.zone-sidebar .zone-resource .zone-resource-timer:not([data-zaaa-timer="countdown"]) {
  display: none !important;
}

aside.zone-sidebar .zone-resource .zone-resource-timer[data-zaaa-timer="countdown"] {
  font-size: 12px !important;
  color: var(--zaaa-text-2) !important;
  direction: ltr !important;
  unicode-bidi: isolate !important;
}

/* Sidebar District Navigation Rows (#zone-area-navigation) */
html body aside.zone-sidebar #zone-area-navigation,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

html body aside.zone-sidebar #zone-area-navigation button[data-zone-screen],
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation[data-znav] button[data-zone-screen] {
  width: 100% !important;
  min-height: 34px !important;
  padding-block: 4px !important;
  padding-inline: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-block-end: 1px solid var(--zaaa-border-subtle) !important;
  border-inline-start: 3px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--zaaa-text-1) !important;
  font-family: var(--zaaa-font-ui) !important;
  font-size: 15.5px !important;
  font-weight: 600 !important;
  text-align: start !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

html body aside.zone-sidebar #zone-area-navigation button[data-zone-screen]:hover,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation[data-znav] button[data-zone-screen]:hover {
  background-color: var(--zaaa-bg-hover) !important;
}

html body aside.zone-sidebar #zone-area-navigation button[data-zone-screen][aria-current="page"],
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation[data-znav] button[data-zone-screen][aria-current="page"] {
  background-color: var(--zaaa-bg-elevated) !important;
  background-image: var(--zaaa-bg-active) !important;
  border-inline-start: 3.5px solid var(--zaaa-accent) !important;
  color: var(--zaaa-title-ink) !important;
  font-weight: 700 !important;
}

/* Open, Transparent Hand-Inked Icon Slot (Never overwrites watercolor-sketchbook.js) */
html body aside.zone-sidebar #zone-area-navigation button[data-zone-screen] .zone-nav-icon,
html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation button[data-zone-screen] .zone-nav-icon {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--zaaa-text-1) !important;
  font-size: 0 !important;
}

/* Hide legacy ASCII glyph inside .zone-nav-icon once an SVG icon is present */
aside.zone-sidebar #zone-area-navigation button[data-zone-screen] .zone-nav-icon:has(svg) > :not(svg) {
  display: none !important;
}

/* Hide mobile bottom tabbar on desktop (>= 901px) */
@media (min-width: 901px) {
  html body nav.zone-mobile-tabbar,
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] {
    display: none !important;
  }
}

/* ==========================================================================
 * 7. NATIVE-FEEL MOBILE APP SHELL (<= 900px: 320px, 360px, 390px, 412px, 430px)
 *    - Single Compact Sticky Top App Bar (>=44x44px touch targets, 0 overflow)
 *    - Full-Width Game Viewport (100% width + bottom safe-area clearance)
 *    - Logical RTL/LTR Slide-Over Sketchbook Drawer + Scrim
 *    - 5-Tab Thumb-Zone Sketchbook Bottom Tab Bar (Home, City, Crimes, Gym, Menu)
 * ========================================================================== */
/* Suppress fake initial boot hydration reward chips before gameplay hydration settles */
html:not([data-zaaa-hydrated="1"]) body .zig-float-pop,
html:not([data-zaaa-hydrated="1"]) body #zone-fx-layer .zfx-delta-chip {
  display: none !important;
}

@media (max-width: 900px) {
  /* Prevent horizontal bleed on any mobile viewport */
  html,
  html body,
  html body #dc-root,
  html body .zone-app {
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  /* Strip ALL ancestor transform/animation/filter/contain fixed-positioning traps on mobile
     (defeats #zone-main 350ms `zin` & 180ms `zfxScreenReveal` so nav.zone-mobile-tabbar stays viewport-fixed!) */
  html,
  html body,
  html body #dc-root,
  html body #dc-root#dc-root,
  html body #dc-root#dc-root .sc-host,
  html body #dc-root#dc-root .zone-app,
  html body #dc-root#dc-root [data-zshell],
  html body #zone-main#zone-main,
  html body #dc-root#dc-root #zone-main#zone-main,
  html body #dc-root#dc-root #zone-main#zone-main.zfx-screen-entering {
    transform: none !important;
    translate: none !important;
    scale: none !important;
    rotate: none !important;
    animation: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    perspective: none !important;
    contain: none !important;
    will-change: auto !important;
  }

  /* Re-anchor .zig-float-pop under mobile HUD (since #zone-cash is in closed offscreen drawer) */
  html body .zig-float-pop {
    left: 50% !important;
    right: auto !important;
    top: calc(58px + env(safe-area-inset-top, 0px)) !important;
    transform: translate(-50%, 0) !important;
    max-width: calc(100vw - 24px) !important;
    z-index: 1200 !important;
  }

  html body #zone-fx-layer .zfx-delta-chip {
    max-width: calc(100vw - 24px) !important;
  }

  /* 7A. Compact Sticky Mobile Top App Bar */
  html body .zone-app .zone-topbar,
  html body #dc-root#dc-root .zone-app .zone-topbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html body .zone-topbar [data-zheaderbar],
  html body #dc-root#dc-root .zone-app .zone-topbar [data-zheaderbar="1"] {
    min-height: 52px !important;
    padding-block-start: max(4px, env(safe-area-inset-top, 0px)) !important;
    padding-block-end: 4px !important;
    padding-inline: 6px !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  /* Hide redundant desktop-only topbar chrome on mobile */
  html body .zone-topbar .zone-header-links,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-links,
  html body .zone-topbar .zone-bulletin,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-bulletin,
  html body .zone-topbar .zone-header-actions > span:first-child,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > span:first-child,
  html body .zone-topbar .zone-header-actions > a,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > a,
  html body .zone-topbar .zone-nav-toggle,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-nav-toggle {
    display: none !important;
  }

  /* Docked Drawer Menu Trigger (#zaaa-mobile-rail-toggle) inside Top App Bar */
  html body .zone-topbar #zaaa-mobile-rail-toggle,
  html body #dc-root#dc-root .zone-app .zone-topbar #zaaa-mobile-rail-toggle#zaaa-mobile-rail-toggle {
    order: 0 !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--zaaa-btn-bg) !important;
    background-image: none !important;
    border: 1.5px solid var(--zaaa-border-strong) !important;
    border-radius: var(--zaaa-radius-sm) !important;
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
    color: var(--zaaa-text-1) !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
  }

  html body .zone-topbar #zaaa-mobile-rail-toggle[aria-expanded="true"],
  html body #dc-root#dc-root .zone-app .zone-topbar #zaaa-mobile-rail-toggle#zaaa-mobile-rail-toggle[aria-expanded="true"] {
    background-color: var(--zaaa-bg-elevated) !important;
    background-image: var(--zaaa-bg-active) !important;
  }

  #zaaa-mobile-rail-toggle .zaaa-rail-toggle-ico {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #zaaa-mobile-rail-toggle .zaaa-rail-toggle-lbl {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  html:not(.zaaa-rail-open) #zaaa-mobile-rail-toggle .zaaa-ico-close {
    display: none !important;
  }

  html.zaaa-rail-open #zaaa-mobile-rail-toggle .zaaa-ico-burger {
    display: none !important;
  }

  /* Compact Mobile Brand Plaque (>= 44x44px touch target) */
  html body .zone-topbar .zone-brand,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand {
    order: 1 !important;
    min-width: 46px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding-block: 0 !important;
    padding-inline: 6px !important;
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
  }

  html body .zone-topbar .zone-brand > span[data-zfig="1"],
  html body .zone-topbar .zone-brand > span:first-of-type,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand > span[data-zfig="1"],
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-brand > span:first-of-type {
    font-size: 17px !important;
    letter-spacing: 0.04em !important;
  }

  /* Compact Essential Live Stats Capsule (Cash / Energy / Nerve, each >=44x44px) */
  html body .zone-topbar #zone-topbar-hud,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(44px, 1fr)) !important;
    gap: 3px !important;
    min-height: 44px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill.zaaa-hud-life,
  html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill.zaaa-hud-life,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city {
    display: none !important;
  }

  @media (min-width: 721px) and (max-width: 900px) {
    html body .zone-topbar #zone-topbar-hud,
    html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud {
      grid-template-columns: repeat(4, minmax(44px, 1fr)) !important;
    }

    html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city,
    html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city {
      display: inline-flex !important;
    }

    html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city .zaaa-hud-city-code,
    html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill.zaaa-hud-city .zaaa-hud-city-code {
      display: none !important;
    }
  }

  html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill {
    min-width: 44px !important;
    width: 100% !important;
    min-height: 44px !important;
    height: 44px !important;
    padding-block: 2px 4px !important;
    padding-inline: 2px !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    background-color: var(--zaaa-bg-elevated) !important;
    border: 1.4px solid var(--zaaa-border-strong) !important;
    border-radius: 6px !important;
    box-shadow: 1px 1.5px 0 var(--zaaa-shadow-solid) !important;
    overflow: hidden !important;
  }

  html body .zone-topbar #zone-topbar-hud .zaaa-hud-pill .zaaa-hud-ico,
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud .zaaa-hud-pill .zaaa-hud-ico {
    width: 13px !important;
    height: 13px !important;
    flex: 0 0 13px !important;
  }

  html body .zone-topbar #zone-topbar-hud :is(bdi, span),
  html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud :is(bdi, span) {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Mobile Topbar Theme & Language Toggles (>= 44x44px touch targets) */
  html body .zone-topbar .zone-header-actions,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions {
    order: 3 !important;
    gap: 4px !important;
    margin-inline-start: 0 !important;
  }

  html body .zone-topbar .zone-header-actions > button,
  html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding-block: 0 !important;
    padding-inline: 6px !important;
    font-size: 12.5px !important;
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
  }

  /* On phone widths <= 600px, make Theme toggle a crisp 44x44px icon button */
  @media (max-width: 600px) {
    html body .zone-topbar .zone-header-actions > button:first-of-type,
    html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button:first-of-type {
      width: 44px !important;
      padding-inline: 0 !important;
      font-size: 0 !important;
      gap: 0 !important;
    }

    html body .zone-topbar .zone-header-actions > button:first-of-type .zone-theme-indicator,
    html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button:first-of-type .zone-theme-indicator {
      width: 20px !important;
      height: 20px !important;
      flex: 0 0 20px !important;
    }

    html body .zone-topbar .zone-header-actions > button:first-of-type .zaaa-theme-svg,
    html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions > button:first-of-type .zaaa-theme-svg {
      width: 20px !important;
      height: 20px !important;
    }
  }

  /* Ultra-narrow <= 355px (e.g. 320px iPhone SE): clean 2-row wrap, zero overflow */
  @media (max-width: 355px) {
    html body .zone-topbar [data-zheaderbar],
    html body #dc-root#dc-root .zone-app .zone-topbar [data-zheaderbar="1"] {
      flex-wrap: wrap !important;
    }

    html body .zone-topbar .zone-header-actions,
    html body #dc-root#dc-root .zone-app .zone-topbar .zone-header-actions {
      margin-inline-start: auto !important;
    }

    html body .zone-topbar #zone-topbar-hud,
    html body #dc-root#dc-root .zone-app .zone-topbar #zone-topbar-hud#zone-topbar-hud {
      order: 5 !important;
      flex: 1 0 100% !important;
      width: 100% !important;
    }
  }

  /* 7B. Full-Width Mobile Game Shell & Safe-Area Bottom Clearance */
  html body [data-zshell],
  html body #dc-root#dc-root .zone-app [data-zshell="1"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-block-start: 8px !important;
    padding-block-end: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    padding-inline: 10px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  html body #zone-main,
  html body #dc-root#dc-root .zone-app #zone-main#zone-main {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-block-end: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }

  /* 7C. Logical RTL/LTR Slide-Over Sketchbook Navigation Drawer + Scrim */
  @keyframes zaaaDrawerEnter {
    from {
      transform: translate3d(var(--zaaa-drawer-from, -100%), 0, 0);
    }
    to {
      transform: translate3d(0, 0, 0);
    }
  }

  /* Closed state: display:none guarantees ZERO off-screen overflow in LTR & RTL */
  html:not(.zaaa-rail-open) body aside.zone-sidebar,
  html:not(.zaaa-rail-open) body #dc-root#dc-root .zone-app aside.zone-sidebar {
    display: none !important;
  }

  /* Open state: crisp Sketchbook drawer anchored to logical inline-start */
  html.zaaa-rail-open body aside.zone-sidebar,
  html.zaaa-rail-open body #dc-root#dc-root .zone-app aside.zone-sidebar {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    inset-block-start: 0 !important;
    inset-block-end: 0 !important;
    inset-inline-start: 0 !important;
    inset-inline-end: auto !important;
    width: min(306px, 86vw) !important;
    min-width: min(306px, 86vw) !important;
    max-width: 86vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 985 !important;
    margin: 0 !important;
    padding-block-start: max(10px, env(safe-area-inset-top, 0px)) !important;
    padding-block-end: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    padding-inline: 10px !important;
    gap: 8px !important;
    background-color: var(--zaaa-bg-sidebar) !important;
    border: 0 !important;
    border-inline-end: 2.5px solid var(--zaaa-border-strong) !important;
    border-radius: 0 !important;
    box-shadow: var(--zaaa-shadow-card) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    animation: zaaaDrawerEnter 0.2s cubic-bezier(0.22, 1, 0.36, 1) both !important;
    box-sizing: border-box !important;
  }

  html.zaaa-rail-open #zaaa-drawer-backdrop {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 980 !important;
    background-color: var(--zaaa-scrim) !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
  }

  /* Mobile Drawer Top Bar (Title + Account/Admin Quick Actions + 44x44 Close) */
  html.zaaa-rail-open body aside.zone-sidebar #zaaa-drawer-header,
  html.zaaa-rail-open body #dc-root#dc-root .zone-app aside.zone-sidebar #zaaa-drawer-header {
    order: -30 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding-block-end: 8px !important;
    border-block-end: 1.5px solid var(--zaaa-border-strong) !important;
  }

  .zaaa-drawer-toprow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .zaaa-drawer-title {
    font-family: var(--zaaa-font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--zaaa-title-ink);
  }

  .zaaa-drawer-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--zaaa-btn-bg);
    border: 1.5px solid var(--zaaa-border-strong);
    border-radius: var(--zaaa-radius-sm);
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid);
    color: var(--zaaa-text-1);
    cursor: pointer;
    touch-action: manipulation;
  }

  .zaaa-drawer-close svg {
    width: 18px;
    height: 18px;
  }

  .zaaa-drawer-quicklinks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .zaaa-drawer-qlink {
    min-height: 44px;
    padding-block: 6px;
    padding-inline: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--zaaa-btn-bg);
    border: 1.5px solid var(--zaaa-border-strong);
    border-radius: var(--zaaa-radius-sm);
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid);
    color: var(--zaaa-text-1) !important;
    font-family: var(--zaaa-font-ui);
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none !important;
    touch-action: manipulation;
  }

  .zaaa-drawer-qlink svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
  }

  /* Ensure #zone-area-navigation and all 19/20 district rows are visible & >=44px tall */
  html.zaaa-rail-open body aside.zone-sidebar #zone-area-navigation,
  html.zaaa-rail-open body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation[data-znav] {
    display: flex !important;
    flex-direction: column !important;
  }

  html body aside.zone-sidebar #zone-area-navigation button[data-zone-screen],
  html body #dc-root#dc-root .zone-app aside.zone-sidebar #zone-area-navigation[data-znav] button[data-zone-screen] {
    min-height: 44px !important;
    padding-block: 7px !important;
    padding-inline: 10px !important;
    font-size: 16px !important;
  }

  /* 7D. 5-Tab Thumb-Zone Sketchbook Bottom Tab Bar (.zone-mobile-tabbar) */
  html body nav.zone-mobile-tabbar,
  html body #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"],
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    inset-inline-start: 0 !important;
    inset-inline-end: 0 !important;
    inset-block-end: 0 !important;
    inset-block-start: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    transform: none !important;
    z-index: 960 !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 4px !important;
    min-height: 56px !important;
    padding-block-start: 4px !important;
    padding-block-end: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    padding-inline: max(6px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-right, 0px)) !important;
    margin: 0 !important;
    background-color: var(--zaaa-bg-topbar) !important;
    background-image: var(--zwc-pencil-shade, none) !important;
    border: 0 !important;
    border-block-start: 2px solid var(--zaaa-border-strong) !important;
    border-radius: 0 !important;
    box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.12) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-sizing: border-box !important;
  }

  /* Hide 6th "attack" tab via CSS only so React's <sc-for> fiber stays 100% intact */
  html body nav.zone-mobile-tabbar button[data-zaaa-mob="attack"],
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] button[data-zaaa-mob="attack"] {
    display: none !important;
  }

  html body nav.zone-mobile-tabbar > button,
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button {
    position: relative !important;
    min-width: 44px !important;
    min-height: 46px !important;
    padding-block: 3px !important;
    padding-inline: 2px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 1.5px solid transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    color: var(--zaaa-text-2) !important;
    font-family: var(--zaaa-font-ui) !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Hide raw Unicode symbol span once hand-inked .zaaa-mob-ico is mounted */
  html body nav.zone-mobile-tabbar > button:has(.zaaa-mob-ico) > span:first-child:not(.zaaa-mob-ico),
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button:has(.zaaa-mob-ico) > span:first-child:not(.zaaa-mob-ico) {
    display: none !important;
  }

  html body nav.zone-mobile-tabbar > button .zaaa-mob-ico,
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button .zaaa-mob-ico {
    order: -1 !important;
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: currentColor !important;
  }

  html body nav.zone-mobile-tabbar > button > span:nth-of-type(2),
  html body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button > span:nth-of-type(2) {
    font-family: var(--zaaa-font-ui) !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    color: currentColor !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Active Sketchbook Ink-Pill Indicator on Current Tab or Open Menu Drawer */
  html:not(.zaaa-rail-open) body nav.zone-mobile-tabbar > button[aria-current="page"],
  html:not(.zaaa-rail-open) body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button[aria-current="page"],
  html.zaaa-rail-open body nav.zone-mobile-tabbar > button[data-zaaa-mob="menu"],
  html.zaaa-rail-open body #dc-root#dc-root #zone-main#zone-main nav.zone-mobile-tabbar[data-zone-mobile-tabbar="1"] > button[data-zaaa-mob="menu"] {
    background-color: var(--zaaa-bg-elevated) !important;
    background-image: var(--zaaa-bg-active) !important;
    border-color: var(--zaaa-border-strong) !important;
    box-shadow: 1.5px 1.5px 0 var(--zaaa-shadow-solid) !important;
    color: var(--zaaa-title-ink) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
