/* =========================================================
   AHANARZAQI — Apple iOS Style Mobile App UI
   Full system-level redesign: SF-style, glassy, fluid
   ========================================================= */

@font-face {
  font-family: 'Thmanyah Serif Display';
  src: url('../assets/fonts/thmanyahserifdisplay-Medium.otf') format('opentype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('../assets/fonts/thmanyahseriftext-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('../assets/fonts/thmanyahseriftext-Light.otf') format('opentype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('../assets/fonts/thmanyahseriftext-Medium.otf') format('opentype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('../assets/fonts/thmanyahseriftext-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('../assets/fonts/thmanyahseriftext-Black.otf') format('opentype');
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --font-display: 'Thmanyah Serif Display', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-text: 'Thmanyah Serif Text', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Cairo', 'Segoe UI', Tahoma, sans-serif;

  /* iOS Color Palette */
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-orange: #ff9500;
  --ios-red: #ff3b30;
  --ios-pink: #ff2d55;
  --ios-purple: #af52de;
  --ios-indigo: #5856d6;
  --ios-teal: #30b0c7;
  --ios-yellow: #ffcc00;

  --accent: var(--ios-blue);
  --accent-soft: rgba(0,122,255,0.12);
  --accent-border: rgba(0,122,255,0.25);

  /* Light system */
  --sys-bg: #f2f2f7;
  --sys-bg-2: #ffffff;
  --sys-bg-3: #ffffff;
  --sys-grouped: #f2f2f7;
  --sys-grouped-2: #ffffff;
  --sys-separator: rgba(60,60,67,0.18);
  --sys-separator-opaque: #c6c6c8;
  --sys-label: #000000;
  --sys-label-2: rgba(60,60,67,0.6);
  --sys-label-3: rgba(60,60,67,0.3);
  --sys-label-4: rgba(60,60,67,0.18);
  --sys-fill: rgba(120,120,128,0.12);
  --sys-fill-2: rgba(120,120,128,0.16);
  --sys-fill-3: rgba(118,118,128,0.24);
  --sys-overlay: rgba(0,0,0,0.4);
  --glass-bg: rgba(255,255,255,0.72);
  --glass-bg-strong: rgba(255,255,255,0.86);
  --glass-stroke: rgba(255,255,255,0.6);
  --card-shadow: 0 2px 10px rgba(0,0,0,0.04), 0 8px 28px rgba(0,0,0,0.06);
  --card-shadow-lg: 0 4px 14px rgba(0,0,0,0.05), 0 20px 50px rgba(0,0,0,0.10);

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-xxl: 34px;

  --tap: 48px;
  --ease-spring: cubic-bezier(.22,1,.36,1);
  --ease-ios: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --sys-bg: #000000;
    --sys-bg-2: #1c1c1e;
    --sys-bg-3: #2c2c2e;
    --sys-grouped: #000000;
    --sys-grouped-2: #1c1c1e;
    --sys-separator: rgba(84,84,88,0.6);
    --sys-separator-opaque: #38383a;
    --sys-label: #ffffff;
    --sys-label-2: rgba(235,235,245,0.6);
    --sys-label-3: rgba(235,235,245,0.3);
    --sys-label-4: rgba(235,235,245,0.16);
    --sys-fill: rgba(120,120,128,0.36);
    --sys-fill-2: rgba(120,120,128,0.32);
    --sys-fill-3: rgba(118,118,128,0.4);
    --sys-overlay: rgba(0,0,0,0.6);
    --glass-bg: rgba(28,28,30,0.72);
    --glass-bg-strong: rgba(28,28,30,0.88);
    --glass-stroke: rgba(255,255,255,0.08);
    --card-shadow: 0 2px 10px rgba(0,0,0,0.35), 0 8px 28px rgba(0,0,0,0.4);
    --card-shadow-lg: 0 4px 14px rgba(0,0,0,0.4), 0 20px 50px rgba(0,0,0,0.5);
    --accent-soft: rgba(10,132,255,0.22);
    --accent-border: rgba(10,132,255,0.42);
    --accent: #0a84ff;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes pulseSoft {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.02); }
}
@keyframes scaleFade {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

html, body {
  margin: 0 !important; padding: 0 !important;
  min-height: 100vh; min-height: 100dvh;
  background: var(--sys-bg);
  color: var(--sys-label);
  font-family: var(--font-text);
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body.ios-app {
  background: var(--sys-grouped);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-inline-start: env(safe-area-inset-left);
  padding-inline-end: env(safe-area-inset-right);
  color-scheme: light dark;
}

::-webkit-scrollbar { width: 0; height: 0; display: none; }
::selection { background: var(--accent-soft); color: var(--sys-label); }

img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

/* =================== APP SHELL =================== */
.ios-shell {
  width: 100%;
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--sys-grouped);
  overflow-x: hidden;
}

/* Desktop fallback: NATIVE FULL-WIDTH LAYOUT (not mobile frame) */
@media (min-width: 1180px) {
  body.ios-app {
    background: var(--sys-grouped);
  }
  .ios-shell {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    min-height: 100dvh;
    height: auto;
    border-radius: 0;
    overflow: hidden;
    position: relative;
    box-shadow: none;
    background: var(--sys-grouped);
    isolation: isolate;
    padding-inline: 32px;
  }
  .ios-shell::before { display: none; }

  .ios-nav-inner {
    padding: 10px 8px;
    grid-template-columns: 56px 1fr 56px;
  }

  .ios-large-title {
    padding: 12px 8px 18px;
  }
  .ios-large-title h1 {
    font-size: clamp(2.4rem, 4vw, 3.2rem);
  }

  .ios-main {
    padding-bottom: 120px;
  }

  .ios-toolbar-section,
  .ios-featured,
  .ios-grid-section {
    padding: 14px 8px 10px;
  }
}

/* =================== iOS NAV BAR =================== */
.ios-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  padding: 0 0 2px;
  transition: background 0.3s var(--ease-ios), backdrop-filter 0.3s var(--ease-ios), border-color 0.3s var(--ease-ios);
}
.ios-nav.scrolled {
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sys-separator);
}
.ios-nav-inner {
  min-height: 44px;
  padding: 6px 12px;
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  justify-items: center;
  gap: 8px;
  max-width: 100%;
  padding-top: calc(6px + env(safe-area-inset-top));
}
.ios-nav-btn {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sys-fill);
  color: var(--accent);
  transition: all 0.2s var(--ease-ios);
  touch-action: manipulation;
}
.ios-nav-btn svg { width: 20px; height: 20px; }
.ios-nav-btn:active { transform: scale(0.93); background: var(--sys-fill-2); }
.ios-nav-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sys-label);
  opacity: 0;
  transform: translateY(-3px);
  transition: all 0.3s var(--ease-ios);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-inline: 4px;
  text-align: center;
}
.ios-nav.scrolled .ios-nav-title {
  opacity: 1;
  transform: translateY(0);
}

