/* ===================================================================
   APPLE DESIGN SYSTEM (iOS 18 / macOS Sonoma Style)
   Comics API Interactive Showcase
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@400;500;600;700;800&family=SF+Pro+Text:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Apple System Colors (Dark Mode Default) */
  --apple-bg: #000000;
  --apple-bg-secondary: #0b0b0e;
  --apple-bg-grouped: #161618;
  --apple-bg-card: rgba(28, 28, 30, 0.72);
  --apple-bg-card-hover: rgba(44, 44, 46, 0.85);
  
  /* Apple Vibrancy & Translucency */
  --apple-material-ultrathin: rgba(255, 255, 255, 0.05);
  --apple-material-thin: rgba(255, 255, 255, 0.09);
  --apple-material-regular: rgba(36, 36, 40, 0.78);
  --apple-material-thick: rgba(28, 28, 32, 0.92);
  
  /* Apple System Accent Colors */
  --apple-blue: #0a84ff;
  --apple-blue-hover: #0071e3;
  --apple-blue-tint: rgba(10, 132, 255, 0.15);
  --apple-indigo: #5e5ce6;
  --apple-purple: #bf5af2;
  --apple-pink: #ff375f;
  --apple-red: #ff453a;
  --apple-orange: #ff9f0a;
  --apple-yellow: #ffd60a;
  --apple-green: #30d158;
  --apple-teal: #64d2ff;
  
  /* Apple Typography Hierarchy */
  --apple-label-primary: #f5f5f7;
  --apple-label-secondary: #86868b;
  --apple-label-tertiary: #636366;
  --apple-label-quaternary: #48484a;
  
  /* Apple Borders & Separators */
  --apple-border: rgba(255, 255, 255, 0.12);
  --apple-border-subtle: rgba(255, 255, 255, 0.08);
  --apple-separator: rgba(84, 84, 88, 0.4);
  
  /* Apple Squircle Border Radii */
  --apple-radius-xs: 8px;
  --apple-radius-sm: 12px;
  --apple-radius-md: 18px;
  --apple-radius-lg: 24px;
  --apple-radius-xl: 32px;
  --apple-radius-pill: 999px;
  
  /* Apple Ambient Elevation Shadows */
  --apple-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --apple-shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.45);
  --apple-shadow-lg: 0 20px 50px -10px rgba(0, 0, 0, 0.65);
  --apple-shadow-modal: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.14);
  --apple-shadow-book: 0 12px 28px -6px rgba(0, 0, 0, 0.7), 0 4px 10px rgba(0, 0, 0, 0.4);
  
  /* Fonts */
  --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Base Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  transform: translateZ(0);
}

