/* ==========================================================================
   Pi 300M — Unified Design System & Motion System
   Philosophy: Architectural, restrained, tactile, mathematically pure.
   Aesthetics: Deep Obsidian Slate, Warm Amber Gold, Crisp Typography.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg: #090b10;
  --bg-gradient: radial-gradient(circle at 50% -15%, rgba(245, 158, 11, 0.09), transparent 50%),
                 radial-gradient(circle at 85% 25%, rgba(99, 102, 241, 0.04), transparent 40%);
  --surface: #12151e;
  --surface-hover: #181c28;
  --surface-active: #1e2333;
  --surface-glass: rgba(18, 21, 30, 0.88);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-hover: rgba(245, 158, 11, 0.35);
  --border-focus: #f59e0b;
  
  --ink: #f8fafc;
  --ink-secondary: #94a3b8;
  --ink-tertiary: #64748b;
  
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);
  
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.75), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Motion Tokens */
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 450ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --transition: all var(--duration-fast) var(--ease-smooth-out);

  --site-font: 'Vazirmatn', 'Arad', system-ui, -apple-system, sans-serif;
}

/* Local Font-Faces */
@font-face {
  font-family: 'Arad';
  src: url('/fonts/arad/AradVF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'AradNL';
  src: url('/fonts/arad/AradNLVF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'AradFD';
  src: url('/fonts/arad/AradFDVF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Estedad';
  src: url('/fonts/alt/EstedadVF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/alt/SpaceGroteskVF.woff2') format('woff2'),
       url('/fonts/alt/SpaceGroteskVF.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/alt/IBMPlexMono-Regular.woff2') format('woff2'),
       url('/fonts/alt/IBMPlexMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2'),
       url('/fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 100 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2'),
       url('/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Font Cascading System */
:root {
  --site-font: 'Vazirmatn', 'Arad', system-ui, -apple-system, sans-serif;
}
html[data-font="vazir"], :root[data-font="vazir"] {
  --site-font: 'Vazirmatn', 'Arad', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
html[data-font="estedad"], :root[data-font="estedad"] {
  --site-font: 'Estedad', 'Vazirmatn', 'Arad', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
html[data-font="grotesk"], :root[data-font="grotesk"] {
  --site-font: 'Space Grotesk', 'Vazirmatn', 'Arad', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
html[data-font="plex"], :root[data-font="plex"] {
  --site-font: 'IBM Plex Mono', 'Vazirmatn', 'Arad', monospace;
}
html[data-font="arad"], :root[data-font="arad"] {
  --site-font: 'AradFD', 'Arad', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.35) transparent;
}

* { box-sizing: inherit; margin: 0; padding: 0; }

/* ==========================================================================
   Apple-Style Minimalist Liquid Glass Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  border: 1.5px solid transparent;
  background-clip: padding-box;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}
::-webkit-scrollbar-thumb:active {
  background: rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.7);
}

/* Apple-Style Laser Scroll Progress Bar */
.apple-scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #fef08a 100%);
  transform-origin: 0% 50%;
  transform: scaleX(0);
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.8), 0 0 4px rgba(251, 191, 36, 0.9);
  transition: transform 0.08s linear;
}
[dir="rtl"] .apple-scroll-progress-bar,
html[dir="rtl"] .apple-scroll-progress-bar {
  transform-origin: 100% 50%;
}

/* Apple-Style Floating Glass Back-to-Top Pill */
.apple-scroll-top-btn {
  position: fixed;
  bottom: 26px;
  inset-inline-start: 26px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(18, 21, 30, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55),
              inset 0 1px 2px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  transform: translateY(20px) scale(0.85);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              background 0.25s ease;
}
.apple-scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.apple-scroll-top-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
  color: var(--accent-light);
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7),
              0 0 24px rgba(245, 158, 11, 0.4),
              inset 0 1px 2px rgba(255, 255, 255, 0.6);
}
.apple-scroll-top-btn:active {
  transform: translateY(0) scale(0.94);
}

body {
  font-family: var(--site-font) !important;
  background-color: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  z-index: -1;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

/* Explicit inheritance for buttons, inputs, chips and all interactive UI */
button, input, select, textarea, .tz-chip, .bm-chip, .sec-btn, .quick-chip, .mode-tab, .chip {
  font-family: var(--site-font) !important;
}

/* Universal Button Architecture — Never Default Browser White */
button {
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

.primary, button.primary {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.9)) !important;
  color: #0c0e14 !important;
  font-weight: 700 !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 18px !important;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.65),
              inset 0 -1px 2px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  position: relative !important;
  overflow: hidden !important;
}
.primary:hover, button.primary:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5),
              inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}
