/* assets/common.css – v5.6 – shared input bar + button perfection + warm dark mode */
/* Everything you already had stays exactly the same — only additions below */

:root {
  --bg: #ffffff;
  --text: #000000;
  --input-bg: #f9f9f9;
  --input-border: #ccc;
  --button-bg: #007bff;
  --button-text: white;
  --highlight-bg: #fff3cd;
  --nav-bg: #f8f9fa;
  --nav-border: #dee2e6;
  --footer: #666;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e0e0e0;
  --input-bg: #2a2a2a;
  --input-border: #5a5a5a;
  --button-bg: #3a3a3a;         /* ← warm button base */
  --button-text: #f0f0f0;
  --highlight-bg: #4d3c00;
  --nav-bg: #2d2d2d;
  --nav-border: #444;
  --footer: #888;
}

body {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Brahmi', 'Noto Sans Siddham', sans-serif;
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.8;
  font-size: 1.1rem;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}
.site-nav {
  position: sticky;
  top: 0;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  padding: 0.5rem 0;
  margin: 0 0 1.5rem 0;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.site-nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: border 0.2s;
}
.site-nav a:hover,
.site-nav a.active {
  border-bottom: 2px solid #007bff;
}
.site-nav a.disabled {
  color: #999;
  cursor: not-allowed;
  pointer-events: none;
}
#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 56px;
  height: 56px;
  padding: 0;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
#theme-toggle:hover {
  transform: scale(1.1);
}
#theme-toggle img {
  width: 40px;
  height: 40px;
  pointer-events: none;
}
#version-footer {
  text-align: center;
  margin-top: 4rem;
  font-size: 0.9rem;
  color: var(--footer);
  font-style: italic;
}
button {
  transition: background 0.2s, transform 0.1s;
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: #0056b3;
}
button:active:not(:disabled) {
  transform: scale(0.98);
}
.highlight {
  animation: pulse 4s ease-in-out;
}
@keyframes pulse {
  0%, 100% { background: var(--highlight-bg); }
  50% { background: #ffeb3b; }
}
/* Mobile: TIGHT & CLEAN */
@media (max-width: 600px) {
  body { padding: 0 1rem; }
  .site-nav ul {
    gap: 0.6rem;
    font-size: 0.85rem;
  }
  #theme-toggle { width: 50px; height: 50px; }
  #theme-toggle img { width: 36px; height: 36px; }
}
/* Desktop: slightly larger text */
@media (min-width: 768px) {
  body {
    font-size: 1.15rem;
  }
  .unicode-block,
  .disclaimer,
  .input-hint {
    font-size: 1rem;
  }
}
/* Force Siddham glyphs */
.siddham-glyph {
  font-family: 'Noto Sans Siddham', sans-serif !important;
}
/* === SAFE: LOCAL ANNAPURNA FOR EDICT === */
#edict, #edict * {
  font-family: 'Annapurna SIL', 'Noto Sans Devanagari', sans-serif !important;
  font-feature-settings: "haln","blws","liga","calt" !important;
  text-rendering: optimizeLegibility !important;
}
/* Brahmi Legend = permanent gold, no leaks */
#legend-message.brahmi-legend {
  color: #d4af37 !important;
  font-weight: bold !important;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}
/* BRAHMI LEGEND — PULSING GOLD GLORY */
#legend-message.brahmi-legend {
  color: #d4af37 !important;
  font-weight: bold !important;
  text-shadow:
    0 0 10px rgba(212, 175, 55, 0.6),
    0 0 20px rgba(212, 175, 55, 0.4);
  animation: brahmiPulse 10s ease-in-out infinite;
}
@keyframes brahmiPulse {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(212, 175, 55, 0.6),
      0 0 20px rgba(212, 175, 55, 0.4);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 20px rgba(212, 175, 55, 0.9),
      0 0 40px rgba(212, 175, 55, 0.7),
      0 0 60px rgba(212, 175, 55, 0.5);
    transform: scale(1.02);
  }
}
/* Golden subscript numbers for edicts – finally beats the #edict tyrant */
#edict .line-ref {
  color: #b8860b !important;
  font-size: 0.78em !important;
  opacity: 0.9;
  vertical-align: 0.35em !important;
  line-height: 1 !important;
}