.ios-large-title {
  padding: 6px 20px 14px;
  transition: all 0.3s var(--ease-ios);
  max-width: 100%;
  animation: fadeInUp 0.5s var(--ease-out) both;
}
.ios-nav.scrolled .ios-large-title {
  opacity: 0.0;
  transform: translateY(-8px);
  padding-block: 0 2px;
  pointer-events: none;
  max-height: 10px;
  overflow: hidden;
}
.ios-date-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--sys-label-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sys-fill);
  margin-bottom: 6px;
}
.ios-large-title h1 {
  margin: 0 0 4px;
  font-size: clamp(1.9rem, 7vw, 2.4rem);
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--sys-label);
}
.ios-large-subtitle {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--sys-label-2);
  max-width: 38ch;
  font-weight: 400;
}

/* =================== MAIN CONTENT =================== */
.ios-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

/* =================== SECTIONS =================== */
.ios-toolbar-section,
.ios-featured,
.ios-grid-section {
  padding: 10px 20px 6px;
}
.ios-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 2px;
  margin-bottom: 8px;
}
.ios-section-label > span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sys-label-2);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.ios-counter {
  direction: ltr;
  font-family: var(--font-text);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sys-label-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--sys-fill);
  padding: 4px 10px;
  border-radius: 999px;
}
.ios-counter b {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.82rem;
}

/* Chip horizontal scroller (iOS style) */
.ios-chip-scroller {
  margin: 0 -20px;
  padding: 0 20px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.ios-chip-row {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding-block: 4px;
  min-width: 100%;
}
.ios-chip {
  padding: 8px 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--sys-label);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s var(--ease-ios);
  border: 1px solid transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}
.ios-chip:active { transform: scale(0.95); background: var(--sys-fill-2); }
.ios-chip.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px -4px var(--accent-soft);
  border-color: transparent;
}

/* =================== FEATURED TODAY CARD =================== */
.ios-featured { padding-block: 10px 4px; }
.ios-featured-card {
  position: relative;
  border-radius: var(--r-xxl);
  padding: 22px 22px 18px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(145deg, var(--sys-bg-2), var(--sys-bg-3));
  box-shadow: var(--card-shadow-lg);
  border: 0.5px solid var(--sys-separator);
  animation: scaleFade 0.5s var(--ease-out) both;
}
.ios-featured-card::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(500px 260px at 100% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(500px 260px at 0% 100%, rgba(175,82,222,0.18), transparent 60%);
  opacity: 0.9;
  z-index: -1;
}
.ios-featured-card::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent 40%, transparent 60%, var(--accent-border));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}
.ios-featured-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ios-featured-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: pulseSoft 2s var(--ease-ios) infinite;
}
.ios-featured-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.5;
  color: var(--sys-label);
  letter-spacing: -0.01em;
  min-height: 4.5em;
}
.ios-featured-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 0.5px solid var(--sys-separator);
}
.ios-featured-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 1;
  min-width: 0;
}
.ios-featured-author img {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sys-fill);
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.if-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sys-label);
  line-height: 1.2;
}
.if-sub {
  font-size: 0.72rem;
  color: var(--sys-label-2);
  line-height: 1.2;
  margin-top: 2px;
}
.ios-featured-author > div:last-child { min-width: 0; }
.ios-featured-author > div:last-child > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.ios-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: var(--tap);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all 0.2s var(--ease-ios);
  white-space: nowrap;
  touch-action: manipulation;
  box-shadow: 0 8px 20px -8px var(--accent-soft), 0 1px 0 rgba(255,255,255,0.25) inset;
  flex-shrink: 0;
}
.ios-btn-primary:active { transform: scale(0.95); filter: brightness(1.08); }

/* =================== GRID SECTION =================== */
.ios-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 2px;
  margin-bottom: 10px;
}
.ios-section-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--sys-label);
  letter-spacing: -0.02em;
}
.ios-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 10px;
  min-height: 36px;
  border-radius: 10px;
  transition: all 0.2s var(--ease-ios);
  touch-action: manipulation;
}
.ios-text-btn:active { transform: scale(0.94); background: var(--accent-soft); }

.ios-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-block: 2px;
}

/* =================== QUOTE CARD — iOS =================== */
.card {
  position: relative;
  padding: 18px 18px 14px;
  background: var(--sys-grouped-2);
  border-radius: var(--r-xl);
  border: 0.5px solid var(--sys-separator);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.5s var(--ease-out) both;
  transition: transform 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios);
  touch-action: manipulation;
  min-width: 0;
}
.card:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    box-shadow: var(--card-shadow-lg);
    transform: translateY(-1px);
  }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  min-height: 30px;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.cat-pill .emoji { font-size: 0.98rem; }
.index-badge {
  direction: ltr;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--sys-label-2);
  flex-shrink: 0;
  font-family: var(--font-text);
}

.card-body {
  position: relative;
  font-size: 1rem;
  font-weight: 500;
  color: var(--sys-label);
  line-height: 1.85;
  letter-spacing: -0.005em;
  padding: 4px 4px 2px;
  min-height: 80px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.card-body::before {
  content: "\201C";
  display: block;
  font-size: 2.2rem;
  line-height: 0.4;
  height: 22px;
  margin-bottom: 10px;
  color: var(--sys-label-4);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
}
.card-body::after {
  content: "\201D";
  display: block;
  font-size: 1.8rem;
  line-height: 0.3;
  height: 8px;
  text-align: end;
  margin-top: 8px;
  color: var(--sys-label-4);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-block: 2px;
}
.tag-mini {
  padding: 3px 10px;
  min-height: 24px;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--sys-label-2);
  font-size: 0.68rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  margin-top: 2px;
  border-top: 0.5px solid var(--sys-separator);
  flex-wrap: wrap;
}
.card-logo {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--sys-fill);
  padding: 4px;
  opacity: 0.9;
  flex-shrink: 0;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--r-md);
  background: var(--sys-fill);
  color: var(--sys-label);
  font-size: 0.86rem;
  font-weight: 700;
  transition: all 0.2s var(--ease-ios);
  touch-action: manipulation;
  flex: 1 1 auto;
  border: 0.5px solid transparent;
}
.copy-btn svg { width: 16px; height: 16px; }
.copy-btn:active { transform: scale(0.95); background: var(--sys-fill-2); }
.copy-btn.copied {
  background: var(--ios-green);
  color: #fff;
  border-color: transparent;
}
.ios-btn-primary.copied {
  background: var(--ios-green);
  color: #fff;
}

/* =================== EMPTY =================== */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  border-radius: var(--r-xl);
  background: var(--sys-grouped-2);
  border: 0.5px dashed var(--sys-separator-opaque);
  animation: fadeInUp 0.4s var(--ease-out) both;
}
.empty .big {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 10px;
}
.empty h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sys-label);
}
.empty p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--sys-label-2);
  line-height: 1.7;
}

