/* =========================================================================
   assets/css/style.css
   โทนสีเขียวนวลเอิร์ทโทนแบบอ่อนละมุน + เรขาคณิตอาหรับโมเดิร์น + รองรับมือถือ
   ========================================================================= */

/* Font Face: King Fahd Glorious Quran Printing Complex (KFGQPC Uthmanic Script HAFS) */
@font-face {
  font-family: 'KFGQPC Uthmanic Script HAFS';
  src: url('https://cdn.jsdelivr.net/gh/thetruetruth/quran-data-kfgqpc@main/hafs/font/hafs.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Soft Light Earth-Tone Sage Green & Warm Sand Palette (เขียวนวลเอิร์ทโทนแบบอ่อนละมุน) */
  --bg: #f7f6f1;
  --surface: #fdfcf9;
  --surface-soft: #f0eee6;
  --surface-gold: #faf6eb;
  --border: #e2decb;
  --border-gold: #d6c6a5;
  --ink: #38463d;
  --muted: #6e7f74;
  --brand: #88a494;
  --brand-dark: #739080;
  --brand-deeper: #617d6d;
  --brand-light: #eef4f0;
  --brand-ink: #ffffff;
  --accent: #bfa173;
  --accent-soft: #f7f2e7;
  --highlight: #fbf2d4;
  --highlight-border: #cdb07b;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 3px 12px rgba(115, 144, 128, 0.08), 0 1px 3px rgba(56, 70, 61, 0.04);
  --shadow-lg: 0 14px 32px rgba(115, 144, 128, 0.12);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --font-thai: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-quran: 'KFGQPC Uthmanic Script HAFS', 'Amiri Quran', serif;
}

[data-theme="dark"] {
  --bg: #25322b;
  --surface: #2f3e36;
  --surface-soft: #394b41;
  --surface-gold: #3b4233;
  --border: #4b6154;
  --border-gold: #877554;
  --ink: #f2f0e8;
  --muted: #bdcbc1;
  --brand: #8aa696;
  --brand-dark: #6d8979;
  --brand-deeper: #577162;
  --brand-light: #384b40;
  --brand-ink: #ffffff;
  --accent: #dec398;
  --accent-soft: #423b2e;
  --highlight: #584e2c;
  --highlight-border: #dec398;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-thai);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) 1px, transparent 1px),
                    radial-gradient(var(--border) 1px, var(--bg) 1px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Modern Arabic Geometric Top Header */
.site-header {
  background: linear-gradient(135deg, #769383 0%, #8aa696 60%, #9ab4a5 100%);
  color: #fcfbf8;
  border-bottom: 2px solid var(--border-gold);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.28s ease-in-out, opacity 0.25s ease-in-out;
  will-change: transform;
}

/* Auto-hide header on mobile when scrolling down */
@media (max-width: 767px) {
  .site-header.header-hidden {
    transform: translateY(-105%);
    opacity: 0;
    pointer-events: none;
  }
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1.2'%3E%3Cpolygon points='30,4 37,23 56,30 37,37 30,56 23,37 4,30 23,23'/%3E%3Crect x='16' y='16' width='28' height='28' transform='rotate(45 30 30)'/%3E%3C/g%3E%3C/svg%3E");
}

.header-inner {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 768px) {
  .header-inner {
    padding: var(--space-3) var(--space-6);
    gap: var(--space-3);
  }
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 200px;
}

.brand-logo-svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.16));
}

@media (min-width: 768px) {
  .brand-logo-svg {
    width: 50px;
    height: 50px;
  }
}

.brand-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .brand-title {
    font-size: 1.24rem;
  }
}

/* ซ่อนข้อความคำโปรยรองบนหน้าจอมือถือ */
.brand-subtitle {
  display: none;
  margin: 2px 0 0 0;
  font-size: 0.78rem;
  color: rgba(251, 250, 246, 0.92);
  line-height: 1.35;
}

