*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg) var(--bg-grad) no-repeat; background-attachment: fixed;
  color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.7;
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
a { color: var(--teal); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* المحتوى الإنجليزي يضل LTR جوّا الصفحة العربية */
.en, [dir="ltr"] { direction: ltr; unicode-bidi: isolate; text-align: left; }
.en { display: inline-block; }

.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--text-soft); }
.top-actions { display: flex; align-items: center; gap: 8px; }
main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 104px; outline: none; }

.nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav-inner { display: flex; width: 100%; max-width: var(--maxw); }
.nav a { flex: 1; text-align: center; padding: 6px 4px; text-decoration: none; color: var(--text-soft); font-size: .78rem; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.nav a span { font-size: 1.35rem; line-height: 1.2; }
.nav a.is-active { color: var(--gold); font-weight: 800; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