/* ———————————————————————————————
   SHARED INPUT BAR + ALL QUIZ BUTTONS
   Works perfectly on Pixel 5 and up
   ——————————————————————————————— */
#input-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  margin: 0.8rem 0 1.2rem;
  flex-wrap: wrap;
  background: var(--bg);
  border-top: 1px solid var(--input-border);
}
#input-bar #answer {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  padding: 0.6rem 0.8rem;
  font-size: 1.3rem;
  text-align: center;
}
#input-bar button,
#score-screen button,
.content button {
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  min-width: 70px;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}
#input-bar button:hover:not(:disabled),
#score-screen button:hover:not(:disabled),
.content button:hover:not(:disabled) {
  background: #0056b3;
}

/* Extra tight on very small screens */
@media (max-width: 360px) {
  #input-bar {
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
  }
  #input-bar #answer {
    font-size: 1.25rem;
    min-width: 110px;
  }
}

/* ———————————————————————————————
   WARM DARK MODE FOR INPUT BAR, BUTTONS & DROPDOWN
   Cozy night-time reading — no more harsh white glare
   ——————————————————————————————— */
[data-theme="dark"] #input-bar {
  background: #1e1e1e;
  border-top-color: #4a4a4a;
}
[data-theme="dark"] #input-bar #answer {
  background: #2a2a2a;
  border: 1px solid #5a5a5a;
  color: #e8e8e0;
}
[data-theme="dark"] #input-bar button,
[data-theme="dark"] #score-screen button,
[data-theme="dark"] .content button,
[data-theme="dark"] #edict-selector {
  background: var(--button-bg) !important;
  border: 1px solid #5a5a5a !important;
  color: var(--button-text) !important;
}
[data-theme="dark"] #edict-selector option {
  background: #2a2a2a;
  color: #e0e0e0;
}
[data-theme="dark"] #input-bar #answer:focus,
[data-theme="dark"] #input-bar button:focus,
[data-theme="dark"] #edict-selector:focus {
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
  outline: none;
}
/* ——————— INPUT GUIDE – warm, on-brand, mobile-perfect ——————— */
#input-guide-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 44px; height: 44px;
  background: #b8860b;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(184,134,11,0.4);
  transition: transform 0.2s;
}
#input-guide-btn:hover { transform: scale(1.1); }

#input-guide-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.94);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
#input-guide-overlay.show { display: flex; }

#input-guide-content {
  background: var(--bg);
  color: var(--text);
  padding: 2rem;
  border-radius: 18px;
  border: 2px solid #b8860b;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  font-size: 1.1rem;
  line-height: 2;
}
#input-guide-content h3 { margin: 0 0 1.2rem; color: #b8860b; font-size: 1.8rem; }
#input-guide-content code {
  background: rgba(184,134,11,0.15);
  color: #b8860b;
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-weight: 500;
}
#input-guide-content .close { margin-top: 1.5rem; font-size: 0.9rem; opacity: 0.7; }

/* Click anywhere to close */
#input-guide-overlay { cursor: pointer; }
/*#input-guide-overlay:active { display: none; }*/

/* debug.js fix: Force local Noto Sans Siddham on #siddham-glyph + #feedback (and all children) – defeats Annapurna SIL !important hijack + debug.js monospace inline style */
#siddham-glyph,
#siddham-glyph *,
.siddham-glyph,
.siddham-glyph *,
#feedback,
#feedback * {
  font-family: 'Noto Sans Siddham', sans-serif !important;
  font-feature-settings: "liga" 1, "calt" 1, "ccmp" 1 !important;
  text-rendering: optimizeLegibility !important;
}

/* FINAL NO-FLASH PATCH – removes the blanket override for elements with explicit background */
