/* ============================================================
   DmytroOS — iOS springboard mode (< 900px)
   ============================================================ */

#ios {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  --px: 0px;
  --py: 0px;
}
#ios::before {
  content: "";
  position: absolute;
  inset: -20px;
  background-image: var(--wallpaper-img), var(--wallpaper);
  background-size: cover;
  background-position: center;
  transform: translate(var(--px), var(--py));
  z-index: -1;
  pointer-events: none;
}

/* ---------- status bar ---------- */

#ios-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 22px 6px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  font-size: 14px;
  font-weight: 700;
}
.ios-status-right { display: flex; align-items: center; gap: 6px; }
.ios-status-right svg { width: 18px; height: 14px; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.ios-status-btn { display: flex; align-items: center; gap: 6px; color: inherit; padding: 2px 6px; border-radius: 8px; }
.ios-status-btn svg { width: 16px; height: 16px; }

/* ---------- springboard ---------- */

#springboard {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 12px;
}
.sb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 8px;
}
.sb-icon {
  position: relative; /* anchors .app-badge */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #fff;
}
.sb-glyph { position: relative; width: 60px; height: 60px; } /* anchors .app-badge to the icon corner */
.sb-icon img, .sb-icon svg {
  width: 60px;
  height: 60px;
  border-radius: var(--r-icon);
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
}
.sb-icon svg { box-shadow: none; }
.sb-label {
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- iOS dock ---------- */

#ios-dock {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
  margin: 8px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  padding: 12px 10px;
  border-radius: 30px;
  background: rgba(180, 180, 185, .08);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid rgba(255, 255, 255, .06);
}
#ios-dock .sb-label { display: none; }
#ios-dock .sb-glyph { width: 56px; height: 56px; }
#ios-dock .sb-icon img, #ios-dock .sb-icon svg { width: 56px; height: 56px; }

/* ---------- sheets (full-screen apps) ---------- */

#sheet-layer { position: fixed; inset: 0; z-index: var(--z-sheet); pointer-events: none; }
.sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  pointer-events: auto;
  transform: translateY(100%);
  transition: transform .28s var(--ease-out);
  will-change: transform;
}
.sheet.is-in { transform: none; }
.sheet.is-out { transform: translateY(100%); }
.sheet[data-app="terminal"] { background: #161620; }

.sheet-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: var(--win-chrome);
  box-shadow: 0 .5px 0 var(--separator);
  touch-action: none;
}
.sheet[data-app="terminal"] .sheet-header { background: #2a2a36; box-shadow: 0 .5px 0 rgba(255,255,255,.08); }
.sheet[data-app="terminal"] .sheet-title { color: #ececf4; }
.sheet-grab {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--text-3);
  opacity: .45;
}
.sheet-close {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-size: var(--fs-lg);
  font-weight: 600;
  padding: 4px 8px;
}
.sheet-close svg { width: 12px; height: 20px; }
.sheet-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--text-1);
  max-width: 55vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.sheet-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* iOS spotlight = full-screen search sheet; reuse spotlight panel styles */
[data-mode="ios"] #spotlight { padding-top: calc(env(safe-area-inset-top, 0px) + 54px); align-items: flex-start; }
[data-mode="ios"] #sp-results { max-height: 60vh; max-height: 60dvh; }

/* ---------- control center ---------- */

.ios-cc-trigger { display: flex; align-items: center; gap: 6px; color: inherit; padding: 2px 4px; border-radius: 8px; }
.ios-cc-trigger:active { opacity: .55; }

#control-center {
  position: fixed;
  inset: 0;
  z-index: var(--z-control);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 0;
  background: rgba(0, 0, 0, .25);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: cc-fade .18s var(--ease-out);
}
@keyframes cc-fade { from { opacity: 0; } to { opacity: 1; } }

.cc-panel {
  width: min(330px, calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 26px;
  color: var(--text-1);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  transform-origin: top right;
  animation: cc-pop .22s var(--ease-spring);
}
@keyframes cc-pop {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.cc-module {
  background: var(--glass);
  border: .5px solid var(--glass-border);
  border-radius: 18px;
  padding: 12px;
}

/* connectivity 2×2 — decorative, visual toggle only */
.cc-conn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-toggle {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(120, 120, 128, .32);
  color: var(--text-1);
  transition: background .15s var(--ease-out);
}
.cc-toggle svg { width: 22px; height: 22px; }
.cc-toggle.is-on { background: var(--accent); color: #fff; }
.cc-toggle[data-cc="airplane"].is-on { background: #ff9f0a; }

/* appearance — drives Theme.set() */
.cc-appearance { display: flex; flex-direction: column; gap: 8px; }
.cc-module-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.cc-seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(120, 120, 128, .24); }
.cc-seg-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background .15s var(--ease-out);
}
.cc-seg-btn svg { width: 20px; height: 20px; }
.cc-seg-btn.is-active { background: var(--win-bg); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
