:root {
  --bg: #E4D5B7;
  --card: #FFFFFF;
  --text: #2F2F2F;
  --muted: #6B4A2B;
  --primary: #6B4A2B;
  --accent: #FFB900;
  --border: rgba(107, 74, 43, 0.2);
  --shadow: 0 8px 16px rgba(47, 47, 47, 0.08);
  --shadow-deep: 0 12px 24px rgba(47, 47, 47, 0.12);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

:root.dark {
  --bg: #222222;
  --card: #2F2F2F;
  --text: #F0F0F0;
  --muted: #C0C0C0;
  --primary: #B78D63;
  --accent: #FFC93C;
  --border: #4A4A4A;
  --shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-deep: 0 12px 24px rgba(0, 0, 0, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

* { box-sizing: border-box; }

html, body { 
  height: 100%;
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Tajawal', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  transition: var(--transition);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2" viewBox="0 0 2 2"><path d="M0 0h1v1H0z" fill="rgba(0,0,0,0.03)"/><path d="M1 1h1v1H1z" fill="rgba(0,0,0,0.03)"/></svg>');
  background-repeat: repeat;
  padding-bottom: 120px;
}

/* ===== Splash ===== */
.splash{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #7d5c3d;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .45s ease, transform .45s ease;
}
.splash.hide{
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}
.splash-inner{
  text-align: center;
  padding: 20px;
}
.splash-gif{
  width: clamp(170px, 34vw, 340px);
  height: auto;
  max-height: 46vh;         /* يمنعها تصير طويلة زيادة */
  object-fit: contain;
  border-radius: 18px;
  max-width: 100%;
  display: block;
}

.splash-video{
  width: min(360px, 85vw);
  max-width: 100%;
  border-radius: 18px;
  display: block;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.splash-title {
  color: #fff;
  margin: 14px 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'Marhey', 'Tajawal', sans-serif;
  letter-spacing: 0.5px;
}
.splash-sub{
  color: rgba(255,255,255,.75);
  margin: 0;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(228, 213, 183, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.topbar.dark-mode {
  background: rgba(34, 34, 34, 0.92);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 420px) {
  .topbar {
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}

/* Button */
.btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.wrap {
  max-width: 880px;
  margin: 16px auto;
  padding: 0 14px 28px;
}

/* ===== Page Card ===== */
.page-card {
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid var(--border);
  transition: var(--transition);
  animation: fadeIn 0.5s ease-out;
}

/* Logo */
.logo-row {
  display: flex;
  justify-content: center;
  margin: 2px 0 14px;
}

.app-logo{
  width: clamp(92px, 18vw, 160px);
  height: auto;             /* مهم: لا تثبت الطول */
  aspect-ratio: 1 / 1;      /* يخليه مربع ومرتب */
  object-fit: contain;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  padding: clamp(8px, 1.2vw, 12px);
  box-shadow: var(--shadow);
  border: 3px solid var(--card);
}


.app-logo-small{
  width: clamp(34px, 3.2vw, 44px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: clamp(5px, 0.8vw, 7px);
  box-shadow: var(--shadow);
  border: 2px solid rgba(107, 74, 43, 0.1);
  transition: var(--transition);
  cursor: pointer;
}


.app-logo-small:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-deep);
}

.title-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.2px;
  color: var(--primary);
  font-weight: 800;
}

h2 {
  margin: 16px 0 8px;
  font-size: 1.15rem;
  color: var(--primary);
  font-family: 'Marhey', 'Tajawal', sans-serif;
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
  padding-bottom: 4px;
}

.badge {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--primary);
  font-size: 0.85rem;
}

.muted {
  color: var(--muted);
  margin: 10px 0 0;
  font-weight: 500;
}

.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* Policy */
.policy {
  animation: fadeIn 0.5s ease-out 0.1s both;
}

.policy h2 {
  margin: 16px 0 8px;
  font-size: 1.05rem;
}

.policy p {
  margin: 0 0 10px;
  line-height: 1.75;
  opacity: 0.92;
}

.hidden {
  display: none;
}

/* Pages */
.pages .page {
  display: none;
}

.pages .page.active {
  display: block;
}

/* Dev & about boxes */
.devbox, .storebox, .mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  animation: scaleUp 0.5s ease-out both;
}

.devbox h2, .storebox h2, .mini-card h2, .mini-card h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-family: 'Marhey', 'Tajawal', sans-serif;
}

.devline {
  margin: 8px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  line-height: 1.6;
}

.k {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.v {
  font-weight: 600;
  color: var(--text);
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.link:hover {
  text-decoration: underline;
  color: var(--accent);
}

.features ul {
  margin: 0;
  padding-inline-start: 18px;
  color: var(--text);
}

.features li {
  margin: 8px 0;
  opacity: 0.92;
}

.gallery .shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gallery .shots img {
  width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  object-fit: fill;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: var(--transition);
}

.gallery .shots img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow);
}




/* Footer */
.footer {
  padding: 18px 14px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-weight: 800;
  z-index: 50;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
}

/* ===== Language Switch ===== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: var(--shadow);
  border: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: var(--transition);
}

.lang-switch:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-deep);
}

.lang-switch:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.lang-switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
  opacity: 0;
}

.lang-switch span {
  display: inline-block;
  color: white;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: opacity 200ms ease;
  padding: 0 4px;
}

/* E label (appears when unchecked - English) */
.lang-switch > span:first-of-type {
  opacity: 0.6;
}

.lang-switch input:not(:checked) ~ span:first-of-type {
  opacity: 1;
}

.lang-switch input:checked ~ span:first-of-type {
  opacity: 0.5;
}

/* ع label (appears when checked - Arabic) */
.lang-switch > span:last-of-type {
  opacity: 0.6;
}

.lang-switch input:checked ~ span:last-of-type {
  opacity: 1;
}

.lang-switch input:not(:checked) ~ span:last-of-type {
  opacity: 0.5;
}

/* ===== Bottom fixed menu ===== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  z-index: 30;
  background: rgba(228, 213, 183, 0.88);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  transition: var(--transition);
}

.bottom-nav.dark-mode {
  background: rgba(34, 34, 34, 0.88);
}

.radio-inputs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  width: min(520px, 100%);
  font-size: 14px;
  gap: 0.5rem;
  border: 1px solid var(--border);
}

.radio-inputs .radio {
  flex: 1 1 auto;
  text-align: center;
  position: relative;
}

.radio-inputs .radio input {
  display: none;
}

.radio-inputs .radio .name {
  position: relative;
  display: flex;
  gap: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  padding: 0.75rem 0.5rem;
  color: var(--text);
  font-weight: 700;
  font-family: inherit;
  background: transparent;
  box-shadow: none;
  transition: var(--transition);
  overflow: hidden;
}

.radio-inputs .radio input:checked + .name {
  background: var(--primary);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: var(--shadow);
  transform: scale(1.05);
}

.radio-inputs .radio .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.radio-inputs .radio input:checked + .name .ico {
  transform: scale(1.2);
}

.radio-inputs .radio .name:hover {
  opacity: 0.8;
}

.ico svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Responsive */
@media (max-width: 768px) {
  .wrap {
    padding: 0 12px 28px;
  }

  .page-card {
    padding: 14px;
    border-radius: 18px;
  }

  h1 {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 1rem;
  }

  .gallery .shots {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.1rem;
  }

  h2 {
    font-size: 0.95rem;
  }

  .gallery .shots {
    grid-template-columns: 1fr;
  }

  .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .policy p {
    font-size: 0.95rem;
  }
}

/* RTL Support */
html[dir="rtl"] body {
  direction: rtl;
}
