/* =============================================
   MEHR PROOF-OF-WORK (POW) DESIGN SYSTEM
   Zero Hardcoded Pixels · Zero External CDNs
   ============================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, Vazirmatn, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, Monaco, monospace;

  /* Spacing Scale (Adaptive Rem) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.84rem;
  --text-base: 0.95rem;
  --text-md: 1.05rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.85rem;
  --text-3xl: 2.25rem;

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-full: 62.4375rem;

  /* Transitions */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

/* =============================================
   THEME PALETTES
   ============================================= */

/* Dark Theme (Default) */
[data-theme="dark"] {
  --bg-primary: #0c0f12;
  --bg-secondary: #12161c;
  --bg-tertiary: #181e26;
  --card-bg: #141920;
  --card-hover: #19202a;
  --border: #222b38;
  --border-strong: #2e3b4d;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-dim: #64748b;

  --accent: #ff8a2a;
  --accent-hover: #ff9a3d;
  --accent-ink: #0c0f12;
  --accent-subtle: rgba(255, 138, 42, 0.12);
  --accent-glow: rgba(255, 138, 42, 0.25);
  --accent-rgb: 255, 138, 42;

  --success: #22c55e;
  --success-subtle: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.15);
  --info: #38bdf8;
  --info-subtle: rgba(56, 189, 248, 0.15);

  --code-bg: #0d1117;
  --code-border: #1e2733;
  --nav-bg: rgba(12, 15, 18, 0.88);
  --badge-bg: #161c24;
  --input-bg: #090c0f;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --card-bg: #ffffff;
  --card-hover: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-dim: #64748b;

  --accent: #ea580c;
  --accent-hover: #f97316;
  --accent-ink: #ffffff;
  --accent-subtle: rgba(234, 88, 12, 0.1);
  --accent-glow: rgba(234, 88, 12, 0.2);
  --accent-rgb: 234, 88, 12;

  --success: #16a34a;
  --success-subtle: rgba(22, 163, 74, 0.12);
  --error: #dc2626;
  --error-subtle: rgba(220, 38, 38, 0.12);
  --info: #0284c7;
  --info-subtle: rgba(2, 132, 199, 0.12);

  --code-bg: #f8fafc;
  --code-border: #e2e8f0;
  --nav-bg: rgba(248, 250, 252, 0.88);
  --badge-bg: #f1f5f9;
  --input-bg: #ffffff;
}

/* OLED / Pure Black Theme */
[data-theme="black"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #141414;
  --card-bg: #0d0d0d;
  --card-hover: #141414;
  --border: #1f1f1f;
  --border-strong: #2e2e2e;
  
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-dim: #71717a;

  --accent: #ff8a2a;
  --accent-hover: #ff9a3d;
  --accent-ink: #000000;
  --accent-subtle: rgba(255, 138, 42, 0.15);
  --accent-glow: rgba(255, 138, 42, 0.3);
  --accent-rgb: 255, 138, 42;

  --success: #22c55e;
  --success-subtle: rgba(34, 197, 94, 0.18);
  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.18);
  --info: #38bdf8;
  --info-subtle: rgba(56, 189, 248, 0.18);

  --code-bg: #000000;
  --code-border: #1f1f1f;
  --nav-bg: rgba(0, 0, 0, 0.92);
  --badge-bg: #121212;
  --input-bg: #000000;
}

/* =============================================
   RESET & BASE STYLES
   ============================================= */

@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] {
  font-family: 'Vazirmatn', var(--font-sans);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* =============================================
   HEADER & NAVIGATION
   ============================================= */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(0.75rem);
  -webkit-backdrop-filter: blur(0.75rem);
  border-bottom: 0.0625rem solid var(--border);
  height: 3.5rem;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800;
  font-size: var(--text-md);
  letter-spacing: -0.01em;
}

.brand-cube {
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.brand-sub {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pref-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 0.0625rem solid var(--border);
  background: var(--card-bg);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}

.pref-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: 14rem;
  background: var(--card-bg);
  border: 0.0625rem solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 60;
}

[dir="rtl"] .dropdown-menu {
  right: auto;
  left: 0;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.35rem 0.5rem;
  letter-spacing: 0.05em;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
}

[dir="rtl"] .dropdown-item {
  text-align: right;
}

.dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.dropdown-item.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* =============================================
   PAGE VIEWS (SPA ROUTING)
   ============================================= */

main {
  flex: 1;
}

.page-view {
  display: none;
  padding: var(--space-5) 0 var(--space-10) 0;
}

.page-view.active {
  display: block;
}

.hero-header {
  text-align: center;
  max-width: 48rem;
  margin: 0 auto var(--space-6) auto;
}

.hero-title-compact {
  font-size: var(--text-2xl);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: var(--text-base);
  color: var(--text-dim);
  margin-top: var(--space-2);
  line-height: 1.5;
}

/* Badges row */
.spec-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-3);
  justify-content: center;
}

.spec-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 0.0625rem solid var(--border);
  color: var(--text-secondary);
}

.spec-badge-pill.accent {
  background: var(--accent-subtle);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
}

