:root {
  color-scheme: light;
  font-family: "Inter", "Helvetica Neue", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  /* Color System - Professional & Consistent */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-light: #f1f5f9;
  --color-surface-dark: #e2e8f0;
  
  /* Primary Colors */
  --color-primary: #3b82f6;
  --color-primary-light: #60a5fa;
  --color-primary-dark: #2563eb;
  --color-primary-soft: rgba(59, 130, 246, 0.1);
  --color-primary-medium: rgba(59, 130, 246, 0.15);
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-success-light: #34d399;
  --color-success-soft: rgba(16, 185, 129, 0.1);
  
  --color-warning: #f59e0b;
  --color-warning-light: #fbbf24;
  --color-warning-soft: rgba(245, 158, 11, 0.1);
  
  --color-danger: #ef4444;
  --color-danger-light: #f87171;
  --color-danger-soft: rgba(239, 68, 68, 0.1);
  
  --color-info: #06b6d4;
  --color-info-light: #22d3ee;
  --color-info-soft: rgba(6, 182, 212, 0.1);
  
  /* Text Colors */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #64748b;
  --color-text-disabled: #94a3b8;
  
  /* Border Colors */
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-border-dark: #cbd5e1;
  
  /* Shadow System */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  
  /* Border Radius System */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;
  
  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;
  --space-5xl: 48px;
  
  /* Typography Scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* Legacy Variables for Compatibility */
  --color-muted: var(--color-text-tertiary);
  --shadow-soft: var(--shadow-lg);
  --icon-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%231f2937' stroke-width='2' fill='none'%3E%3Cpath d='M15 6 9 12l6 6'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  --icon-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M12 6a4 4 0 0 1 4 4v2.8l.9 2.7H7.1l.9-2.7V10a4 4 0 0 1 4-4Z'/%3E%3Cpath d='M9 18h6'/%3E%3C/svg%3E");
  --icon-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-create: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%231f2937' stroke-width='2' fill='none'%3E%3Cpath d='m7 7 10 10M7 17 17 7'/%3E%3C/svg%3E");
  --icon-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9,22 9,12 15,12 15,22'/%3E%3C/svg%3E");
  --icon-checklist: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M9 11h8M9 16h8M7 7l1 1 2-2'/%3E%3C/svg%3E");
  --icon-template: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Crect x='5' y='4' width='14' height='16' rx='2'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h3'/%3E%3C/svg%3E");
  --icon-chat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M21 12a7 7 0 0 1-7 7H9l-4 3v-3a7 7 0 0 1-2-5 7 7 0 0 1 7-7h4a7 7 0 0 1 7 7Z'/%3E%3C/svg%3E");
  --icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Crect x='4' y='6' width='16' height='14' rx='2'/%3E%3Cpath d='M4 10h16M9 4v4M15 4v4M9 14h2v2H9zM13 14h2v2h-2z'/%3E%3C/svg%3E");
  --icon-report: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M7 15v3M12 11v7M17 7v11'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
  --icon-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
  --icon-meter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
  --icon-camera: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3Z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E");
  --icon-location: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
  --icon-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%236b7280' stroke-width='2' fill='none'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke='%23ffffff' stroke-width='2' fill='none'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* Hide scrollbars globally but keep scroll functionality */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Hide scrollbars for device frame */
.device-frame {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.device-frame::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.device-frame__inner {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.device-frame__inner::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Ensure smooth scrolling */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-bg);
  color: var(--color-text);
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

body.preview {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(53, 99, 255, 0.22), transparent 58%),
    linear-gradient(160deg, #0f172a, #111827 45%, #020617 100%);
  padding: 40px 16px;
}

.preview__device {
  position: relative;
}

.device-frame {
  position: relative;
  width: 390px;
  height: 844px;
  border-radius: 46px;
  padding: 18px;
  background: linear-gradient(145deg, #12172a, #05070f);
  box-shadow:
    0 48px 120px rgba(15, 23, 42, 0.42),
    0 18px 36px rgba(15, 23, 42, 0.28),
    inset 0 2px 6px rgba(255, 255, 255, 0.08);
}

.device-frame__inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 36px;
  background: #020617;
  padding: 12px;
  display: flex;
}

.device-frame__screen {
  position: relative;
  flex: 1;
  background: var(--color-bg);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
}

.device-frame__notch {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 168px;
  height: 36px;
  background: #000000;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  box-shadow: inset 0 -2px 6px rgba(255, 255, 255, 0.08);
}

.device-frame__camera {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0f172a;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.device-frame__speaker {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.device-frame__buttons {
  position: absolute;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.85), rgba(6, 9, 18, 0.92));
  box-shadow: inset -1px 0 2px rgba(255, 255, 255, 0.16);
}

.device-frame__buttons--left {
  left: -4px;
  top: 132px;
  height: 160px;
}

.device-frame__buttons--right {
  right: -4px;
  top: 220px;
  height: 96px;
}

.device-frame__home-indicator {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.app {
  flex: 1;
  min-height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 50%, #f5f7fb 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  min-height: 44px;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: 20;
}

.status-bar__time {
  font-weight: var(--font-semibold);
  letter-spacing: 0.02em;
}

.status-bar__icons {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.status-icon {
  display: inline-block;
  height: 10px;
  border-radius: 4px;
  background: rgba(31, 41, 55, 0.5);
}

.status-icon--signal {
  width: 14px;
}

.status-icon--wifi {
  width: 16px;
}

.status-icon--battery {
  width: 24px;
  border-radius: 3px;
}

.app__screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app__screen.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.app__screen--detail {
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
  overflow: hidden;
}

.app__screen.hidden {
  display: none;
}

@media (max-width: 420px) {
  body.preview {
    padding: 28px 12px;
  }

  .device-frame {
    transform: scale(0.92);
    transform-origin: top center;
  }
}
