/* ═══════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════ */
:root {
  --font: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colours */
  --bg: #ffffff;
  --text: #000000;
  --text-secondary: #868686;
  --skeleton: #f2f2f7;
  --text-primary: var(--text);
  --border-radius-circular: 50%;

  /* Safe area */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);

  /* Radii */
  --r-card: 32px;
  --r-menu: 32px;
  --r-drawer: 24px;

  /* Transitions */
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-smooth: cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows — standard (sRGB) */
  --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.05);
  --shadow-menu: 0px 8px 48px rgba(0, 0, 0, 0.25),
                 inset 0px -2px 6px rgba(255, 255, 255, 0.73),
                 inset 0px 2px 6px rgba(255, 255, 255, 1);
  --shadow-detail: 0 35px 70px rgba(0, 0, 0, 0.25),
                   0 15px 35px var(--glow-color, rgba(0, 0, 0, 0.15));
  --shadow-drawer: 0 -10px 40px rgba(0, 0, 0, 0.1);

  /* Layout */
  --header-h: calc(var(--sat) + 64px);
  --grid-pad: 24px;
  --grid-gap: 24px;
}

/* P3 wide-gamut upgrade (Safari / modern displays) */
@supports (color: color(display-p3 1 1 1)) {
  :root {
    --shadow-menu: 0px 8px 48px color(display-p3 0 0 0 / 0.25),
                   inset 0px -2px 6px color(display-p3 1 1 1 / 0.73),
                   inset 0px 2px 6px color(display-p3 1 1 1);
  }
}

/* ═══════════════════════════════════════════════
   DARK MODE (System)
   ═══════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --text-secondary: #98989f;
    --skeleton: #1c1c1e;
    --text-primary: var(--text);

    --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.3);
    --shadow-menu: 0px 8px 48px rgba(0, 0, 0, 0.5),
                   inset 0px -2px 6px rgba(255, 255, 255, 0.06),
                   inset 0px 2px 6px rgba(255, 255, 255, 0.08);
    --shadow-detail: 0 35px 70px rgba(0, 0, 0, 0.5),
                     0 15px 35px var(--glow-color, rgba(0, 0, 0, 0.3));
    --shadow-drawer: 0 -10px 40px rgba(0, 0, 0, 0.4);
  }

  /* Header blur */
  .header-blur::after {
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.78) 40%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  /* Glass buttons (filter + detail circle buttons) */
  .filter-btn,
  .detail-circle-btn {
    color: var(--text);
  }

  .filter-btn:active,
  .detail-circle-btn:active {
    background-color: rgba(255, 255, 255, 0.18);
  }

  /* Glass menus (filter + options) */
  .filter-menu,
  .options-menu {
    background: rgba(44, 44, 46, 0.72);
    border-color: rgba(255, 255, 255, 0.1);
  }

  @supports (color: color(display-p3 1 1 1)) {
    .filter-menu,
    .options-menu {
      background: color(display-p3 0.17 0.17 0.18 / 0.72);
      border-color: color(display-p3 1 1 1 / 0.1);
    }
  }

  /* Menu items */
  .filter-item:active,
  .options-item:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .filter-separator {
    background: rgba(255, 255, 255, 0.12);
  }

  /* Download button */
  .download-btn:active {
    background: #2c2c2e;
  }

  /* Drawer handle */
  .drawer-handle {
    background: rgba(255, 255, 255, 0.2);
  }

  /* About row borders */
  .about-row {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  /* Toast */
  .ios-toast {
    background: rgba(60, 60, 67, 0.82);
  }

  @supports (backdrop-filter: blur(20px)) {
    .ios-toast {
      background: rgba(60, 60, 67, 0.72);
      border-color: rgba(255, 255, 255, 0.08);
    }
  }

  /* Copyright modal */
  .copyright-modal {
    background: rgba(44, 44, 46, 0.95);
  }

  .copyright-modal-title,
  .copyright-modal-text {
    color: #ffffff;
  }

  .copyright-modal-actions {
    border-top-color: rgba(255, 255, 255, 0.15);
  }

  .copyright-modal-btn.copy-btn {
    color: #0a84ff;
    border-right-color: rgba(255, 255, 255, 0.15);
  }

  .copyright-modal-btn.cancel-btn {
    color: #0a84ff;
  }

  .copyright-modal-btn:active {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Options copyright red */
  .options-item.copyright-report {
    color: #ff453a;
  }

  /* Skeleton shimmer */
  .card.loading::after {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.04) 50%,
      transparent 100%
    );
  }
}

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -ms-overflow-style: none;
  scrollbar-width: none;
  animation: pageIn 0.5s ease;
}

