/* ==========================================================================
   MilkaOS — Chasis del teléfono
   ========================================================================== */

#phone {
  position: relative;
  width: min(var(--phone-w), 94vw);
  height: min(var(--phone-h), 94dvh);
  background: #0f0a18;
  border-radius: var(--radius-phone);
  box-shadow:
    0 0 0 10px #17101f,
    0 0 0 12px #2a2035,
    var(--shadow-soft),
    0 40px 80px rgba(0,0,0,.45);
  overflow: hidden;
  isolation: isolate;
}

/* Notch */
.notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 118px;
  height: 26px;
  background: #0f0a18;
  border-radius: var(--radius-round);
  z-index: 999;
}

/* Barra de estado */
.status-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 26px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  z-index: 900;
  pointer-events: none;
}
.status-bar.on-dark { color: #fff; }
.status-bar.on-light { color: var(--ink); }

.status-bar .clock { min-width: 46px; }
.status-bar .icons { display: flex; align-items: center; gap: 5px; }
.status-bar svg { display: block; }

/* --- Pantallas dentro del teléfono, apiladas --- */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-med) var(--ease-soft);
}
.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* ---------- Home screen ---------- */
#screen-home {
  background: var(--grad-dawn);
  overflow: hidden;
}

.home-pages {
  position: absolute;
  top: 58px;
  bottom: 118px;
  left: 0;
  right: 0;
  display: flex;
  width: 200%;
  transition: transform var(--dur-med) var(--ease-soft);
  touch-action: pan-y;
}
.home-page {
  width: 50%;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 14px;
  padding: 10px 22px;
  align-content: start;
}

.page-dots {
  position: absolute;
  bottom: 100px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 7px;
  z-index: 20;
}
.page-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  transition: all var(--dur-fast) var(--ease-soft);
}
.page-dots span.active { background: #fff; width: 16px; border-radius: 4px; }

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  animation: iconPop var(--dur-slow) var(--ease-bounce) backwards;
}
.app-icon .icon-glyph {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--grad-glass);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform var(--dur-fast) var(--ease-bounce);
}
.app-icon:active .icon-glyph { transform: scale(.88); }
.app-icon .icon-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #452f57;
  text-shadow: 0 1px 2px rgba(255,255,255,.4);
}

@keyframes iconPop {
  from { opacity: 0; transform: translateY(14px) scale(.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Widget de fecha/hora en el home */
.home-widget {
  position: absolute;
  top: 60px; left: 0; right: 0;
  text-align: center;
  color: #452f57;
  z-index: 5;
  pointer-events: none;
}
.home-widget .hw-time {
  font-family: var(--font-display);
  font-size: 58px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(255,255,255,.35);
}
.home-widget .hw-date {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
  opacity: .85;
}
.home-pages { top: 168px; }

/* Dock inferior */
.dock {
  position: absolute;
  bottom: 26px;
  left: 18px; right: 18px;
  height: 78px;
  border-radius: 26px;
  background: var(--grad-glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  z-index: 20;
}
.dock .app-icon .icon-label { display: none; }
.dock .app-icon .icon-glyph { width: 54px; height: 54px; font-size: 24px; }

/* Home indicator */
.home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 5px;
  border-radius: 3px;
  background: rgba(69,47,87,.4);
  z-index: 999;
}
#screen-lock .home-indicator,
#screen-boot .home-indicator { background: rgba(255,255,255,.6); }

/* ---------- Ventana de aplicación ---------- */
.app-window {
  position: absolute;
  inset: 0;
  background: var(--cream);
  transform: translateY(100%);
  transition: transform var(--dur-med) var(--ease-soft);
  display: flex;
  flex-direction: column;
  z-index: 500;
}
.app-window.open { transform: translateY(0); }

.app-header {
  flex-shrink: 0;
  padding: 52px 20px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cream);
  position: relative;
  z-index: 5;
}
.app-header .back-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(166,133,217,.12);
  font-size: 16px;
  color: var(--lilac-deep);
  flex-shrink: 0;
}
.app-header h1 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 0;
  color: var(--ink);
}
.app-header .app-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.app-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 20px 40px;
  -webkit-overflow-scrolling: touch;
}

/* Overlay boot / lock encima de todo */
#screen-boot, #screen-lock { z-index: 700; }
#screen-boot.active, #screen-lock.active { z-index: 700; }
#screen-home.active { z-index: 100; }