/* =================== iOS BOTTOM TAB BAR =================== */
.ios-tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  background: var(--glass-bg-strong);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 0.5px solid var(--sys-separator);
  box-shadow: 0 -8px 30px -12px rgba(0,0,0,0.2);
}
@media (min-width: 1180px) {
  .ios-tabbar {
    position: fixed;
    inset-inline: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: 22px;
    width: min(720px, 92%);
    border-radius: 32px;
    border-top: none;
    padding-inline: 8px;
    box-shadow:
      0 0 0 1px var(--sys-separator),
      0 20px 60px -12px rgba(0,0,0,0.35);
  }
}
.ios-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  min-height: 52px;
  border-radius: var(--r-sm);
  color: var(--sys-label-2);
  transition: color 0.2s var(--ease-ios), background 0.2s var(--ease-ios), transform 0.2s var(--ease-ios);
  touch-action: manipulation;
  position: relative;
}
.ios-tab svg {
  width: 24px; height: 24px;
  stroke-width: 1.9;
  transition: transform 0.3s var(--ease-spring);
}
.ios-tab span {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1;
}
.ios-tab:active { transform: scale(0.92); }
.ios-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.ios-tab.active svg {
  transform: translateY(-1px) scale(1.05);
  filter: drop-shadow(0 2px 6px var(--accent-soft));
}
@media (min-width: 1180px) {
  .ios-tab span { font-size: 0.68rem; }
}

/* =================== SEARCH OVERLAY — iOS modal =================== */
.ios-search-overlay {
  position: fixed;
  inset: 0;
  background: var(--sys-overlay);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-ios), visibility 0.25s linear;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 16px;
  display: block;
}
@media (min-width: 1180px) {
  .ios-search-overlay {
    border-radius: 32px;
    inset: 10vh 5vw;
    margin: 0 auto;
    max-width: 860px;
  }
}
.ios-search-overlay.open {
  opacity: 1;
  visibility: visible;
}
.ios-search-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.35s var(--ease-out) both;
}
.ios-search-field-wrap {
  position: relative;
  min-width: 0;
}
.ios-search-icon {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--sys-label-3);
  pointer-events: none;
}
.ios-search-clear {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--sys-fill-3);
  color: var(--sys-label-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.ios-search-clear svg { width: 14px; height: 14px; }
.ios-search-clear:active { opacity: 1; background: var(--sys-label-3); }

#search {
  width: 100%;
  padding: 12px 40px 12px 40px;
  min-height: 48px;
  border-radius: 14px;
  background: var(--sys-fill-2);
  color: var(--sys-label);
  font-size: 0.98rem;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  border: none;
  transition: all 0.2s var(--ease-ios);
  direction: rtl;
}
#search:focus {
  background: var(--sys-grouped-2);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 20px -6px rgba(0,0,0,0.15);
}
#search::placeholder { color: var(--sys-label-3); opacity: 1; font-weight: 400; }

.ios-search-scope {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--sys-fill);
  border-radius: 11px;
  min-height: 40px;
}
.ios-seg {
  padding: 8px 10px;
  min-height: 34px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sys-label);
  transition: all 0.2s var(--ease-ios);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.ios-seg:active { transform: scale(0.96); }
.ios-seg.active {
  background: var(--sys-grouped-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0.5px 0 rgba(255,255,255,0.4) inset;
  color: var(--accent);
}

.ios-search-cancel {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--sys-fill);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  transition: all 0.2s var(--ease-ios);
  width: 100%;
  touch-action: manipulation;
}
.ios-search-cancel:active { transform: scale(0.97); background: var(--sys-fill-2); }

/* =================== CATEGORIES BOTTOM SHEET =================== */
.ios-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--sys-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 400;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-ios), visibility 0.25s linear;
}
@media (min-width: 1180px) {
  .ios-sheet-backdrop {
    border-radius: 56px;
    inset: 20px;
    margin: 0 auto;
    max-width: 460px;
  }
}
.ios-sheet-backdrop.open { opacity: 1; visibility: visible; }

.ios-cats-sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 450;
  background: var(--sys-grouped-2);
  border-top-left-radius: var(--r-xxl);
  border-top-right-radius: var(--r-xxl);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-spring);
  box-shadow: 0 -12px 40px -10px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  max-height: 82dvh;
  max-height: 82vh;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1180px) {
  .ios-cats-sheet {
    inset-inline: 30px;
    margin: 0 auto;
    max-width: 400px;
    border-radius: var(--r-xxl);
    bottom: 50px;
  }
}
.ios-cats-sheet.open { transform: translateY(0); }

.ios-sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--sys-fill-3);
  border-radius: 999px;
  margin: 8px auto 0;
  flex-shrink: 0;
}
.ios-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 20px 8px;
  border-bottom: 0.5px solid var(--sys-separator);
  flex-shrink: 0;
}
.ios-sheet-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--sys-label);
  letter-spacing: -0.015em;
}
.ios-sheet-close {
  width: 32px; height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sys-fill);
  color: var(--sys-label-2);
  transition: all 0.2s var(--ease-ios);
  flex-shrink: 0;
}
.ios-sheet-close svg { width: 14px; height: 14px; opacity: 0.8; }
.ios-sheet-close:active { transform: scale(0.9); background: var(--sys-fill-2); }

.ios-cats-list {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 14px;
  flex: 1;
  min-height: 0;
}
.ios-cats-list .cat {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  min-height: 60px;
  border-radius: var(--r-md);
  color: var(--sys-label);
  background: transparent;
  transition: all 0.2s var(--ease-ios);
  touch-action: manipulation;
  position: relative;
  cursor: pointer;
}
.ios-cats-list .cat + .cat {
  border-top: 0.5px solid var(--sys-separator);
}
.ios-cats-list .cat::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent-soft);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.ios-cats-list .cat:active::after { opacity: 0.8; }
.ios-cats-list .cat:active { transform: scale(0.99); }

.ios-cats-list .cat .emoji {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  background: var(--sys-fill);
  border-radius: var(--r-xs);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring);
}
.ios-cats-list .cat:hover .emoji { transform: scale(1.08); }
.ios-cats-list .cat .count {
  direction: ltr;
  padding: 5px 11px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--sys-label-2);
  font-size: 0.74rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-text);
  min-width: 40px;
  flex-shrink: 0;
}
.ios-cats-list .cat span:not(.count):not(.emoji) {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sys-label);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ios-cats-list .cat.active .emoji {
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border);
}
.ios-cats-list .cat.active .count {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px -4px var(--accent-soft);
}

/* =================== TOAST — iOS HUD style =================== */
.ios-toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  inset-inline: auto;
  transform: translate(-50%, -140%);
  width: min(calc(100vw - 28px), 420px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--glass-bg-strong);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  color: var(--sys-label);
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.5s var(--ease-spring);
  border: 0.5px solid var(--sys-separator);
  box-shadow: 0 8px 28px -6px rgba(0,0,0,0.25);
  line-height: 1.4;
}
.ios-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
@media (min-width: 1180px) {
  .ios-toast { top: 40px; }
}
.ios-toast svg {
  width: 18px; height: 18px;
  color: var(--ios-green);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(52,199,89,0.35));
}

/* =================== FOOTER =================== */
.ios-footer-spacer { height: 8px; }
.ios-footer {
  text-align: center;
  padding: 10px 20px 0;
  color: var(--sys-label-3);
  font-size: 0.78rem;
  line-height: 1.8;
}
.ios-footer p { margin: 0 0 2px; }
.ios-footer a {
  color: var(--accent);
  font-weight: 700;
  padding-inline: 2px;
}
.ios-footer .ios-copy {
  font-size: 0.72rem;
  color: var(--sys-label-4);
  margin-top: 4px;
}