body::-webkit-scrollbar { display: none; }

@keyframes pageIn {
  from { opacity: 0; }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

img {
  display: block;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════
   HEADER  (fixed + progressive blur)
   ═══════════════════════════════════════════════ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  pointer-events: none;
}

.header-blur {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Pseudo-element for color tint overlay */
.header-blur::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.78) 40%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}

.header-blur div {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 5 layers of overlapping blur with different gradient falloffs */
.header-blur div:nth-child(1) {
  backdrop-filter: blur(2px) saturate(110%);
  -webkit-backdrop-filter: blur(2px) saturate(110%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.header-blur div:nth-child(2) {
  backdrop-filter: blur(4px) saturate(120%);
  -webkit-backdrop-filter: blur(4px) saturate(120%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 75%);
}

.header-blur div:nth-child(3) {
  backdrop-filter: blur(8px) saturate(130%);
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 55%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 55%);
}

.header-blur div:nth-child(4) {
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 35%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 35%);
}

.header-blur div:nth-child(5) {
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  mask-image: linear-gradient(to bottom, black 0%, transparent 20%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 20%);
}

.header-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 24px) 0 20px;
  pointer-events: auto;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   FILTER BUTTON
   ═══════════════════════════════════════════════ */
.filter-btn {
  position: absolute;
  right: var(--grid-pad);
  top: calc(var(--sat) + 12px);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  z-index: 10;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
  
  /* User Custom Glass Styling */
  background: rgba(255, 255, 255, 0.1);
  background: color(display-p3 1.000 1.000 1.000 / 0.1);
  background-blend-mode: lighten;
  border: none;
  box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.02), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.17), inset 0px -2px 6px rgba(255, 255, 255, 0.73), inset 0px 2px 6px #FFFFFF;
  box-shadow: 0px 8px 15px color(display-p3 0.000 0.000 0.000 / 0.02), 0px 0px 0px 0.5px color(display-p3 0.000 0.000 0.000 / 0.17), inset 0px -2px 6px color(display-p3 1.000 1.000 1.000 / 0.73), inset 0px 2px 6px color(display-p3 1.000 1.000 1.000);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 34px;
}

.filter-btn:active {
  transform: scale(0.96);
  background-color: rgba(220, 220, 225, 0.85);
}

/* ═══════════════════════════════════════════════
   FILTER MENU  (glassmorphism popover)
   ═══════════════════════════════════════════════ */
.filter-menu {
  position: fixed;
  top: calc(var(--sat) + 62px);
  right: var(--grid-pad);
  min-width: 190px;
  z-index: 150;
  border-radius: var(--r-menu);
  overflow: hidden;

  /* Glass — sRGB fallback */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  box-shadow: var(--shadow-menu);

  /* Hidden by default */
  opacity: 0;
  transform: scale(0.92);
  transform-origin: calc(100% - 22px) -28px;
  pointer-events: none;
  transition: opacity 0.14s cubic-bezier(0.23, 1, 0.32, 1), transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
  will-change: opacity, transform;
}

/* P3 glass upgrade */
@supports (color: color(display-p3 1 1 1)) {
  .filter-menu {
    background: color(display-p3 1 1 1 / 0.72);
    border-color: color(display-p3 0 0 0 / 0.18);
  }
}

.filter-menu.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
}

.filter-backdrop.open {
  display: block;
}

.filter-menu-list {
  padding: 5px 0;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  font-size: 17px;
  font-weight: 400;
  text-align: left;
  transition: background 0.1s ease;
  position: relative;
}

.filter-item:active {
  background: rgba(0, 0, 0, 0.08);
}

.filter-item.active-cat {
  font-weight: 600;
}

.filter-separator {
  height: 0.5px;
  background: rgba(0, 0, 0, 0.12);
  margin: 4px 0 4px 18px;
}

.filter-about-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--skeleton);
  flex-shrink: 0;
}

.filter-about-icon svg {
  width: 14px;
  height: 14px;
}

/* ═══════════════════════════════════════════════
   MAIN GRID
   ═══════════════════════════════════════════════ */