/* =============================================
   MEHR POW WIDGET & GATE SYSTEM
   ============================================= */

.pow-demo-card {
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 0.5rem 1.75rem rgba(0, 0, 0, 0.2);
}

.pow-demo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  min-width: 0;
}

.pow-demo-grid > * {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 48rem) {
  .pow-demo-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
}

/* PoW Controller Panel & Mode Switcher */
.pow-controller-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* Execution Strategy Mode Switcher */
.pow-mode-switch-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  background: var(--bg-secondary);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.mode-switch-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-switch-tabs {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.2rem;
  gap: 0.2rem;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-dim);
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.mode-tab:hover {
  color: var(--text-primary);
}

.mode-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0.125rem 0.5rem var(--accent-glow);
}

.diff-slider-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--bg-secondary);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}

.diff-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.diff-time-est {
  font-size: var(--text-xs);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.diff-slider-range-box {
  width: 100%;
}

.diff-slider-input {
  width: 100%;
  height: 0.5rem;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent);
}

.diff-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  border: 0.125rem solid var(--bg-primary);
  box-shadow: 0 0 0.5rem var(--accent-glow);
  cursor: pointer;
  transition: transform var(--duration-fast);
}

.diff-slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.diff-slider-input::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  border: 0.125rem solid var(--bg-primary);
  box-shadow: 0 0 0.5rem var(--accent-glow);
  cursor: pointer;
  transition: transform var(--duration-fast);
}

/* Titled Bars under the slider */
.diff-titled-bars {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.diff-bar-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  color: var(--text-dim);
  min-width: 0;
}

.diff-bar-segment:hover {
  border-color: var(--accent-subtle);
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.diff-bar-segment.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-primary);
  box-shadow: 0 0 0.5rem var(--accent-subtle);
}

.diff-bar-tick {
  width: 0.75rem;
  height: 0.25rem;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: all var(--duration-fast);
}

.diff-bar-segment.active .diff-bar-tick {
  background: var(--accent);
  width: 1.25rem;
}

.diff-bar-bits {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

.diff-bar-title {
  font-size: 0.65rem;
  line-height: 1.25;
  color: var(--text-dim);
  font-weight: 500;
  word-break: break-word;
}

.diff-bar-segment.active .diff-bar-title {
  color: var(--text-primary);
  font-weight: 600;
}

@media (max-width: 36rem) {
  .diff-titled-bars {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .diff-bar-segment {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
  }
}

/* Docked PoW Gate Component */
.pow-gate {
  background: var(--code-bg);
  border: 0.0625rem solid var(--code-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: all var(--duration-normal);
  min-width: 0;
}

.pow-gate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  gap: var(--space-2);
}

.pow-gate-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pow-gate-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pow-cancel-btn {
  display: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 0.0625rem solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.pow-cancel-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.pow-gate.state-solving .pow-cancel-btn,
.pow-gate.state-catchup .pow-cancel-btn {
  display: inline-flex;
}

.pow-gate-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* SVG Precision Thin Rounded Rectangle Progress Bar */
.pow-bar-track {
  width: 100%;
  height: 0.3rem;
  background: var(--bg-tertiary);
  border-radius: 0.1rem;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.25);
}

.pow-bar-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  border-radius: 0.1rem;
}

.pow-bar-bg {
  fill: transparent;
  rx: 2;
  ry: 2;
}

.pow-bar-fill {
  fill: #ff8a2a;
  fill: url(#powGrad);
  rx: 2;
  ry: 2;
  transition: width 150ms ease-out;
}

.pow-gate.state-ready .pow-bar-fill {
  fill: var(--success);
  transition: width 200ms ease-out, fill 250ms ease-out;
}

/* Primary Action Controls */
.pow-action-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.pow-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  box-shadow: 0 0.125rem 0.625rem var(--accent-glow);
  cursor: pointer;
}

.pow-submit-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-0.0625rem);
}

.pow-submit-btn:active {
  transform: translateY(0);
}

.pow-submit-btn.ready {
  background: var(--success);
  color: #ffffff;
}

.pow-submit-btn.catchup {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 0.0625rem solid var(--accent);
}

/* Telemetry Box & Proof Decomposition - Overflow Proof */
.telemetry-card {
  background: var(--bg-secondary);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: var(--space-2);
}

.telemetry-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  min-width: 0;
}

.stat-item {
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-width: 0;
  overflow: hidden;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-val.success { color: var(--success); }
.stat-val.info { color: var(--info); }

.token-inspect-box {
  background: var(--code-bg);
  border: 0.0625rem solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

/* =============================================
   SPECIFICATION SECTION
   ============================================= */

.spec-grid-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 42.5rem) {
  .spec-grid-compact {
    grid-template-columns: 1fr 1fr;
  }
}

.spec-card {
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.spec-card.full-width {
  grid-column: 1 / -1;
}

.spec-card h3 {
  font-size: var(--text-md);
  font-weight: 800;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
}

.spec-card p, .spec-card li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.spec-card ul {
  margin-left: 1.25rem;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.code-box-mini {
  background: var(--code-bg);
  border: 0.0625rem solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  overflow-x: auto;
}

.spec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  gap: var(--space-2);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  border: 0.0625rem solid rgba(var(--accent-rgb), 0.25);
  letter-spacing: 0.02em;
}

/* =============================================
   TABLES & DIAGRAMS
   ============================================= */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: var(--space-3);
  border-radius: var(--radius-md);
  border: 0.0625rem solid var(--border);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  text-align: left;
  min-width: 37.5rem;
}

[dir="rtl"] .spec-table {
  text-align: right;
}

.spec-table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  border-bottom: 0.0625rem solid var(--border);
  white-space: nowrap;
}