@media (min-width: 768px) {
  .brand-subtitle {
    display: block;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-install-app {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #e6d2aa;
  background: linear-gradient(135deg, #c5a068 0%, #a68149 100%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  transition: transform 0.15s ease, filter 0.15s ease;
  min-height: 36px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .btn-install-app {
    font-size: 0.85rem;
    padding: 8px 14px;
    min-height: 40px;
  }
}

.btn-install-app:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.btn-theme-header {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .btn-theme-header {
    font-size: 0.85rem;
    padding: 8px 12px;
    min-height: 40px;
  }
}

.btn-theme-header:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Main Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-3);
}

@media (min-width: 768px) {
  .container {
    padding: var(--space-6);
  }
}

.geometric-trim {
  height: 6px;
  background: repeating-linear-gradient(
    45deg,
    var(--border-gold),
    var(--border-gold) 8px,
    var(--brand) 8px,
    var(--brand) 16px
  );
  opacity: 0.55;
  border-radius: 999px;
  margin-bottom: var(--space-4);
}

/* Control Bar */
.toolbar-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  position: relative;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 768px) {
  .toolbar-section {
    width: auto;
  }
}

.toolbar-field {
  flex: 1 1 200px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.select-input {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  min-height: 42px;
}

.toggle-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  width: 100%;
}

@media (min-width: 768px) {
  .toggle-group {
    display: flex;
    width: auto;
  }
}

.toggle-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s ease;
  min-height: 42px;
  text-align: left;
}

.toggle-btn:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.toggle-btn.active {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand-dark);
}

.toggle-btn .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.toggle-btn.active .status-dot {
  background: #fff2be;
  box-shadow: 0 0 6px #fff2be;
}

/* Main Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 410px 1fr;
    gap: var(--space-6);
  }
}

/* Left Sticky Sign Language Studio Panel */
.sign-studio-card {
  background: var(--surface);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .sign-studio-card {
    position: sticky;
    top: 84px;
  }
}

.studio-header {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fbfaf6;
  padding: 12px var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 2px solid var(--border-gold);
}

.studio-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff8dc;
}

.studio-screen {
  background: radial-gradient(circle at 50% 30%, #8ea898 0%, #789483 100%);
  color: #ffffff;
  padding: var(--space-3);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
}

/* Sign Spelling Stage */
.avatar-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.avatar-svg-wrap {
  width: 100%;
  min-height: 175px;
  border-radius: 16px;
  background: linear-gradient(145deg, #7c9887 0%, #6a8675 100%);
  border: 2px solid #e6dac2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-3);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
  gap: var(--space-2);
}

.avatar-svg-wrap::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(245, 238, 222, 0.42);
  border-radius: 11px;
  pointer-events: none;
}

.board-caption {
  font-size: 0.76rem;
  color: #fbf5e8;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.finger-spelling-board {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  z-index: 2;
}

.finger-card {
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(245, 235, 212, 0.75);
  border-radius: 12px;
  padding: 8px 10px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 66px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.finger-card:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.finger-card .finger-emoji {
  font-size: 2.1rem;
  line-height: 1.15;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.16));
}

.finger-card .finger-letter {
  font-family: var(--font-quran);
  font-size: 1.45rem;
  color: #fff2be;
  font-weight: 700;
  line-height: 1.75;
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  padding: 2px 0;
}

.finger-card .finger-th-name {
  font-size: 0.72rem;
  color: #ffffff;
  font-weight: 600;
  margin-top: 4px;
  padding-top: 3px;
  border-top: 1px solid rgba(245, 235, 212, 0.4);
  width: 100%;
  text-align: center;
}

.playing-active .finger-card {
  animation: fingerPulse 0.9s ease-in-out infinite alternate;
}

@keyframes fingerPulse {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.04) translateY(-3px); border-color: #fff2be; }
}