/* =================== SMALL PHONE TUNING (<= 380px) =================== */
@media (max-width: 380px) {
  :root { --tap: 44px; }
  .ios-main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .ios-large-title { padding-inline: 18px; }
  .ios-large-title h1 { font-size: 1.8rem; }
  .ios-toolbar-section, .ios-featured, .ios-grid-section { padding-inline: 16px; }
  .ios-chip-scroller { margin-inline: -16px; padding-inline: 16px; }
  .card { padding: 16px 16px 14px; border-radius: var(--r-lg); }
  .card-body { font-size: 0.96rem; min-height: 70px; }
  .ios-featured-card { padding: 18px 18px 16px; border-radius: var(--r-xl); }
  .ios-featured-title { font-size: 1.04rem; }
  .ios-featured-author > div:last-child > * { max-width: 120px; }
  .ios-btn-primary { padding: 8px 14px; font-size: 0.82rem; }
  .copy-btn { min-height: 42px; font-size: 0.82rem; padding: 8px 14px; }
  .ios-tab { min-height: 50px; }
  .ios-tab svg { width: 22px; height: 22px; }
  .ios-nav-inner { grid-template-columns: 44px 1fr 44px; }
  .ios-nav-btn { width: 44px; height: 44px; }
}

/* =================== STANDARD PHONE TUNING (381px — 640px) =================== */
@media (min-width: 381px) and (max-width: 640px) {
  .ios-large-title h1 { font-size: 2.1rem; }
}

/* =================== TABLET (iPad — 2 cols, 641–980) =================== */
@media (min-width: 641px) and (max-width: 1179px) {
  .ios-shell {
    max-width: 680px;
    margin: 0 auto;
    padding-inline: 4px;
  }
  .ios-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .ios-featured-card { padding: 26px 26px 22px; }
  .ios-featured-title { font-size: 1.2rem; }
  .ios-large-title h1 { font-size: 2.6rem; }
  .ios-section-title { font-size: 1.5rem; }
  .card { padding: 20px 20px 16px; }
}

/* =================== DESKTOP (MacBook / Laptop 1180–1680) 3 cols =================== */
@media (min-width: 1180px) and (max-width: 1679px) {
  .ios-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
  .card { padding: 22px 22px 18px; }
  .card-body { font-size: 1.05rem; line-height: 1.85; min-height: 90px; }
  .ios-featured {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
  }
  .ios-featured-card { padding: 28px 28px 22px; }
  .ios-featured-title { font-size: 1.28rem; }
  .ios-section-title { font-size: 1.55rem; }
}

/* =================== LARGE DESKTOP (≥ 1680px) 4 cols =================== */
@media (min-width: 1680px) {
  .ios-shell { max-width: 1680px; padding-inline: 40px; }
  .ios-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
  .card { padding: 24px 24px 20px; }
  .card-body { font-size: 1.08rem; line-height: 1.9; min-height: 100px; }
  .ios-featured {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 18px;
  }
  .ios-featured-card { padding: 32px 32px 26px; }
  .ios-featured-title { font-size: 1.35rem; }
  .ios-section-title { font-size: 1.65rem; }
  .ios-large-title h1 { font-size: clamp(2.8rem, 3.5vw, 3.8rem); }
}

/* =================== DESKTOP GLOBAL FIXES (≥ 1180px) =================== */
@media (min-width: 1180px) {
  /* Sheets / Modals: أوسع وأجمل على سطح المكتب */
  .ios-sheet-backdrop {
    border-radius: 32px;
    inset: 10vh 6vw;
    margin: 0 auto;
    max-width: 960px;
  }
  .ios-cats-sheet {
    inset-inline: auto;
    margin: 0 auto;
    left: 50%;
    transform: translate(-50%, 120%);
    max-width: 760px;
    width: min(88vw, 760px);
    max-height: 82vh;
    border-radius: 32px;
    bottom: auto;
    top: 50%;
  }
  .ios-cats-sheet.open { transform: translate(-50%, -50%); }
  .ios-alert-backdrop {
    border-radius: 32px;
    inset: 10vh 5vw;
    margin: 0 auto;
    max-width: 520px;
  }
  .ios-alert { max-width: 400px; padding: 26px 22px 16px; }
  .ios-toast { top: 28px; min-width: 340px; font-size: 0.86rem; }

  /* إخفاء شريط التمرير الوهمي (الإفتراضي)، وإضفة شريط جميل على سطح المكتب فقط */
  .ios-main::-webkit-scrollbar { width: 10px; display: block; }
  .ios-main::-webkit-scrollbar-track { background: transparent; }
  .ios-main::-webkit-scrollbar-thumb {
    background: var(--sys-fill-2);
    border-radius: 999px;
    border: 2px solid var(--sys-grouped);
  }
  .ios-main::-webkit-scrollbar-thumb:hover { background: var(--sys-fill-3); }
  .ios-main { scrollbar-width: thin; scrollbar-color: var(--sys-fill-2) transparent; }
}

/* =================== SETTINGS SHEET (Notifications/PWA) =================== */
.ios-setting-group {
  margin: 14px 18px 18px;
  padding: 10px 14px;
  background: var(--sys-grouped-2);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  border: 0.5px solid var(--sys-separator);
}
.ios-setting-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sys-label-2);
  margin: 4px 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ios-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px;
  border-top: 0.5px solid var(--sys-separator);
  min-height: 48px;
}
.ios-setting-row:first-of-type { border-top: none; }
.ios-setting-row .if-name { font-weight: 600; font-size: 0.94rem; }
.ios-setting-row .if-sub { color: var(--sys-label-2); font-size: 0.8rem; }

.ios-setting-row--link {
  width: calc(100% + 14px * 2);
  margin: 0 -14px;
  padding: 11px 14px;
  border-top: 0.5px solid var(--sys-separator);
  appearance: none;
  background: transparent;
  border-inline: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  border-radius: 0;
  transition: background 140ms ease;
}
.ios-setting-row--link:hover { background: rgba(0,122,255,0.05); }
.ios-setting-row--link:active { background: rgba(0,122,255,0.10); }
@media (prefers-color-scheme: dark) {
  .ios-setting-row--link:hover { background: rgba(10,132,255,0.10); }
  .ios-setting-row--link:active { background: rgba(10,132,255,0.18); }
}
.ios-setting-row--link + .ios-setting-row--link { border-top: 0.5px solid var(--sys-separator); }

