/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030208;
  font-family: -apple-system, 'SF Pro Display', 'SF Pro Text',
               'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SCENE — DESKTOP BACKGROUND
============================================================ */
.scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, #0e0422 0%, #060210 45%, #030208 100%);
  position: relative;
  overflow: hidden;
}

/* Ambient background glow layer */
.bg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}

.bg-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle,
    rgba(96, 38, 210, 0.55) 0%,
    rgba(80, 20, 180, 0.2) 50%,
    transparent 70%);
  top: -15%;
  left: 5%;
  animation: orb1 20s ease-in-out infinite;
}

.bg-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle,
    rgba(38, 72, 200, 0.45) 0%,
    rgba(20, 50, 160, 0.15) 50%,
    transparent 70%);
  top: 30%;
  right: 2%;
  animation: orb2 26s ease-in-out infinite;
}

.bg-orb-3 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle,
    rgba(70, 20, 160, 0.4) 0%,
    rgba(50, 10, 130, 0.12) 50%,
    transparent 70%);
  bottom: -10%;
  left: 20%;
  animation: orb3 32s ease-in-out infinite;
}

@keyframes orb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30%       { transform: translate(40px, 30px) scale(1.08); }
  65%       { transform: translate(-25px, 50px) scale(0.94); }
}
@keyframes orb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(-50px, -35px) scale(1.1); }
  75%       { transform: translate(25px, 40px) scale(0.92); }
}
@keyframes orb3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-35px, -25px) scale(1.06); }
}

/* ============================================================
   PHONE FLOAT WRAPPER (animation + shadow)
============================================================ */
.phone-float {
  position: relative;
  z-index: 10;
  animation: phone-float 8s ease-in-out infinite;
  will-change: transform;
  filter:
    drop-shadow(0 70px 140px rgba(0, 0, 0, 0.98))
    drop-shadow(0 35px 70px rgba(0, 0, 0, 0.88))
    drop-shadow(0 0 120px rgba(80, 30, 170, 0.22));
}

@keyframes phone-float {
  0%   { transform: translateY(0)    rotate(-1.3deg); }
  20%  { transform: translateY(-16px) rotate(-0.8deg); }
  45%  { transform: translateY(-9px)  rotate(-1.6deg); }
  70%  { transform: translateY(-20px) rotate(-0.9deg); }
  100% { transform: translateY(0)    rotate(-1.3deg); }
}

/* ============================================================
   PHONE FRAME — TITANIUM
============================================================ */
.phone-frame {
  position: relative;
  width: 393px;
  height: 852px;
  border-radius: 56px;

  /* Titanium Natural metallic gradient */
  background: linear-gradient(
    148deg,
    #f6f6f8  0%,
    #d2d2d7  4%,
    #eaeaef 10%,
    #c3c3c8 17%,
    #e8e8ed 25%,
    #b4b4ba 36%,
    #e0e0e6 48%,
    #c9c9d0 60%,
    #eaeaf0 72%,
    #c6c6cd 82%,
    #e4e4eb 90%,
    #f4f4f8 100%
  );

  /* Frame edge shadow & inner highlight */
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.22),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.12),
    inset 0 2px 4px rgba(255, 255, 255, 0.28),
    inset 0 -2px 4px rgba(0, 0, 0, 0.12);

  padding: 10px;
}

/* Frame metallic sheen */
.phone-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.07) 28%,
    transparent 52%,
    rgba(0, 0, 0, 0.05) 100%
  );
  pointer-events: none;
  z-index: 300;
}

/* ============================================================
   SIDE BUTTONS
============================================================ */
.side-btn {
  position: absolute;
  background: linear-gradient(90deg,
    #c5c5cc 0%, #dcdce2 40%, #b6b6bc 100%);
}

.btn-silent {
  left: -3.5px;
  top: 126px;
  width: 3.5px;
  height: 32px;
  border-radius: 2px 0 0 2px;
}

.btn-vol-up {
  left: -3.5px;
  top: 176px;
  width: 3.5px;
  height: 64px;
  border-radius: 2px 0 0 2px;
}

.btn-vol-down {
  left: -3.5px;
  top: 254px;
  width: 3.5px;
  height: 64px;
  border-radius: 2px 0 0 2px;
}

.btn-power {
  right: -3.5px;
  top: 196px;
  width: 3.5px;
  height: 94px;
  border-radius: 0 2px 2px 0;
}

/* ============================================================
   PHONE BEZEL (inner black ring)
============================================================ */
.phone-bezel {
  width: 100%;
  height: 100%;
  border-radius: 47px;
  background: #111;
  padding: 1px;
  overflow: hidden;
}

/* ============================================================
   SCREEN
============================================================ */
.screen {
  width: 100%;
  height: 100%;
  border-radius: 46px;
  overflow: hidden;
  position: relative;
  background: #000;
  isolation: isolate;
}

/* Glass sheen on screen surface */
.screen-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    138deg,
    rgba(255, 255, 255, 0.038) 0%,
    rgba(255, 255, 255, 0.012) 28%,
    transparent 48%
  );
  pointer-events: none;
  z-index: 190;
}