body {
  background-color: var(--apple-bg);
  color: var(--apple-label-primary);
  font-family: var(--font-apple);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(10, 132, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(94, 92, 230, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Apple Smooth Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--apple-radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===================================================================
   APPLE APP SHELL & LAYOUTS
   =================================================================== */

.apple-app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* macOS Window Header (Fullscreen Mode) */
.macos-window-header {
  height: 52px;
  background: rgba(20, 20, 22, 0.82);
  backdrop-filter: blur(35px) saturate(190%);
  -webkit-backdrop-filter: blur(35px) saturate(190%);
  border-bottom: 1px solid var(--apple-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 60;
}

/* macOS Traffic Light Buttons */
.macos-traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  transition: transform 0.15s ease;
}
.traffic-light:hover {
  transform: scale(1.1);
}
.traffic-light.close { background: #ff5f56; border: 1px solid #e0443e; }
.traffic-light.minimize { background: #ffbd2e; border: 1px solid #dea123; }
.traffic-light.zoom { background: #27c93f; border: 1px solid #1aab29; }

/* Apple Segmented Control (Iconic iOS / macOS) */
.apple-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(120, 120, 128, 0.24);
  border-radius: var(--apple-radius-pill);
  padding: 3px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.apple-segment-btn {
  padding: 5px 14px;
  border-radius: var(--apple-radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--apple-label-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}

.apple-segment-btn:hover {
  color: var(--apple-label-primary);
}

.apple-segment-btn.active {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Apple Secondary Navigation Bar (Tabs) */
.apple-nav-bar {
  background: rgba(14, 14, 16, 0.75);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 1px solid var(--apple-border-subtle);
  padding: 10px 24px;
  position: sticky;
  top: 52px;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
}

.apple-tab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--apple-radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--apple-label-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}

.apple-tab-link:hover {
  color: var(--apple-label-primary);
  background: rgba(255, 255, 255, 0.08);
}

.apple-tab-link.active {
  color: #ffffff;
  background: var(--apple-blue);
  font-weight: 600;
  box-shadow: 0 4px 14px -2px rgba(10, 132, 255, 0.5);
}

/* ===================================================================
   MODE: IPHONE 16 PRO FRAME & DYNAMIC ISLAND
   =================================================================== */

.mode-mobile-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 36px 16px;
  background: radial-gradient(circle at 50% 10%, #1c1c24 0%, #08080a 100%);
  min-height: calc(100vh - 52px);
}

.iphone-16-chassis {
  width: 100%;
  max-width: 416px;
  height: 852px;
  background: #000000;
  border-radius: 54px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 35px 80px -15px rgba(0, 0, 0, 0.95),
    0 0 0 11px #1a1a1f,
    0 0 0 13px #35353d,
    inset 0 0 4px 2px rgba(255, 255, 255, 0.15);
}

/* Dynamic Island (Interactive & Animated) */
.dynamic-island-container {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  justify-content: center;
}

.dynamic-island {
  height: 34px;
  min-width: 124px;
  background: #000000;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 0 0 0.5px rgba(255, 255, 255, 0.15);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.dynamic-island:hover {
  min-width: 190px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(10, 132, 255, 0.4);
}

.dynamic-island-camera {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #090909;
  border: 1.5px solid #1a1a1a;
  position: relative;
}

.dynamic-island-camera::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 3px;
  height: 3px;
  background: #14325a;
  border-radius: 50%;
}

.dynamic-island-pill {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* iOS Status Bar */
.ios-status-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 0 28px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  z-index: 90;
  background: transparent;
}

.ios-time {
  letter-spacing: -0.2px;
}

.ios-status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.iphone-screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px 84px 18px;
  background: #000000;
  position: relative;
}

/* iOS Bottom Tab Bar */
.ios-tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: rgba(18, 18, 20, 0.88);
  backdrop-filter: blur(40px) saturate(210%);
  -webkit-backdrop-filter: blur(40px) saturate(210%);
  border-top: 0.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 10px;
  z-index: 80;
}

.ios-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--apple-label-secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 60px;
}

.ios-tab-item.active {
  color: var(--apple-blue);
  font-weight: 600;
}

.ios-tab-item.active i {
  transform: scale(1.08);
}

.ios-home-indicator {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 138px;
  height: 4.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

/* ===================================================================
   MODE: FULLSCREEN RESPONSIVE WEB APP
   =================================================================== */

.mode-fullscreen {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 100px 28px;
}

/* Apple Large Title (HIG Standard) */
.apple-large-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--apple-label-primary);
  line-height: 1.15;
}

.apple-section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--apple-label-primary);
}

.apple-subhead {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--apple-blue);
}

.apple-caption {
  font-size: 13px;
  color: var(--apple-label-secondary);
}

/* ===================================================================
   APPLE CARDS & SPOTLIGHT HERO (App Store / Books Style)
   =================================================================== */

.apple-spotlight-card {
  position: relative;
  border-radius: var(--apple-radius-xl);
  overflow: hidden;
  height: 420px;
  background: var(--apple-bg-grouped);
  box-shadow: var(--apple-shadow-lg);
  border: 1px solid var(--apple-border-subtle);
  display: flex;
  align-items: flex-end;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
}

.apple-spotlight-card:hover {
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8);
}

.apple-spotlight-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) saturate(1.15);
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.apple-spotlight-card:hover .apple-spotlight-backdrop {
  transform: scale(1.03);
}

.apple-spotlight-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.94) 100%);
}

.apple-spotlight-content {
  position: relative;
  z-index: 10;
  padding: 32px;
  width: 100%;
}

/* Apple Action Pills (App Store "GET" Button Style) */
.apple-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--apple-radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-decoration: none;
}

.apple-btn-pill.primary {
  background: #ffffff;
  color: #000000;
}
.apple-btn-pill.primary:hover {
  background: rgba(255, 255, 255, 0.88);
  transform: scale(1.02);
}
.apple-btn-pill.primary:active {
  transform: scale(0.97);
}

.apple-btn-pill.glass {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.apple-btn-pill.glass:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}
.apple-btn-pill.glass:active {
  transform: scale(0.97);
}