.ios-setting-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.10);
}
.ios-setting-icon--tel  { background: linear-gradient(135deg, #34c759 0%, #30b350 100%); }
.ios-setting-icon--wa   { background: linear-gradient(135deg, #25d366 0%, #128c7e 100%); }
.ios-setting-icon--copy { background: linear-gradient(135deg, #007aff 0%, #0051d5 100%); }
.ios-setting-disclosure {
  color: #c7c7cc;
  flex-shrink: 0;
  margin-inline-start: 4px;
}
@media (prefers-color-scheme: dark) {
  .ios-setting-disclosure { color: #636366; }
}

/* iOS Switch (toggle) */
.ios-switch {
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--sys-fill-3);
  transition: background-color 0.25s var(--ease-ios);
  flex: 0 0 51px;
  min-height: 31px;
}
.ios-switch .knob {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.08);
  transition: transform 0.25s var(--ease-ios);
}
.ios-switch[aria-checked="true"] {
  background: var(--ios-green);
}
.ios-switch[aria-checked="true"] .knob {
  transform: translateX(calc(var(--is-rtl, 1) * 1px));
  inset-inline-start: auto;
  inset-inline-end: 2px;
}
[dir="rtl"] .ios-switch[aria-checked="true"] .knob { transform: translateX(0); }

/* Segmented row (small) */
.ios-seg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--sys-fill);
  border-radius: var(--r-md);
  margin: 2px 0 8px;
}
.ios-seg.small {
  font-size: 0.8rem;
  padding: 8px 6px;
  min-height: 38px;
  border-radius: var(--r-sm);
}

/* Number input */
.ios-num-input {
  width: 92px;
  min-height: 40px;
  border-radius: var(--r-sm);
  background: var(--sys-fill);
  border: 0.5px solid var(--sys-separator);
  color: var(--sys-label);
  text-align: start;
  padding: 0 12px;
  font-size: 0.94rem;
  font-family: inherit;
}
.ios-num-input:focus { outline: none; border-color: var(--accent); background: var(--sys-bg-2); }

/* Status dot (Service Worker health) */
.ios-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sys-fill-3);
  box-shadow: 0 0 0 2px var(--sys-fill);
  flex: 0 0 12px;
}
.ios-dot.on {
  background: var(--ios-green);
  box-shadow: 0 0 0 2px rgba(52,199,89,0.2);
  animation: pulseDot 1.8s var(--ease-out) infinite;
}
.ios-dot.off {
  background: var(--ios-red);
  box-shadow: 0 0 0 2px rgba(255,59,48,0.2);
}
@keyframes pulseDot {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.18); opacity: 0.85; }
}

/* 5 tabs fit fix */
@media (max-width: 380px) {
  .ios-tab span { font-size: 0.62rem; }
  .ios-tab svg { width: 20px; height: 20px; }
}
@media (max-width: 640px) {
  .ios-tabbar { grid-template-columns: repeat(5, 1fr); }
}

/* =================== SPLASH SCREEN (iOS Launch) =================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: linear-gradient(180deg, #f7f7fa 0%, #ececf1 100%);
  color: #1c1c1e;
  direction: rtl;
  transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
              visibility 420ms step-end;
  will-change: opacity, transform;
}
@media (prefers-color-scheme: dark) {
  .splash-screen {
    background: linear-gradient(180deg, #0b0b0f 0%, #16161b 100%);
    color: #f2f2f7;
  }
}

.splash-screen.hide {
  opacity: 0;
  transform: scale(1.04);
  visibility: hidden;
  transition-delay: 0ms, 0ms, 380ms;
}

.splash-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 28px 18px;
  border-radius: 32px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    0 30px 60px rgba(0,0,0,0.12),
    0 8px 24px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.65);
}
@media (prefers-color-scheme: dark) {
  .splash-inner {
    background: rgba(30, 30, 36, 0.55);
    box-shadow:
      0 30px 60px rgba(0,0,0,0.55),
      0 8px 24px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
  }
}

.splash-logo-wrap {
  position: relative;
  width: 132px;
  height: 156px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splashFloat 3.6s ease-in-out infinite;
}

.splash-logo-ring {
  position: absolute;
  inset: -6px;
  border-radius: 36px;
  background: conic-gradient(
    from 0deg,
    rgba(255,204,0,0.0) 0deg,
    rgba(255,204,0,0.55) 60deg,
    rgba(255,170,50,0.35) 120deg,
    rgba(255,204,0,0.0) 180deg,
    rgba(255,204,0,0.55) 240deg,
    rgba(255,170,50,0.35) 300deg,
    rgba(255,204,0,0.0) 360deg
  );
  filter: blur(8px);
  opacity: 0.8;
  animation: splashRingSpin 3.2s linear infinite;
}
.splash-logo-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 28px;
  background: #ffffff;
}
@media (prefers-color-scheme: dark) {
  .splash-logo-ring::after { background: #14141a; }
}

.splash-logo {
  position: relative;
  z-index: 2;
  width: 120px;
  height: 144px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(255,160,60,0.28))
          drop-shadow(0 2px 4px rgba(0,0,0,0.12));
  animation: splashPop 820ms cubic-bezier(0.22, 1, 0.36, 1) 160ms both;
}

.splash-logo-fallback {
  position: relative;
  z-index: 2;
  display: none;
  width: 120px;
  height: 144px;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  animation: splashPop 820ms cubic-bezier(0.22, 1, 0.36, 1) 160ms both;
}

.splash-title {
  font-weight: 800;
  font-size: 1.48rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
  color: #1c1c1e;
  animation: splashFadeUp 720ms cubic-bezier(0.22, 1, 0.36, 1) 360ms both;
}
@media (prefers-color-scheme: dark) {
  .splash-title { color: #f2f2f7; }
}

.splash-sub {
  margin-top: -10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #8e8e93;
  text-align: center;
  animation: splashFadeUp 720ms cubic-bezier(0.22, 1, 0.36, 1) 480ms both;
}

.splash-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 24px;
  margin-top: 4px;
  animation: splashFadeUp 720ms cubic-bezier(0.22, 1, 0.36, 1) 620ms both;
}
.spinner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffb020;
  box-shadow: 0 0 10px rgba(255,176,32,0.55);
  animation: splashDot 1.1s ease-in-out infinite;
}
.spinner-dot.d2 { animation-delay: 0.16s; background: #ff8a3c; box-shadow: 0 0 10px rgba(255,138,60,0.55); }
.spinner-dot.d3 { animation-delay: 0.32s; background: #ff5a5f; box-shadow: 0 0 10px rgba(255,90,95,0.5); }
@media (prefers-color-scheme: dark) {
  .spinner-dot    { background: #ffcc33; box-shadow: 0 0 12px rgba(255,204,51,0.55); }
  .spinner-dot.d2 { background: #ff9a44; box-shadow: 0 0 12px rgba(255,154,68,0.55); }
  .spinner-dot.d3 { background: #ff6b6e; box-shadow: 0 0 12px rgba(255,107,110,0.55); }
}

.splash-foot {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom));
  font-size: 0.78rem;
  font-weight: 500;
  color: #a1a1a6;
  letter-spacing: 0.08em;
  animation: splashFadeUp 900ms cubic-bezier(0.22, 1, 0.36, 1) 780ms both;
}
@media (prefers-color-scheme: dark) { .splash-foot { color: #636366; } }

/* ------- Splash keyframes ------- */
@keyframes splashFadeUp {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes splashPop {
  0%   { opacity: 0; transform: scale(0.62); }
  56%  { opacity: 1; transform: scale(1.07); }
  80%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
@keyframes splashFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -6px, 0); }
}
@keyframes splashRingSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes splashDot {
  0%, 80%, 100% { transform: scale(0.45); opacity: 0.45; }
  40%           { transform: scale(1.12); opacity: 1; }
}

/* =================== STANDALONE NOTIFICATION OPT-IN BANNER =================== */
.notif-banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  left: 10px;
  z-index: 99998;
  direction: rtl;
  padding: 10px 12px 14px;
  border-radius: 22px;
  background: rgba(250, 250, 252, 0.82);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  box-shadow:
    0 18px 42px rgba(0,0,0,0.20),
    0 5px 14px rgba(0,0,0,0.10),
    inset 0 1px 0 rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.65);
  color: #1c1c1e;
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition:
    opacity 360ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}