/* Current Synced Word Callout inside Studio */
.live-word-box {
  width: 100%;
  background: rgba(94, 121, 106, 0.48);
  border: 1px solid rgba(240, 228, 204, 0.55);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.live-arabic-word {
  font-family: var(--font-quran);
  font-size: 2.05rem;
  line-height: 1.55;
  color: #fff2be;
  direction: rtl;
  margin-bottom: 2px;
}

.live-thai-meaning {
  font-size: 0.94rem;
  font-weight: 600;
  color: #ffffff;
}

.live-gesture-desc {
  font-size: 0.8rem;
  color: #eef5f0;
  margin-top: 4px;
  line-height: 1.4;
}

/* Abjadiyah Ishariyah (Saudi Finger-spelling strip) */
.ishariyah-strip {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.ishariyah-char {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(235, 220, 190, 0.4);
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 38px;
  gap: 2px;
}

.ishariyah-char .ar-letter {
  font-family: var(--font-quran);
  font-size: 1.15rem;
  color: #fff2be;
  line-height: 1.55;
  min-height: 1.7rem;
  display: flex;
  align-items: center;
}

.ishariyah-char .hand-code {
  font-size: 0.9rem;
  line-height: 1.1;
}

/* Visual Audio Rhythm Indicator */
.visual-beat-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 16px;
  margin-top: 4px;
}

.beat-col {
  width: 5px;
  height: 6px;
  border-radius: 3px;
  background: #b7d1c1;
  transition: height 0.15s ease;
}

.playing-active .beat-col:nth-child(odd) {
  animation: beatBounce 0.45s infinite alternate;
}
.playing-active .beat-col:nth-child(even) {
  animation: beatBounce 0.35s 0.15s infinite alternate;
}

@keyframes beatBounce {
  from { height: 4px; background: #b7d1c1; }
  to { height: 16px; background: #fff2be; }
}

/* Studio Audio & Sync Controls */
.studio-controls {
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

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

.btn-play-main {
  flex: 1 1 100%;
  order: -1;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(115, 144, 128, 0.22);
  transition: filter 0.15s ease;
  min-height: 44px;
}

@media (min-width: 640px) {
  .btn-play-main {
    flex: 1;
    order: 0;
  }
}

.btn-play-main:hover {
  filter: brightness(1.06);
}

.btn-icon {
  flex: 1 1 45%;
  font: inherit;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  min-height: 42px;
  text-align: center;
}

@media (min-width: 640px) {
  .btn-icon {
    flex: 0 0 auto;
  }
}

.btn-icon:hover {
  border-color: var(--brand);
}

/* Right Panel: Mushaf & Ayah Cards */
.mushaf-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.surah-banner {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fbfaf6;
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.surah-banner::after {
  content: "۞";
  position: absolute;
  left: 16px;
  bottom: -18px;
  font-size: 5.5rem;
  color: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.surah-banner-ar {
  font-family: var(--font-quran);
  font-size: 2.2rem;
  color: #fff2be;
  line-height: 1.3;
}

.surah-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-2);
}

.meta-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Ayah Card */
.ayah-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

@media (min-width: 768px) {
  .ayah-card {
    padding: var(--space-6);
  }
}

.ayah-card.active-ayah {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(191, 161, 115, 0.18), var(--shadow);
  background: var(--surface-gold);
}

.ayah-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.ayah-number-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--brand-deeper);
  background: var(--brand-light);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-gold);
}

[data-theme="dark"] .ayah-number-badge {
  color: #fff2be;
}

.btn-ayah-action {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn-ayah-action:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.btn-ayah-action.playing {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-dark);
}

/* Full Arabic Uthmanic Line */
.arabic-ayah-line {
  font-family: var(--font-quran);
  font-size: 1.95rem;
  line-height: 2.2;
  direction: rtl;
  text-align: right;
  color: var(--ink);
  padding: var(--space-2) 0;
  user-select: text;
}

@media (min-width: 640px) {
  .arabic-ayah-line {
    font-size: 2.25rem;
  }
}

.arabic-word-token {
  display: inline-block;
  padding: 0 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.arabic-word-token:hover {
  background: var(--brand-light);
}

.arabic-word-token.word-active {
  background: var(--highlight);
  outline: 2px solid var(--highlight-border);
  color: #2c3a31;
}

.ayah-end-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-quran);
  color: var(--accent);
  margin: 0 6px;
}

/* Word-by-Word RTL Grid */
.word-by-word-section {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

.wbw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  flex-wrap: wrap;
  gap: 6px;
}

.wbw-grid {
  direction: rtl;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .wbw-grid {
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: var(--space-3);
  }
}

.wbw-card {
  direction: ltr;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.wbw-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.wbw-card.word-active {
  background: var(--highlight);
  border-color: var(--highlight-border);
  box-shadow: 0 0 0 2px rgba(205, 176, 123, 0.25);
}

.wbw-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.wbw-order-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.wbw-audio-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-deeper);
  background: var(--brand-light);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