.apple-btn-pill.blue {
  background: var(--apple-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px -2px rgba(10, 132, 255, 0.5);
}
.apple-btn-pill.blue:hover {
  background: var(--apple-blue-hover);
  transform: scale(1.02);
}

/* ===================================================================
   APPLE BOOKS / APP STORE COMIC GRID
   =================================================================== */

.apple-comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px 18px;
}

.apple-comic-card {
  background: transparent;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  flex-direction: column;
}

.apple-comic-card:hover {
  transform: translateY(-6px);
}

.apple-comic-card:active {
  transform: scale(0.98);
}

.apple-comic-cover-box {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: var(--apple-radius-md);
  overflow: hidden;
  background: #141418;
  box-shadow: var(--apple-shadow-book);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.3s ease;
}

.apple-comic-card:hover .apple-comic-cover-box {
  box-shadow: 0 18px 36px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(10, 132, 255, 0.35);
}

.apple-comic-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.apple-comic-card:hover .apple-comic-cover-img {
  transform: scale(1.04);
}

.apple-year-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 2px 7px;
  border-radius: var(--apple-radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  border: 0.5px solid rgba(255, 255, 255, 0.2);
}

.apple-comic-info {
  padding: 10px 2px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apple-comic-genre {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--apple-blue);
}

.apple-comic-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--apple-label-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.apple-comic-meta {
  font-size: 12px;
  color: var(--apple-label-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

/* ===================================================================
   APPLE GENRE & PUBLISHER TILES (Apple Music Category Style)
   =================================================================== */

.apple-tile {
  position: relative;
  height: 120px;
  border-radius: var(--apple-radius-md);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--apple-shadow-sm);
  border: 1px solid var(--apple-border-subtle);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.apple-tile:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--apple-shadow-md);
  border-color: rgba(255, 255, 255, 0.2);
}

.apple-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.apple-tile:hover .apple-tile-img {
  transform: scale(1.08);
}

.apple-tile-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.78) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

/* Apple Search Input Field */
.apple-search-field {
  background: rgba(118, 118, 128, 0.2);
  border-radius: var(--apple-radius-sm);
  height: 40px;
  padding: 0 14px 0 38px;
  font-size: 14px;
  color: #ffffff;
  width: 100%;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-family: var(--font-apple);
}

.apple-search-field::placeholder {
  color: var(--apple-label-secondary);
}