.spec-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 0.0625rem solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.spec-table tr:last-child td {
  border-bottom: none;
}

.spec-table tr.highlight-row {
  background: var(--accent-subtle);
}

.spec-table tr.highlight-row td {
  color: var(--text-primary);
  font-weight: 600;
}

.spec-table tr.highlight-row td:first-child {
  color: var(--accent);
  font-weight: 700;
}

.pill-sm {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

.pill-sm.yes {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 0.0625rem solid rgba(34, 197, 94, 0.3);
}

.pill-sm.no {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 0.0625rem solid rgba(239, 68, 68, 0.25);
}

.pill-sm.neutral {
  background: var(--bg-tertiary);
  color: var(--text-dim);
  border: 0.0625rem solid var(--border);
}

/* =============================================
   CODE PANELS (TABS & SYNTAX HIGHLIGHTING)
   ============================================= */

.lang-bar-compact {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  margin-bottom: var(--space-3);
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.lang-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--duration-fast);
}

.lang-btn-sm.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.code-panel-sm {
  display: none;
  background: var(--code-bg);
  border: 0.0625rem solid var(--code-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-panel-sm.active {
  display: block;
}

.code-head-sm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: var(--bg-secondary);
  border-bottom: 0.0625rem solid var(--border);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: all var(--duration-fast);
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.copy-btn .icon-check { display: none; }
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: inline-block; color: var(--success); }

.code-pre-sm {
  margin: 0;
  padding: 0.8rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.55;
  color: #e2e8f0;
  max-height: 45rem;
}
[data-theme="light"] .code-pre-sm { color: #1e293b; }

.code-line {
  display: flex;
  padding: 0 0.8rem;
  min-height: 1.35rem;
}
.code-line:hover {
  background: rgba(255, 255, 255, 0.03);
}
[data-theme="light"] .code-line:hover {
  background: rgba(0, 0, 0, 0.03);
}

.line-num {
  width: 2.5rem;
  padding-right: 0.8rem;
  text-align: right;
  color: var(--text-dim);
  user-select: none;
  flex-shrink: 0;
  opacity: 0.5;
}

[dir="rtl"] .line-num {
  text-align: left;
  padding-right: 0;
  padding-left: 0.8rem;
}

.line-content {
  flex: 1;
  white-space: pre;
}

.tok-keyword { color: #f472b6; font-weight: 600; }
.tok-type { color: #38bdf8; }
.tok-string { color: #4ade80; }
.tok-number { color: #fbbf24; }
.tok-comment { color: #64748b; font-style: italic; }

[data-theme="light"] .tok-keyword { color: #db2777; }
[data-theme="light"] .tok-type { color: #0284c7; }
[data-theme="light"] .tok-string { color: #16a34a; }
[data-theme="light"] .tok-number { color: #d97706; }
[data-theme="light"] .tok-comment { color: #94a3b8; }

/* =============================================
   WIDGETS SHOWCASE SECTION
   ============================================= */

.widget-showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (min-width: 45rem) {
  .widget-showcase-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.widget-card {
  background: var(--card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.widget-preview-box {
  background: var(--bg-primary);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* =============================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================= */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.75rem;
  background: var(--nav-bg);
  backdrop-filter: blur(0.625rem);
  -webkit-backdrop-filter: blur(0.625rem);
  border-top: 0.0625rem solid var(--border);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.5rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  cursor: pointer;
  flex: 1;
  max-width: 5.5rem;
}

.bottom-nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.bottom-nav-link.active {
  color: var(--accent);
}

@media (max-width: 42.5rem) {
  .nav-center {
    display: none;
  }
  .bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: 4.5rem;
  }
  .toast-notice {
    bottom: 4.5rem;
  }
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */

.toast-notice {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(5rem);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease-spring);
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =============================================
   UTILITY CLASSES (ZERO INLINE STYLES)
   ============================================= */

.svg-sprite {
  display: none;
}

.icon-sm { width: 0.9rem; height: 0.9rem; }
.icon-base { width: 1rem; height: 1rem; }
.icon-accent { color: var(--accent); }
.icon-success { color: var(--success); }
.icon-info { color: var(--info); }
.lang-icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.nav-item-icon { width: 1rem; height: 1rem; flex-shrink: 0; }

html[lang="en"] [data-lang="fa"] {
  display: none !important;
}

html[lang="fa"] [data-lang="en"] {
  display: none !important;
}