.main {
  padding: calc(var(--header-h) + 24px) var(--grid-pad) calc(var(--sab) + 24px);
  max-width: 1200px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid-gap);
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ═══════════════════════════════════════════════
   WALLPAPER CARDS
   ═══════════════════════════════════════════════ */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  position: relative;
  border-radius: var(--r-card);
  overflow: hidden;
  aspect-ratio: 3 / 4.5;
  background: var(--skeleton);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  will-change: transform;
  transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1);

  /* Staggered entrance — --i is set per card from JS */
  animation: cardIn 380ms cubic-bezier(0.23, 1, 0.32, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.card:active {
  transform: scale(0.97);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;

  /* Smooth image reveal */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card img.loaded {
  opacity: 1;
}

/* Skeleton shimmer */
.card.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 70%
  );
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════
   DETAIL OVERLAY
   ═══════════════════════════════════════════════ */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}

.detail-overlay.active {
  visibility: visible;
  pointer-events: auto;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.detail-overlay.active .detail-backdrop {
  opacity: 1;
}

.detail-view {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: var(--sat);
}

/* Detail header */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.22s ease 0.08s, transform 0.32s var(--spring) 0.08s;
}

.detail-overlay.active .detail-header {
  opacity: 1;
  transform: translateY(0);
}

.detail-overlay.closing .detail-header {
  opacity: 0 !important;
  transition: opacity 0.18s ease !important;
}

.detail-circle-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);

  /* User Custom Glass Styling */
  background: rgba(255, 255, 255, 0.1);
  background: color(display-p3 1.000 1.000 1.000 / 0.1);
  background-blend-mode: lighten;
  border: none;
  box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.02), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.17), inset 0px -2px 6px rgba(255, 255, 255, 0.73), inset 0px 2px 6px #FFFFFF;
  box-shadow: 0px 8px 15px color(display-p3 0.000 0.000 0.000 / 0.02), 0px 0px 0px 0.5px color(display-p3 0.000 0.000 0.000 / 0.17), inset 0px -2px 6px color(display-p3 1.000 1.000 1.000 / 0.73), inset 0px 2px 6px color(display-p3 1.000 1.000 1.000);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 34px;
}

.detail-circle-btn:active {
  transform: scale(0.96);
  background-color: rgba(220, 220, 225, 0.85);
}

.detail-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.detail-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.detail-creator {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-decoration: none;
}

/* Detail image */
.detail-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 28px;
  touch-action: none;
}



/* Detail footer */
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px calc(var(--sab) + 24px);
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease 0.12s, transform 0.32s var(--spring) 0.12s;
}

.detail-overlay.active .detail-footer {
  opacity: 1;
  transform: translateY(0);
}

.detail-overlay.closing .detail-footer {
  opacity: 0 !important;
  transition: opacity 0.18s ease !important;
}

.download-btn {
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
  text-align: center;
  transition: transform 150ms ease-out, background 150ms ease-out;

  /* User Custom Glass Styling */
  background: rgba(255, 255, 255, 0.1);
  background: color(display-p3 1.000 1.000 1.000 / 0.1);
  background-blend-mode: lighten;
  border: none;
  box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.02), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.17), inset 0px -2px 6px rgba(255, 255, 255, 0.73), inset 0px 2px 6px #FFFFFF;
  box-shadow: 0px 8px 15px color(display-p3 0.000 0.000 0.000 / 0.02), 0px 0px 0px 0.5px color(display-p3 0.000 0.000 0.000 / 0.17), inset 0px -2px 6px color(display-p3 1.000 1.000 1.000 / 0.73), inset 0px 2px 6px color(display-p3 1.000 1.000 1.000);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 34px;
}

.download-btn:active {
  transform: scale(0.94);
  background: #dddde2;
}

.detail-image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  max-height: 100%;
}

.detail-image-glow {
  position: absolute;
  top: 16px;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: blur(28px) saturate(160%);
  opacity: 0.55;
  z-index: -1;
  pointer-events: none;
  border-radius: var(--r-card);
  transform: scale(0.96);
  will-change: opacity, transform;
  transition: opacity 0.3s ease;
}

.detail-image {
  width: auto;
  max-width: 100%;
  max-height: calc(100dvh - var(--sat) - var(--sab) - 160px);
  object-fit: contain;
  border-radius: var(--r-card);
  transform-origin: center center;
  will-change: transform;
}

.detail-ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 10;
  border-radius: var(--r-card);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-ui-overlay.visible {
  opacity: 1;
}

.ui-toggle-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 99px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  user-select: none;
  border: none;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15), 0px 0px 0px 0.5px rgba(255, 255, 255, 0.15);
}