.apple-search-field:focus {
  outline: none;
  background: rgba(118, 118, 128, 0.3);
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

/* Apple Filter Pill Selector */
.apple-filter-chip {
  padding: 6px 14px;
  border-radius: var(--apple-radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
  color: var(--apple-label-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.apple-filter-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--apple-label-primary);
}

.apple-filter-chip.active {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  border-color: #ffffff;
}

/* ===================================================================
   APPLE SHEET / MODAL PRESENTATION
   =================================================================== */

.apple-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: appleFadeIn 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes appleFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.apple-sheet-dialog {
  background: rgba(28, 28, 30, 0.94);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 1px solid var(--apple-border);
  border-radius: var(--apple-radius-xl);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--apple-shadow-modal);
  position: relative;
  animation: appleSheetPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes appleSheetPop {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.apple-sheet-grabber {
  width: 36px;
  height: 4.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  margin: 10px auto 14px auto;
}

.apple-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.24);
  border: none;
  color: var(--apple-label-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.apple-close-btn:hover {
  background: rgba(118, 118, 128, 0.4);
  color: #ffffff;
}

/* ===================================================================
   APPLE API EXPLORER / CONSOLE
   =================================================================== */

.apple-api-cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--apple-border-subtle);
  border-radius: var(--apple-radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--apple-label-secondary);
  transition: all 0.2s ease;
  width: 100%;
}

.apple-api-cell:hover, .apple-api-cell.active {
  background: rgba(10, 132, 255, 0.12);
  border-color: rgba(10, 132, 255, 0.4);
  color: #ffffff;
}

.apple-json-card {
  background: #09090b;
  border: 1px solid var(--apple-border-subtle);
  border-radius: var(--apple-radius-md);
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e4e4e7;
  overflow-x: auto;
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* ===================================================================
   RESPONSIVE OPTIMIZATIONS (iPhone 16 / Mobile & iPads)
   =================================================================== */

@media (max-width: 768px) {
  /* Prevent any horizontal overflow */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Compact Header on Mobile */
  .macos-window-header {
    padding: 0 12px !important;
    height: 48px !important;
  }

  /* Hide Desktop Traffic Lights and Desktop Segmented Mode Switcher on Mobile */
  .macos-traffic-lights,
  .macos-window-header .apple-segmented-control {
    display: none !important;
  }

  /* Hide redundant horizontal scroll tabs on mobile; use native fixed bottom TabBar instead */
  .apple-nav-bar {
    display: none !important;
  }

  /* Fixed Bottom iOS Tab Bar (Pinned to bottom of real mobile device) */
  .mobile-tab-bar-fixed {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(62px + env(safe-area-inset-bottom, 10px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 10px) !important;
    background: rgba(18, 18, 20, 0.94) !important;
    backdrop-filter: blur(35px) saturate(210%) !important;
    -webkit-backdrop-filter: blur(35px) saturate(210%) !important;
    border-top: 0.5px solid rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    z-index: 100 !important;
  }

  /* Fullscreen Content adjustments for iPhone */
  .mode-fullscreen {
    padding: 12px 12px calc(80px + env(safe-area-inset-bottom, 20px)) 12px !important;
    max-width: 100vw !important;
  }

  /* When in Mobile Frame mode on a real small screen, collapse the outer chassis */
  .mode-mobile-frame {
    padding: 0 !important;
    background: #000000 !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    display: block !important;
  }

  .iphone-16-chassis {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .dynamic-island-container,
  .ios-status-bar,
  .ios-home-indicator {
    display: none !important;
  }

  .iphone-screen-body {
    padding: 12px 12px calc(80px + env(safe-area-inset-bottom, 20px)) 12px !important;
    height: auto !important;
  }

  /* Typography */
  .apple-large-title {
    font-size: 24px !important;
    letter-spacing: -0.02em !important;
  }

  .apple-section-title {
    font-size: 18px !important;
  }

  /* Spotlight Hero Card on iPhone 16 */
  .apple-spotlight-card {
    height: auto !important;
    min-height: 320px !important;
    border-radius: 22px !important;
  }

  .apple-spotlight-content {
    padding: 18px !important;
  }

  .apple-spotlight-content h2 {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
  }

  .apple-spotlight-content p {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    margin-bottom: 14px !important;
  }

  /* Comic Grid on iPhone 16: Exactly 2 Columns */
  .apple-comic-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px 10px !important;
  }

  .apple-comic-card {
    width: 100% !important;
  }

  .apple-comic-cover-box {
    border-radius: 12px !important;
  }

  .apple-comic-title {
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  /* Categories & Publishers on iPhone 16 */
  .apple-tile {
    height: 90px !important;
    border-radius: 14px !important;
  }

  /* iOS Presentation Bottom Sheet */
  .apple-sheet-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .apple-sheet-dialog {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 28px !important;
    border-top-right-radius: 28px !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;
    margin: 0 !important;
    width: 100% !important;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 10px)) 16px !important;
  }

  /* Native iOS Input & Select Resets */
  .apple-search-field {
    height: 38px !important;
    font-size: 13.5px !important;
  }

  select {
    font-size: 12px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
    padding-right: 24px !important;
  }

  /* JSON Viewer in API Tester */
  .apple-json-card {
    padding: 12px !important;
    font-size: 11px !important;
    max-height: 360px !important;
    white-space: pre !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .apple-comic-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px 16px !important;
  }
  .mobile-tab-bar-fixed {
    display: none !important;
  }
}

@media (min-width: 1025px) and (max-width: 1280px) {
  .apple-comic-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .mobile-tab-bar-fixed {
    display: none !important;
  }
}

@media (min-width: 1281px) {
  .apple-comic-grid {
    grid-template-columns: repeat(6, 1fr) !important;
  }
  .mobile-tab-bar-fixed {
    display: none !important;
  }
}


/* Sports Card Holographic & Refractor Foil Effect */
.card-holographic {
  position: relative;
  overflow: hidden;
}
.card-holographic::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.25) 45%,
    rgba(255, 120, 240, 0.3) 50%,
    rgba(120, 220, 255, 0.35) 55%,
    rgba(255, 255, 255, 0) 70%,
    transparent 100%
  );
  transform: rotate(25deg) translateY(-100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  opacity: 0;
}
.card-holographic:hover::after {
  transform: rotate(25deg) translateY(100%);
  opacity: 1;
}

/* Leaflet Map Custom Stying */
.leaflet-container {
  font-family: var(--font-apple) !important;
  background-color: #0b0b0e !important;
}
.leaflet-popup-content-wrapper {
  background: rgba(28, 28, 32, 0.95) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(20px) !important;
  border-radius: 14px !important;
}
.leaflet-popup-tip {
  background: rgba(28, 28, 32, 0.95) !important;
}