/* ============================================================
   WALLPAPER CANVAS
============================================================ */
.wall-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ============================================================
   DYNAMIC ISLAND
============================================================ */
.dynamic-island {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 37px;
  background: #000;
  border-radius: 22px;
  z-index: 110;
  cursor: pointer;
  overflow: hidden;
  transition:
    width  0.48s cubic-bezier(0.34, 1.18, 0.64, 1),
    height 0.48s cubic-bezier(0.34, 1.18, 0.64, 1),
    border-radius 0.48s cubic-bezier(0.34, 1.18, 0.64, 1);
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.9),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.05);
}

/* Subtle ambient glow pulse */
.dynamic-island::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 26px;
  background: transparent;
  box-shadow: 0 0 0 0 rgba(130, 60, 220, 0);
  animation: island-glow 5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes island-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(130, 60, 220, 0); }
  50%       { box-shadow: 0 0 18px 4px rgba(130, 60, 220, 0.12); }
}

/* Default pill content (camera + speaker) */
.di-default {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  transition: opacity 0.18s;
}

.di-cam {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0d0d0f;
  border: 1.5px solid #161618;
  position: relative;
}

.di-cam::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(24, 24, 40, 0.85);
  inset: 50%;
  transform: translate(-50%, -50%);
}

.di-speaker {
  width: 50px;
  height: 5px;
  background: #0c0c0e;
  border-radius: 3px;
}

/* Expanded content */
.di-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  opacity: 0;
  transition: opacity 0.22s 0.18s;
  white-space: nowrap;
  overflow: hidden;
}

.di-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.45);
}

.di-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.di-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.di-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: -0.1px;
}

/* Expanded state */
.dynamic-island.expanded {
  width: 310px;
  height: 82px;
  border-radius: 32px;
}

.dynamic-island.expanded .di-default {
  opacity: 0;
  pointer-events: none;
}

.dynamic-island.expanded .di-content {
  opacity: 1;
}

/* ============================================================
   STATUS BAR
============================================================ */
.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 32px 8px;
  z-index: 100;
}

.st-time {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.st-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 13px;
}

.signal-bars b {
  display: block;
  background: #fff;
  border-radius: 1.2px;
  width: 3px;
}

.signal-bars b:nth-child(1) { height: 4px;  opacity: 0.3; }
.signal-bars b:nth-child(2) { height: 7px;  opacity: 0.55; }
.signal-bars b:nth-child(3) { height: 10px; opacity: 0.8; }
.signal-bars b:nth-child(4) { height: 13px; }

.wifi-icon { display: block; }

.battery {
  display: flex;
  align-items: center;
  gap: 1px;
}

.bat-body {
  width: 25px;
  height: 12px;
  border-radius: 3.5px;
  border: 1.5px solid rgba(255, 255, 255, 0.52);
  padding: 1.5px;
}

.bat-fill {
  width: 80%;
  height: 100%;
  background: #fff;
  border-radius: 1.5px;
}

.bat-nub {
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.42);
  border-radius: 0 1px 1px 0;
}

/* ============================================================
   NAME WIDGET
============================================================ */
.widget-zone {
  position: absolute;
  top: 62px;
  left: 0;
  right: 0;
  padding: 0 18px;
  z-index: 30;
}

.name-widget {
  position: relative;
  background: rgba(255, 255, 255, 0.082);
  backdrop-filter: blur(48px) saturate(1.8);
  -webkit-backdrop-filter: blur(48px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: widget-appear 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

/* Top highlight line */
.name-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

/* Subtle inner gradient */
.name-widget::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(110, 50, 240, 0.1) 0%,
    transparent 45%,
    rgba(50, 110, 255, 0.07) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

.nw-glow {
  position: absolute;
  width: 60%;
  height: 40px;
  background: radial-gradient(
    ellipse,
    rgba(120, 60, 240, 0.18) 0%,
    transparent 70%
  );
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: glow-pulse 4s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}

.nw-name {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.4px;
  text-align: center;
  text-shadow:
    0 2px 24px rgba(110, 50, 220, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.4);
}

@keyframes widget-appear {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ============================================================
   APP GRID
============================================================ */
.app-grid {
  position: absolute;
  top: 186px;
  left: 0;
  right: 0;
  padding: 0 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  row-gap: 22px;
  column-gap: 4px;
  z-index: 30;
}

/* ============================================================
   APP ITEM
============================================================ */
.app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  position: relative;
  -webkit-touch-callout: none;
}

.app-ico {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow:
    0 4px 22px rgba(0, 0, 0, 0.62),
    0 1px 4px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition:
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.15s ease,
    box-shadow 0.15s ease;
  will-change: transform;
}

/* Icon top shine */
.app-ico::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border-radius: 18px 18px 0 0;
  z-index: 2;
  pointer-events: none;
}

/* Press flash overlay */
.app-ico::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background 0.14s;
}