.primary:active, button.primary:active {
  transform: translateY(0) scale(0.97) !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

/* Dynamic Specular Sheen for Liquid Glass buttons */
.primary::after, button.primary::after, .sec-btn::after, button.sec-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    70px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 255, 255, 0.45),
    rgba(255, 255, 255, 0.05) 50%,
    transparent 75%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.primary:hover::after, button.primary:hover::after, .sec-btn:hover::after, button.sec-btn:hover::after {
  opacity: 1;
}

.sec-btn, button.sec-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
  color: var(--ink) !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35),
              inset 0 1px 1px rgba(255, 255, 255, 0.25) !important;
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  position: relative !important;
  overflow: hidden !important;
}
.sec-btn:hover, button.sec-btn:hover {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: var(--accent) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.4) !important;
}
.sec-btn:active, button.sec-btn:active {
  transform: translateY(0) scale(0.97) !important;
}

/* Universal Liquid Glass Utility Class */
.liquid-glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(245, 158, 11, 0.15) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.5),
              inset 0 -1px 2px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  position: relative;
  overflow: hidden;
}
.liquid-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    140px circle at var(--gx, 50%) var(--gy, 30%),
    rgba(255, 255, 255, 0.28),
    rgba(255, 255, 255, 0.04) 50%,
    transparent 75%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.liquid-glass:hover::after {
  opacity: 1;
}

/* Universal Search Input Wrap & Live Digit Counter Badge */
.search-input-wrap,
.landing-input-inner {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
}

html[dir="rtl"] .searchbar input,
html[dir="rtl"] .explorer-search-input {
  padding-left: 95px !important;
}

html[dir="ltr"] .searchbar input,
:root:not([dir="rtl"]) .searchbar input,
html[dir="ltr"] .explorer-search-input,
:root:not([dir="rtl"]) .explorer-search-input {
  padding-right: 95px !important;
}

/* Liquid Glass Live Digit Counter Badge */
.q-digit-count {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, rgba(245, 158, 11, 0.24) 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35),
              0 0 16px rgba(245, 158, 11, 0.25),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.65),
              inset 0 -1px 2px rgba(245, 158, 11, 0.25);
  backdrop-filter: blur(10px) saturate(1.5);
  -webkit-backdrop-filter: blur(10px) saturate(1.5);
  color: var(--accent);
  z-index: 5;
  white-space: nowrap;
  animation: badgePop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  user-select: none;
}
html[dir="rtl"] .q-digit-count {
  left: 10px;
  right: auto;
  direction: rtl;
}
html[dir="ltr"] .q-digit-count,
:root:not([dir="rtl"]) .q-digit-count {
  right: 10px;
  left: auto;
  direction: ltr;
}
.q-digit-count.maxed {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.24) 0%, rgba(245, 158, 11, 0.2) 100%);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45);
}
@keyframes badgePop {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* Liquid Glass Cards & Modules Across Site */
.stats-card, .custom, .tz-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(18, 21, 30, 0.7) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  position: relative;
  overflow: hidden;
}

.stats-card::after, .custom::after, .tz-section::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    140px circle at var(--gx, 50%) var(--gy, 30%),
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.02) 50%,
    transparent 75%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.stats-card:hover::after, .custom:hover::after, .tz-section:hover::after {
  opacity: 1;
}

/* Liquid Glass Clock Digits */
.tdigit, .clock-digit-box {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.35),
              inset 0 -1px 2px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  position: relative;
  overflow: hidden;
}

.tdigit::after, .clock-digit-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    60px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0.05) 50%,
    transparent 75%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.tdigit:hover::after, .clock-digit-box:hover::after {
  opacity: 1;
}

.tdigit.sec, .clock-digit-box.sec {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  box-shadow: 0 10px 32px rgba(245, 158, 11, 0.25),
              inset 0 1px 2px rgba(255, 255, 255, 0.55),
              inset 0 -1px 2px rgba(245, 158, 11, 0.2) !important;
}

/* Liquid Glass Timezone Navigation Arrows */
.tz-nav-arrow {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
              inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tz-nav-arrow:hover {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.4) !important;
}

/* Button & Interactive Press Feedback */
button:active, .instrument-card:active, .chip:active, .tz-chip:active, .bm-chip:active {
  transform: scale(0.97) !important;
}