.ui-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.02);
}

.ui-toggle-btn:active {
  transform: scale(0.95);
}

.ui-toggle-btn.active {
  background: #ffffff;
  color: #000000;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0px 0px 0px 0.5px rgba(255, 255, 255, 1);
}

@media (prefers-color-scheme: light) {
  .ui-toggle-btn {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.08), 0px 0px 0px 0.5px rgba(255, 255, 255, 0.3);
    color: #ffffff;
  }
  .ui-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.35);
  }
  .ui-toggle-btn.active {
    background: #ffffff;
    color: #000000;
  }
}

.detail-ui-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 19.5;
  z-index: 10;
  border-radius: var(--r-card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 20px 32px;
  box-sizing: border-box;
}

.detail-ui-fallback.visible {
  opacity: 1;
}

.ios-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ios-status-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ios-status-right svg {
  display: block;
}

.ios-lock-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ffffff;
  margin-top: 8px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.ios-date {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ios-time {
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
}

.ios-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 14px 18px;
  padding: 16px 8px;
  margin-top: 16px;
  flex: 1;
  align-content: flex-start;
}

.ios-app-icon {
  aspect-ratio: 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.2);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ios-dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 14px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  padding: 10px;
  border-radius: 18px;
  margin: 0 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(255, 255, 255, 0.15);
}

.ios-dock-icon {
  aspect-ratio: 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.25);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════
   ABOUT DRAWER  (bottom sheet)
   ═══════════════════════════════════════════════ */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  visibility: hidden;
  pointer-events: none;
}

.about-overlay.active {
  visibility: visible;
  pointer-events: auto;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.about-overlay.active .about-backdrop {
  opacity: 1;
}

.about-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-radius: var(--r-drawer) var(--r-drawer) 0 0;
  box-shadow: var(--shadow-drawer);
  padding-bottom: calc(var(--sab) + 24px);
  transform: translateY(100%);
  transition: transform 0.36s var(--spring);
  touch-action: none;
  will-change: transform;
}

.about-overlay.active .about-drawer {
  transform: translateY(0);
}

.drawer-handle-area {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
}

.drawer-handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.12);
}

.about-content {
  padding: 8px 24px 16px;
}

.about-heading {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

.about-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.about-row:last-child {
  border-bottom: none;
}

.about-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.about-value {
  font-size: 15px;
  color: var(--text-secondary);
}

.about-footer-text {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 16px;
}

/* ═══════════════════════════════════════════════
   UTILITY: body scroll lock
   ═══════════════════════════════════════════════ */
body.no-scroll {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════
   IOS TOAST BANNER (Dynamic Island Style)
   ═══════════════════════════════════════════════ */
.ios-toast {
  position: fixed;
  top: calc(var(--sat) + 12px);
  left: 50%;
  transform: translate(-50%, -40px) scale(0.95);
  z-index: 300;
  width: max-content;
  max-width: 90%;
  padding: 10px 18px;
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.82);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s var(--spring), opacity 0.2s ease;
}

@supports (backdrop-filter: blur(20px)) {
  .ios-toast {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.12);
  }
}

.ios-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.ios-toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.ios-toast-content svg {
  color: #34c759; /* iOS green checkmark */
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   OPTIONS MENU (Popover)
   ═══════════════════════════════════════════════ */
.options-menu {
  position: fixed;
  top: calc(var(--sat) + 62px);
  right: var(--grid-pad);
  min-width: 180px;
  z-index: 220;
  border-radius: var(--r-menu);
  overflow: hidden;

  /* Glass Popover */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  box-shadow: var(--shadow-menu);

  /* Hidden by default */
  opacity: 0;
  transform: scale(0.92);
  transform-origin: calc(100% - 22px) -28px;
  pointer-events: none;
  transition: opacity 0.14s cubic-bezier(0.23, 1, 0.32, 1), transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
  will-change: opacity, transform;
}

@supports (color: color(display-p3 1 1 1)) {
  .options-menu {
    background: color(display-p3 1 1 1 / 0.72);
    border-color: color(display-p3 0 0 0 / 0.18);
  }
}

.options-menu.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.options-backdrop {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: none;
}

.options-backdrop.open {
  display: block;
}

.options-menu-list {
  padding: 5px 0;
}

.options-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  transition: background 0.1s ease;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
}

.options-item:active {
  background: rgba(0, 0, 0, 0.08);
}