/* Hover lift */
.app-item:hover .app-ico {
  transform: scale(1.07) translateY(-3px);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.72),
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* Press state */
.app-item:active .app-ico,
.app-item.pressing .app-ico {
  transform: scale(0.87);
  filter: brightness(0.8);
}

.app-item:active .app-ico::after,
.app-item.pressing .app-ico::after {
  background: rgba(255, 255, 255, 0.1);
}

.app-lbl {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  letter-spacing: -0.18px;
  line-height: 1.15;
  text-shadow:
    0 1px 10px rgba(0, 0, 0, 0.95),
    0 0 24px rgba(0, 0, 0, 0.8);
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  transform: scale(0);
  animation: ripple 0.58s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes ripple {
  to { transform: scale(12); opacity: 0; }
}

/* ============================================================
   SEARCH BAR
============================================================ */
.search-bar {
  position: absolute;
  bottom: 110px;
  left: 20px;
  right: 20px;
  height: 38px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  z-index: 30;
  cursor: text;
}

.search-bar span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.38);
}

/* ============================================================
   PAGE DOTS
============================================================ */
.page-dots {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 30;
  pointer-events: none;
}

.dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: all 0.3s;
}

.dot.active {
  background: rgba(255, 255, 255, 0.9);
  width: 18px;
  border-radius: 3px;
}

/* ============================================================
   DOCK
============================================================ */
.dock {
  position: absolute;
  bottom: 20px;
  left: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.105);
  backdrop-filter: blur(44px) saturate(1.8);
  -webkit-backdrop-filter: blur(44px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  box-shadow:
    0 10px 44px rgba(0, 0, 0, 0.52),
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.dock .app-ico {
  width: 60px;
  height: 60px;
}

.dock .app-lbl {
  display: none;
}

/* ============================================================
   HOME INDICATOR BAR
============================================================ */
.home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  z-index: 60;
}

/* ============================================================
   LAUNCH OVERLAY
============================================================ */
.launch-overlay {
  position: absolute;
  inset: 0;
  z-index: 160;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  overflow: hidden;
}

.launch-overlay.active {
  display: flex;
}

.launch-blur {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.launch-icon-wrap {
  width: 124px;
  height: 124px;
  border-radius: 30px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.85),
    0 8px 24px rgba(0, 0, 0, 0.6);
  animation: launch-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.launch-icon-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.15) 0%,
    transparent 100%);
  border-radius: 30px 30px 0 0;
  z-index: 2;
  pointer-events: none;
}

.launch-label {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9);
  animation: launch-fade 0.38s ease 0.12s both;
}

@keyframes launch-pop {
  from { transform: scale(0.38); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes launch-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE — MOBILE (no phone frame)
============================================================ */
@media (max-width: 480px) {
  .scene {
    background: #000;
    align-items: stretch;
    justify-content: stretch;
  }

  .bg-layer { display: none; }

  .phone-float {
    animation: none;
    filter: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .phone-frame {
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 0;
    background: #000;
    box-shadow: none;
  }

  .phone-frame::before { display: none; }

  .side-btn { display: none; }

  .phone-bezel {
    border-radius: 0;
    padding: 0;
    background: #000;
  }

  .screen {
    border-radius: 0;
    width: 100%;
    height: 100%;
  }

  .screen-sheen { display: none; }
}

/* ============================================================
   RESPONSIVE — SMALL DESKTOP (scale down phone)
============================================================ */
@media (max-height: 900px) and (min-width: 481px) {
  .phone-float {
    transform-origin: center center;
    scale: 0.88;
  }

  @keyframes phone-float {
    0%   { transform: translateY(0)    rotate(-1.3deg) scale(0.88); }
    20%  { transform: translateY(-14px) rotate(-0.8deg) scale(0.88); }
    45%  { transform: translateY(-8px)  rotate(-1.6deg) scale(0.88); }
    70%  { transform: translateY(-18px) rotate(-0.9deg) scale(0.88); }
    100% { transform: translateY(0)    rotate(-1.3deg) scale(0.88); }
  }
}

@media (max-height: 780px) and (min-width: 481px) {
  .phone-float { scale: 0.76; }
}