/* Clock Digits & Numerical Counters inherit the active site font with tabular numeric alignment */
.tdigit, .clock-digit-box, .stat-col-digit {
  font-family: var(--site-font) !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Monospace numerals where continuous raw Pi streams are displayed */
.found-line, .hero-digits {
  font-family: 'JetBrains Mono', 'Space Grotesk', monospace !important;
}

/* Sleek Dedicated UI Icons */
.ui-icon {
  display: inline-block;
  vertical-align: -0.15em;
  stroke: currentColor;
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-spring), color var(--duration-fast) ease;
}
.card-title .ui-icon {
  color: var(--accent);
  margin-inline-end: 6px;
  width: 20px;
  height: 20px;
}
.instrument-card:hover .card-title .ui-icon {
  transform: scale(1.12);
}
.mode-tab .ui-icon {
  margin-inline-end: 6px;
  vertical-align: -0.18em;
  width: 17px;
  height: 17px;
}
h1 .ui-icon {
  color: var(--accent);
  margin-inline-end: 8px;
  vertical-align: -0.15em;
  width: 24px;
  height: 24px;
}
.sec-btn .ui-icon, .quick-chip .ui-icon, .bm-chip .ui-icon {
  margin-inline-end: 6px;
  vertical-align: -0.16em;
}

/* Page Transitions */
main {
  animation: pageEnter var(--duration-medium) var(--ease-smooth-out) both;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.page-exit main {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--duration-quick) ease, transform var(--duration-quick) ease;
}

/* In-place Rise-up animation for search results */
@keyframes riseUp {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.rise-up {
  animation: riseUp var(--duration-fast) var(--ease-smooth-out) both;
}

/* Language Switch Smooth Cinematic Transition */
@keyframes langTransition {
  0% {
    opacity: 0.65;
    filter: blur(1.5px);
    transform: translateY(2px) scale(0.996);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}
.lang-anim main, .lang-anim .app-nav, .lang-anim .app-footer, .lang-anim .result-box {
  animation: langTransition 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Input error shake animation */
@keyframes shakeAnim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.shake {
  animation: shakeAnim 0.35s ease both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

/* Glowing Highlight Pulse */
mark {
  background: rgba(245, 158, 11, 0.35);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.7);
  border-radius: 4px;
  padding: 1px 5px;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.6);
  animation: markPulse 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes markPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  }
  50% {
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.95);
    transform: scale(1.03);
  }
}

/* Global Nav Header — Floating Liquid Glass Bar */
header.app-header {
  width: 100%;
  max-width: 1120px;
  margin: 12px auto 0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(18, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  position: relative;
  z-index: 50;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  transition: transform var(--duration-quick) var(--ease-smooth-out);
}
.brand-link:hover {
  transform: scale(1.02);
}
.brand-symbol {
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
nav.main-nav a {
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-full);
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}
nav.main-nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}
nav.main-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, rgba(245, 158, 11, 0.24) 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25),
              0 0 16px rgba(245, 158, 11, 0.2),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

/* Language Switcher */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lang-sw {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  overflow: hidden;
}
.lang-sw button {
  background: none;
  border: none;
  color: var(--ink-secondary);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.lang-sw button:hover { color: var(--ink); }
.lang-sw button.on {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ==========================================================================
   Font Picker Widget (Floating in Bottom-Right Corner)
   ========================================================================== */
.font-pick {
  position: fixed;
  bottom: 20px;
  inset-inline-end: 20px;
  z-index: 9999;
}
.font-pick .fp-toggle {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
}
.font-pick .fp-toggle:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
  transform: translateY(-2px);
}
.font-pick .fp-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  inset-inline-end: 0;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-width: 190px;
  animation: popUp var(--duration-fast) var(--ease-spring) both;
}
.font-pick.open .fp-menu {
  display: flex;
}
@keyframes popUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.font-pick .fp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.font-pick .fp-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-light);
}
.font-pick .fp-item.on {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.font-pick .fp-sample {
  font-size: 11px;
  color: var(--ink-tertiary);
}

/* Footer */
footer.app-footer {
  margin-top: auto;
  padding: 28px 20px 32px;
  border-top: 1px solid var(--border-subtle);
  color: var(--ink-tertiary);
  font-size: 13px;
  text-align: center;
}
footer.app-footer b { color: var(--accent); font-weight: 700; }

/* Toast */
.pi-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  opacity: 0;
  pointer-events: none;
  background: #141722;
  border: 1px solid var(--border-hover);
  color: var(--ink);
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  transition: var(--transition);
  z-index: 9999;
}
.pi-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 640px) {
  header.app-header { padding: 10px 14px; flex-wrap: wrap; }
  .brand-link { font-size: 0.95rem; }
  nav.main-nav { order: 3; width: 100%; justify-content: center; gap: 4px; padding-top: 8px; flex-wrap: wrap; }
  nav.main-nav a { padding: 5px 9px; font-size: 11.5px; }
  .font-pick { bottom: 14px; right: 14px; }
}