[data-theme="dark"] .wbw-audio-pill {
  color: #fff2be;
}

.wbw-arabic {
  font-family: var(--font-quran);
  font-size: 1.75rem;
  line-height: 1.65;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-deeper);
  direction: rtl;
}

[data-theme="dark"] .wbw-arabic {
  color: #fff2be;
}

.wbw-card.word-active .wbw-arabic {
  color: #2c3a31;
}

.wbw-sign-letters {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px 4px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.wbw-sign-letter-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.05rem;
  padding: 2px 5px;
  line-height: 1.15;
  gap: 2px;
}

.wbw-sign-letter-chip small {
  font-family: var(--font-quran);
  font-size: 0.92rem;
  line-height: 1.5;
  min-height: 1.35rem;
  display: flex;
  align-items: center;
  color: var(--brand-deeper);
  font-weight: 700;
}

[data-theme="dark"] .wbw-sign-letter-chip small {
  color: #fff2be;
}

.wbw-pronounce {
  font-size: 0.75rem;
  color: var(--muted);
}

.wbw-thai {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.wbw-sign-box {
  margin-top: 2px;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 6px;
  font-size: 0.74rem;
  text-align: left;
}

.sign-tag-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--brand-deeper);
  margin-bottom: 2px;
}

[data-theme="dark"] .sign-tag-row {
  color: #fff2be;
}

.sign-step-text {
  color: var(--muted);
  line-height: 1.35;
}

/* Thai Full Translation Box */
.thai-translation-box {
  margin-top: var(--space-3);
  background: var(--brand-light);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}

.translation-source-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-deeper);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .translation-source-label {
  color: #fff2be;
}

.translation-text {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink);
}

/* Manage / Add Surah Panel */
.arch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 960px) {
  .arch-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }
}

.code-card {
  background: var(--surface);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}

@media (min-width: 768px) {
  .code-card {
    padding: var(--space-6);
  }
}

.code-card h3 {
  margin-top: 0;
  color: var(--brand-deeper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

pre.code-block {
  background: #233029;
  color: #e6ece8;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  border: 1px solid #435d4d;
  margin: 0;
}

.form-group {
  margin-bottom: var(--space-3);
}

.form-input, .form-textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink);
}

.form-textarea {
  min-height: 84px;
  resize: vertical;
}

/* Footer with Small Add Surah Button after ค.ศ. 2026 */
.site-footer {
  margin-top: var(--space-8);
  background: var(--surface);
  border-top: 2px solid var(--border-gold);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer a {
  color: var(--brand-deeper);
  font-weight: 700;
  text-decoration: none;
}

[data-theme="dark"] .site-footer a {
  color: #fff2be;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-copyright-row {
  margin-top: 10px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-footer-mini {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-gold);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-footer-mini:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* In-Page Modal Overlay */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(37, 50, 43, 0.55);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-box {
  background: var(--surface);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 430px;
  width: 100%;
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-title {
  margin: 0 0 8px 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--brand-deeper);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .modal-title {
  color: #fff2be;
}

.modal-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}
/* =========================================================================
   Visitor Counter Bar (เหนือบรรทัด Copyright ตามแบบตัวอย่าง) & Banner Modal
   ========================================================================= */
.visitor-stats-bar {
  margin: 14px auto 10px auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 20px;
  font-size: 0.84rem;
  color: var(--muted);
}

.stat-chip.stat-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-light);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: 999px;
  color: var(--ink);
}

.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2fa36b;
  box-shadow: 0 0 0 3px rgba(47, 163, 107, 0.2);
  display: inline-block;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.stat-item strong,
.stat-chip strong {
  color: var(--ink);
  font-weight: 700;
}

.stat-svg {
  width: 15px;
  height: 15px;
  opacity: 0.72;
  flex-shrink: 0;
}

/* กล่องตัวอย่างและคัดลอกโค้ดแบนเนอร์ 80x120 */
.banner-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.banner-code-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  min-height: 78px;
  line-height: 1.45;
}

.copy-toast {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--brand-light);
  border: 1px solid var(--brand);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}