@media (prefers-color-scheme: dark) {
  .notif-banner {
    background: rgba(28, 28, 32, 0.80);
    box-shadow:
      0 22px 54px rgba(0,0,0,0.62),
      0 6px 16px rgba(0,0,0,0.38),
      inset 0 1px 0 rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    color: #f2f2f7;
  }
}

.notif-banner.notif-banner--hidden {
  opacity: 0;
  transform: translate3d(0, -130%, 0);
  pointer-events: none;
}

.notif-banner__head {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.notif-banner__icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
}
@media (prefers-color-scheme: dark) {
  .notif-banner__icon {
    background: #16161b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  }
}
.notif-banner__icon img {
  width: 36px;
  height: 43px;
  object-fit: contain;
  position: relative;
  z-index: 2;
}
.notif-banner__icon-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.notif-banner__titles {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.notif-banner__name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #3a3a3c;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
@media (prefers-color-scheme: dark) {
  .notif-banner__name { color: #c7c7cc; }
}
.notif-banner__time {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8e8e93;
  flex-shrink: 0;
}
.notif-banner__chevron {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(142, 142, 147, 0.18);
  color: #8e8e93;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  padding: 0;
  flex-shrink: 0;
}

.notif-banner__body { padding: 2px 2px 0; }
.notif-banner__title {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.notif-banner__msg {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.42;
  color: #3a3a3c;
  max-height: 3.6em;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .notif-banner__msg { color: #e5e5ea; }
}

.notif-banner__actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 8px;
}
.notif-banner__btn {
  appearance: none;
  border: none;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 180ms ease;
  color: #007aff;
  background: rgba(0,122,255,0.12);
  font-family: inherit;
}
.notif-banner__btn--ghost {
  color: #3a3a3c;
  background: rgba(118, 118, 128, 0.16);
}
@media (prefers-color-scheme: dark) {
  .notif-banner__btn--ghost {
    color: #e5e5ea;
    background: rgba(142, 142, 147, 0.24);
  }
}
.notif-banner__btn--primary {
  background: #007aff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,122,255,0.32);
}
.notif-banner__btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.notif-banner__handle {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: rgba(142,142,147,0.35);
}

@media (max-width: 380px) {
  .notif-banner { border-radius: 18px; padding: 9px 10px 12px; }
  .notif-banner__title { font-size: 0.92rem; }
  .notif-banner__msg { font-size: 0.80rem; }
  .notif-banner__btn { padding: 9px 12px; font-size: 0.82rem; }
}

/* =================== REDUCED MOTION =================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:active, .ios-nav-btn:active, .ios-btn-primary:active { transform: none !important; }
}

/* =================== 6-COLUMN TAB BAR (المفضلة أُضيفت كـ Tab 6) =================== */
.ios-tabbar {
  grid-template-columns: repeat(6, 1fr);
}
@media (max-width: 640px) {
  .ios-tabbar { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 420px) {
  .ios-tab span { font-size: 0.58rem; font-weight: 800; letter-spacing: 0; }
  .ios-tab svg { width: 20px; height: 20px; stroke-width: 2; }
  .ios-tab { padding: 4px 1px; min-height: 48px; gap: 2px; }
}

/* =================== CARD ACTIONS (نسخ / مشاركة / قلب) =================== */
.card-actions {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}
@media (max-width: 380px) {
  .card-actions { grid-template-columns: 40px 1fr 1fr; gap: 5px; }
}
.card .copy-btn {
  flex: 1 1 auto;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 0.80rem;
  border-radius: 12px;
  gap: 5px;
  justify-content: center;
}
.card .copy-btn svg { width: 14px; height: 14px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  min-height: 42px;
  border-radius: 12px;
  background: var(--sys-fill);
  color: var(--sys-label);
  font-size: 0.80rem;
  font-weight: 700;
  transition: all 0.2s var(--ease-ios);
  touch-action: manipulation;
  border: 0.5px solid transparent;
  flex: 1 1 auto;
}
.share-btn svg { width: 14px; height: 14px; }
.share-btn:active { transform: scale(0.95); background: var(--sys-fill-2); }
.share-btn .lbl { white-space: nowrap; }
@media (max-width: 380px) {
  .share-btn, .card .copy-btn { padding: 7px 8px; min-height: 40px; font-size: 0.76rem; }
  .share-btn .lbl { display: none; }
  .card .copy-btn .lbl { display: none; }
  .share-btn, .card .copy-btn { justify-content: center; padding-inline: 0; }
}

/* =================== FAV BUTTON (قلب البطاقة) =================== */
.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 12px;
  background: var(--sys-fill);
  transition: all 0.22s var(--ease-spring);
  touch-action: manipulation;
  position: relative;
  border: 0.5px solid transparent;
  flex-shrink: 0;
  padding: 0;
}
.fav-btn svg {
  width: 18px;
  height: 18px;
  position: absolute;
  transition: all 0.24s var(--ease-spring);
  color: var(--sys-label-2);
}
.fav-btn .fav-icon--fill {
  opacity: 0;
  transform: scale(0.4);
}
.fav-btn .fav-icon--line {
  opacity: 1;
  transform: scale(1);
}
.fav-btn:active { transform: scale(0.9); }
.fav-btn.on {
  background: rgba(255,59,48,0.10);
  border-color: rgba(255,59,48,0.25);
}
.fav-btn.on .fav-icon--line {
  opacity: 0;
  transform: scale(1.6);
}
.fav-btn.on .fav-icon--fill {
  opacity: 1;
  transform: scale(1);
}
@media (max-width: 380px) {
  .fav-btn { width: 38px; height: 38px; min-height: 38px; border-radius: 10px; }
  .fav-btn svg { width: 16px; height: 16px; }
}

/* =================== SEARCH HISTORY (آخر البحوث) =================== */
.ios-search-history {
  margin-top: 4px;
  background: var(--sys-grouped-2);
  border-radius: 14px;
  border: 0.5px solid var(--sys-separator);
  overflow: hidden;
  animation: fadeInUp 0.3s var(--ease-out) both;
}
.ios-search-history__label {
  padding: 10px 14px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sys-label-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ios-search-history__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 10px 12px;
}
.ios-search-history__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--sys-fill);
  color: var(--sys-label);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease-ios);
  touch-action: manipulation;
  border: none;
  font-family: inherit;
}
.ios-search-history__item:active { transform: scale(0.95); background: var(--sys-fill-2); }
.ios-search-history__item svg {
  width: 12px; height: 12px;
  color: var(--sys-label-3);
}

/* =================== GRID TRANSITIONS (Fade + Slide — Feature 20) =================== */
.grid.hiding {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 120ms var(--ease-ios), transform 120ms var(--ease-ios);
  pointer-events: none;
}
.grid.ready {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms var(--ease-out), transform 260ms var(--ease-spring);
}
.grid.ready .card {
  animation: cardIn 0.42s var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =================== PULL TO REFRESH (Feature 11) =================== */
.ios-ptr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 0;
  overflow: hidden;
  transition: height 0.2s var(--ease-ios), padding 0.2s var(--ease-ios);
  will-change: height;
  color: var(--sys-label-2);
  user-select: none;
  -webkit-user-select: none;
}
.ios-ptr.active {
  height: 72px;
  padding: 10px 0 8px;
}
.ios-ptr.loading .ios-ptr__spinner {
  animation: ptrSpin 0.8s linear infinite;
}
.ios-ptr__spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--sys-fill-3);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
}
@keyframes ptrSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.ios-ptr__label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--sys-label-3);
  letter-spacing: 0.01em;
}

