:root {
  --font-th: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  --font-ar: 'Noto Naskh Arabic', 'Amiri', 'Traditional Arabic', 'Geeza Pro', serif;

  --bg-page: #F3FAF8;
  --bg-surface: #FFFFFF;
  --bg-surface-soft: #E9F5F2;
  --bg-header: #0F6E63;
  --bg-header-btn: rgba(255, 255, 255, 0.16);
  --bg-header-btn-active: #FFFFFF;
  --text-header: #FFFFFF;
  --text-header-btn-active: #0B534B;

  --text-primary: #102A27;
  --text-secondary: #486662;
  --text-muted: #6C8682;

  --brand-primary: #0F6E63;
  --brand-primary-hover: #0B584F;
  --brand-primary-soft: #D7F2EC;
  --brand-accent: #D97706;
  --brand-accent-hover: #B45309;
  --brand-accent-soft: #FEF3C7;

  --status-success: #15803D;
  --status-success-soft: #DCFCE7;
  --status-danger: #B91C1C;
  --status-danger-soft: #FEE2E2;
  --status-warning: #B45309;
  --status-warning-soft: #FEF3C7;
  --status-info: #0369A1;
  --status-info-soft: #E0F2FE;

  --border-subtle: #D4E6E2;
  --border-strong: #9AC3BC;

  --shadow-sm: 0 2px 6px rgba(15, 110, 99, 0.08);
  --shadow-md: 0 8px 22px rgba(15, 110, 99, 0.12);
  --shadow-lg: 0 16px 36px rgba(16, 42, 39, 0.22);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --header-height: 58px;
  --bottom-nav-height: 68px;
  --touch-min: 44px;
  --max-content-width: 780px;
  --transition-fast: 160ms ease;
  --transition-med: 260ms ease;
}

html[data-theme="dark"] {
  --bg-page: #0B1320;
  --bg-surface: #152132;
  --bg-surface-soft: #1D2D42;
  --bg-header: #0B4A43;
  --bg-header-btn: rgba(255, 255, 255, 0.14);
  --bg-header-btn-active: #34D399;
  --text-header: #F8FAFC;
  --text-header-btn-active: #062822;

  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --brand-primary: #14B8A6;
  --brand-primary-hover: #0D9488;
  --brand-primary-soft: rgba(20, 184, 166, 0.2);
  --brand-accent: #F59E0B;
  --brand-accent-hover: #D97706;
  --brand-accent-soft: rgba(245, 158, 11, 0.2);

  --status-success: #4ADE80;
  --status-success-soft: rgba(34, 197, 94, 0.18);
  --status-danger: #F87171;
  --status-danger-soft: rgba(239, 68, 68, 0.2);
  --status-warning: #FBBF24;
  --status-warning-soft: rgba(245, 158, 11, 0.2);
  --status-info: #38BDF8;
  --status-info-soft: rgba(56, 189, 248, 0.18);

  --border-subtle: #26384F;
  --border-strong: #3C5573;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.56);
}

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

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

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-th);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.th-text,
.ltr-block {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-th);
  line-height: 1.75;
}

.ar-text {
  display: block;
  direction: rtl;
  unicode-bidi: isolate;
  font-family: var(--font-ar);
  line-height: 2.2;
  letter-spacing: 0;
  font-weight: 700;
  word-break: break-word;
}

.ar-word-lg {
  font-size: clamp(2rem, 7vw, 2.75rem);
  text-align: center;
  padding: 6px 4px;
}

.ar-word-md {
  font-size: clamp(1.45rem, 5vw, 1.9rem);
  text-align: center;
  padding: 4px 2px;
}

.ar-sentence {
  font-size: clamp(1.25rem, 4.4vw, 1.55rem);
  text-align: right;
  font-weight: 600;
  line-height: 2.3;
  padding: 8px 10px;
}

.ar-sample {
  font-size: 1.6rem;
  text-align: center;
  color: var(--brand-primary);
  padding: 8px 0;
}