/* =================== PUSH HISTORY LIST (Feature 19 الواجهة) =================== */
.push-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--sys-separator);
  border-radius: 12px;
  overflow: hidden;
}
.push-history-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--sys-grouped-2);
}
.push-history-list li:first-child { border-radius: 12px 12px 0 0; }
.push-history-list li:last-child  { border-radius: 0 0 12px 12px; }
.push-history-list li:only-child { border-radius: 12px; }
.push-history__icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.82rem;
}
.push-history__icon.ok   { background: rgba(52,199,89,0.16); color: var(--ios-green); }
.push-history__icon.fail { background: rgba(255,59,48,0.14); color: var(--ios-red); }
.push-history__text {
  min-width: 0;
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--sys-label);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.push-history__text .sub {
  display: block;
  font-size: 0.70rem;
  color: var(--sys-label-3);
  margin-top: 2px;
  font-weight: 500;
}
.push-history__time {
  font-size: 0.70rem;
  color: var(--sys-label-3);
  font-weight: 600;
  flex-shrink: 0;
  margin-inline-start: 6px;
  white-space: nowrap;
}

/* =================== RATE APP MODAL (iOS Alert — Feature 17) =================== */
.ios-alert-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-ios), visibility 0.25s step-end;
}
.ios-alert-backdrop[hidden="false"],
.ios-alert-backdrop:not([hidden]) {
  /* hidden attribute takes precedence, we toggle via class too */
}
.ios-alert-backdrop.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s var(--ease-ios), visibility 0s;
}
@media (min-width: 1180px) {
  .ios-alert-backdrop {
    border-radius: 56px;
    inset: 20px;
    margin: 0 auto;
    max-width: 460px;
  }
}
.ios-alert {
  width: 100%;
  max-width: 320px;
  background: var(--glass-bg-strong);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border-radius: 22px;
  border: 0.5px solid var(--glass-stroke);
  box-shadow: 0 20px 60px -12px rgba(0,0,0,0.45), 0 8px 24px -8px rgba(0,0,0,0.25);
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(1.08);
  opacity: 0;
  transition: transform 0.3s var(--ease-spring), opacity 0.25s var(--ease-ios);
  color: var(--sys-label);
}
.ios-alert-backdrop.show .ios-alert {
  transform: scale(1);
  opacity: 1;
}
.ios-alert__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 4px 4px 0;
}
.ios-alert__logo {
  width: 52px; height: 52px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ios-alert__logo img {
  width: 44px; height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(255,160,60,0.28));
}
.ios-alert__logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.ios-alert__head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.ios-alert__msg {
  margin: 0;
  font-size: 0.82rem;
  color: var(--sys-label-2);
  line-height: 1.45;
}
.ios-alert__stars {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 4px;
}
.ios-alert__star {
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring);
  touch-action: manipulation;
}
.ios-alert__star svg {
  width: 32px;
  height: 32px;
  color: var(--sys-fill-3);
  transition: all 0.2s var(--ease-spring);
}
.ios-alert__star:active { transform: scale(0.9); }
.ios-alert__star.on svg,
.ios-alert__star.highlight svg {
  color: #ffcc00;
  fill: #ffcc00;
  filter: drop-shadow(0 2px 6px rgba(255,204,0,0.45));
}
.ios-alert__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 6px;
  border-top: 0.5px solid var(--sys-separator);
  margin: 2px -18px -12px;
  padding-inline: 18px;
  padding-block: 12px 10px;
}
.ios-alert__btn {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s var(--ease-ios);
  touch-action: manipulation;
}
.ios-alert__btn:active { transform: scale(0.97); }
.ios-alert__btn--cancel {
  background: var(--sys-fill);
  color: var(--sys-label);
}
.ios-alert__btn--ok {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px -4px var(--accent-soft);
}
.ios-alert__btn--ok[disabled] {
  background: var(--sys-fill-2);
  color: var(--sys-label-3);
  box-shadow: none;
  cursor: not-allowed;
}

/* =================== FONT SCALE (Feature 10) — متغيرات حجم الخط =================== */
:root {
  --font-scale: 1;
}
body[data-font-size="s"]   { --font-scale: 0.90; }
body[data-font-size="m"]   { --font-scale: 1; }
body[data-font-size="l"]   { --font-scale: 1.12; }
body[data-font-size="xl"]  { --font-scale: 1.26; }
.card-body       { font-size: calc(1rem * var(--font-scale)); line-height: calc(1.85 / var(--font-scale)); }
.ios-featured-title { font-size: calc(clamp(1.1rem, 4.2vw, 1.3rem) * var(--font-scale)); }
.ios-large-subtitle { font-size: calc(0.92rem * var(--font-scale)); line-height: calc(1.6 / var(--font-scale)); }
.notif-banner__msg { font-size: calc(0.84rem * var(--font-scale)); }
.if-name { font-size: calc(0.82rem * var(--font-scale)); }
.ios-section-title { font-size: calc(1.3rem * var(--font-scale)); }

/* =================== CARD SKINS (Feature 15) — 4 أنماط للبطاقات =================== */
body[data-skin="white"] .card,
body[data-skin="vintage"] .card,
body[data-skin="gold"] .card,
body[data-skin="palestine"] .card {
  transition: background 0.35s var(--ease-ios), border-color 0.35s var(--ease-ios), color 0.35s var(--ease-ios);
}
body[data-skin="vintage"] .card {
  background:
    radial-gradient(600px 400px at 100% 0%, rgba(200,160,100,0.10), transparent 55%),
    linear-gradient(180deg, #f8f2e4 0%, #f0e4cc 100%);
  border-color: rgba(170,130,80,0.28);
  color: #3a2a10;
  box-shadow: 0 2px 10px rgba(120,80,30,0.06), 0 8px 28px rgba(120,80,30,0.10);
}
body[data-skin="vintage"] .card .card-body { color: #3a2a10; }
body[data-skin="vintage"] .card .card-body::before,
body[data-skin="vintage"] .card .card-body::after { color: rgba(120,80,30,0.25); }
body[data-skin="vintage"] .card .cat-pill {
  background: rgba(150,100,50,0.14);
  color: #704010;
}
body[data-skin="vintage"] .card .index-badge {
  background: rgba(150,100,50,0.14);
  color: #704010;
}
body[data-skin="vintage"] .card .tag-mini {
  background: rgba(150,100,50,0.12);
  color: #603808;
}
@media (prefers-color-scheme: dark) {
  body[data-skin="vintage"] .card {
    background: linear-gradient(180deg, #2a2218 0%, #33281c 100%);
    border-color: rgba(200,160,100,0.18);
    color: #f0e0c0;
  }
  body[data-skin="vintage"] .card .card-body { color: #f0e0c0; }
  body[data-skin="vintage"] .card .cat-pill,
  body[data-skin="vintage"] .card .index-badge,
  body[data-skin="vintage"] .card .tag-mini { background: rgba(200,160,100,0.12); color: #e0c890; }
}
body[data-skin="gold"] .card {
  background:
    linear-gradient(135deg, rgba(255,204,0,0.08), transparent 50%),
    linear-gradient(315deg, rgba(255,150,50,0.06), transparent 50%),
    var(--sys-grouped-2);
  border-color: rgba(255,204,0,0.30);
  box-shadow: 0 2px 10px rgba(255,180,0,0.08), 0 8px 28px rgba(255,180,0,0.10);
}
body[data-skin="gold"] .card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,204,0,0.45), rgba(255,180,100,0.18) 40%, transparent 65%, rgba(255,204,0,0.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
  opacity: 0.7;
}
body[data-skin="gold"] .card .cat-pill {
  background: rgba(255,204,0,0.14);
  color: #aa7700;
}
@media (prefers-color-scheme: dark) {
  body[data-skin="gold"] .card .cat-pill { color: #ffcc44; }
}
body[data-skin="palestine"] .card {
  background: var(--sys-grouped-2);
  border-color: rgba(0,120,60,0.30);
  position: relative;
  overflow: hidden;
}
body[data-skin="palestine"] .card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #107c41 0%, #107c41 33%, #ffffff 33%, #ffffff 66%, #000000 66%, #000000 100%);
  opacity: 0.75;
}
body[data-skin="palestine"] .card::after {
  content: "";
  position: absolute;
  inset-inline-start: 10px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-inline-start: 16px solid #e4002b;
  opacity: 0.18;
  pointer-events: none;
}
body[data-skin="palestine"] .card > * { position: relative; z-index: 1; }
body[data-skin="palestine"] .card .cat-pill {
  background: rgba(16,124,65,0.14);
  color: #0d6533;
}
@media (prefers-color-scheme: dark) {
  body[data-skin="palestine"] .card .cat-pill { color: #4ade80; }
}

/* =================== PRINT =================== */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .ios-tabbar, .ios-nav, .ios-search-overlay, .ios-cats-sheet,
  .ios-sheet-backdrop, .toast, .copy-btn, .ios-featured,
  .ios-chip-scroller, .ios-text-btn, .promos { display: none !important; }
  .ios-shell { box-shadow: none !important; max-width: none !important; border-radius: 0 !important; }
  .card { break-inside: avoid; border: 1px solid #ddd !important; box-shadow: none !important; background: #fff !important; }
  .ios-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =================== SOCIAL PROMOS (Telegram + Instagram) — SIDE BY SIDE =================== */
.promos {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px 4px;
  background: transparent;
}
.tg-promo, .ig-promo {
  display: block;
  animation: promosIn 420ms cubic-bezier(0.22,1,0.36,1) both;
}
.ig-promo { animation-delay: 140ms; }
@keyframes promosIn {
  from { opacity: 0; transform: translate3d(0,-14px,0); }
  to { opacity: 1; transform: translate3d(0,0,0); }
}
.tg-promo--hidden, .ig-promo--hidden { display: none !important; }

/* ====== Card (shared compact layout) ====== */
.promos__card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px 11px 12px;
  color: #fff;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.tg-promo__inner {
  background: linear-gradient(135deg, #229ed9 0%, #2aabee 52%, #40b8ff 100%);
  box-shadow:
    0 12px 28px rgba(34,158,217,0.24),
    0 4px 12px rgba(0,0,0,0.10),
    inset 0 1px 0 rgba(255,255,255,0.28);
}
.ig-promo__inner {
  background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  box-shadow:
    0 12px 28px rgba(131,58,180,0.22),
    0 4px 12px rgba(253,29,29,0.14),
    inset 0 1px 0 rgba(255,255,255,0.28);
}
@media (prefers-color-scheme: dark) {
  .tg-promo__inner {
    box-shadow:
      0 16px 36px rgba(34,158,217,0.30),
      0 6px 18px rgba(0,0,0,0.55),
      inset 0 1px 0 rgba(255,255,255,0.22);
  }
  .ig-promo__inner {
    box-shadow:
      0 16px 36px rgba(131,58,180,0.28),
      0 6px 18px rgba(0,0,0,0.55),
      inset 0 1px 0 rgba(255,255,255,0.20);
  }
}
.tg-promo__inner::after {
  content: "";
  position: absolute;
  inset: -30% -20% auto auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle at 60% 40%, rgba(255,255,255,0.22), rgba(255,255,255,0) 60%);
  pointer-events: none;
}
.ig-promo__inner::after {
  content: "";
  position: absolute;
  inset: auto -12% -36% -8%;
  width: 260px; height: 260px;
  background: radial-gradient(circle at 40% 60%, rgba(255,255,255,0.18), rgba(255,255,255,0) 62%);
  pointer-events: none;
  transform: rotate(-14deg);
}

/* ====== Icon ====== */
.promos__icon {
  width: 40px; height: 40px;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.14);
  position: relative;
  z-index: 2;
}
.tg-promo__icon { color: #229ed9; }
.ig-promo__icon { color: #d62976; }

/* ====== Body text ====== */
.promos__body { min-width: 0; position: relative; z-index: 2; }
.promos__eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
  margin-bottom: 2px;
  opacity: 0.94;
}
.promos__title {
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.1px;
  color: #fff;
  margin-bottom: 2px;
}
.promos__title b { color: #fff7cc; font-weight: 900; }
.promos__sub {
  font-size: 10.5px;
  line-height: 1.35;
  color: rgba(255,255,255,0.92);
  opacity: 0.9;
}

/* ====== CTA Button ====== */
.promos__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11.5px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  position: relative;
  z-index: 2;
  margin-inline-start: 4px;
  white-space: nowrap;
}
.tg-promo__btn { color: #229ed9; }
.tg-promo__btn:hover { background: #f7fbff; transform: translateY(-1px); }
.ig-promo__btn { color: #d62976; }
.ig-promo__btn:hover { background: #fff7fb; transform: translateY(-1px); }
.promos__btn:active { transform: scale(0.96); }

/* ====== Close button ====== */
.promos__close {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.24);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  backdrop-filter: blur(6px);
  transition: background 160ms ease, transform 160ms ease;
}
.promos__close:hover { background: rgba(255,255,255,0.34); }
.promos__close:active { transform: scale(0.92); }

/* ====== Responsive: Mobile → stack them in 1 column (just slightly bigger) ====== */
@media (max-width: 640px) {
  .promos {
    grid-template-columns: 1fr;
    padding: 10px 12px 2px;
    gap: 8px;
  }
  .promos__card {
    grid-template-columns: 40px 1fr auto;
    padding: 10px 10px 10px 11px;
  }
  .promos__icon { width: 40px; height: 40px; }
  .promos__title { font-size: 12.5px; }
  .promos__sub { font-size: 10.5px; }
  .promos__btn { padding: 7px 11px; font-size: 11px; }
}

/* If one promo is hidden, the other takes full width on desktop too */
.promos:has(.tg-promo--hidden),
.promos:has(.ig-promo--hidden) {
  grid-template-columns: 1fr;
}
