.card::after,
.settings-panel::after,
.calendar-card::after,
.settings-row::after { pointer-events: none; z-index: 0; }

.card > *,
.settings-panel > *,
.calendar-card > *,
.settings-row > * { position: relative; z-index: 1; }

.cosmic-profile,
.focus-ring { position: relative; }

.cosmic-profile::after { z-index: 3; }

.cosmic-setting-row { width: 100%; color: inherit; text-align: left; }

/* Keep glass controls layout-stable on mobile Safari. */
.status-grid {
  grid-auto-rows: 150px;
  align-items: stretch;
}
.status-option {
  height: 150px;
  min-height: 150px;
  flex: 0 0 150px;
}
.settings-group {
  flex: 0 0 auto;
  align-self: stretch;
}
.settings-row {
  height: 84px;
  min-height: 84px;
  flex: 0 0 84px;
}
.schedule-list {
  flex: 0 0 auto;
}
.schedule-list .list-row {
  height: 104px;
  min-height: 104px;
  flex: 0 0 104px;
}

/* Overflow remains local, but no dynamic ripple layer is injected anymore. */
.status-chip,
.status-option,
.nav-item,
.theme-tile,
.character-choice,
.motion-style-grid button,
.calendar-day,
.round-add,
.settings-row,
.language-row,
.device-cosmic-card,
.locked-setting-card,
.key,
.primary-action,
.secondary-action,
.back-button,
.icon-delete {
  overflow: hidden;
  isolation: isolate;
}

.passcode-sheet {
  border: 1px solid rgba(216, 222, 255, .2);
  color: var(--space-ink);
  background:
    radial-gradient(circle at 76% 4%, rgba(137, 104, 255, .18), transparent 28%),
    linear-gradient(180deg, rgba(19, 33, 80, .98), rgba(6, 14, 39, .99));
  box-shadow: 0 -20px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: blur(28px) saturate(150%);
}

.passcode-dot {
  border-color: rgba(207, 214, 255, .42);
  background: rgba(255,255,255,.04);
}
.passcode-dot.filled {
  border-color: var(--space-lilac);
  background: var(--space-lilac);
  box-shadow: 0 0 18px rgba(164, 137, 255, .7);
}
.key {
  border-color: rgba(213, 220, 255, .15);
  background: linear-gradient(145deg, rgba(255,255,255,.1), rgba(255,255,255,.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.11);
}
.key:active { background: rgba(133, 105, 255, .24); }
.cancel-key { color: #c9cfff; }
.toast {
  color: #f7f8ff;
  border: 1px solid rgba(213, 220, 255, .18);
  background: rgba(12, 22, 58, .9);
  box-shadow: 0 18px 50px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.12);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
}

.cosmic-device-screen .compact-device-hero { height: 205px; }
.cosmic-device-screen .compact-device-hero .planet-mascot { width: 126px; height: 126px; }
.cosmic-device-screen .compact-device-hero .planet-mascot .ring { width: 194px; height: 49px; border-width: 5px; }
.cosmic-device-card { border-radius: 28px; }
.cosmic-device-card .device-icon {
  background: radial-gradient(circle at 35% 30%, rgba(217,208,255,.35), rgba(87,78,197,.16));
  border: 1px solid rgba(215,222,255,.17);
  box-shadow: 0 0 22px rgba(128,101,255,.22), inset 0 1px 0 rgba(255,255,255,.15);
}
.primary-action {
  border: 1px solid rgba(214, 221, 255, .22);
  color: white;
  background: linear-gradient(135deg, #7f6cff, #5d72e8 55%, #4f9ae3);
  box-shadow: 0 12px 28px rgba(75, 77, 190, .28), inset 0 1px 0 rgba(255,255,255,.22);
}

.language-row,
.reminder-row { border-radius: 24px; }
.language-row.active {
  border-color: rgba(183,160,255,.66);
  box-shadow: var(--space-glow-active);
}
.language-check { color: var(--space-lilac); }

.empty-state {
  min-height: 118px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--space-soft);
}
.empty-state::before {
  content: "✦";
  display: block;
  margin-right: 8px;
  color: var(--space-lilac);
  text-shadow: 0 0 14px rgba(164,137,255,.7);
}

.icon-delete {
  color: #b8c0e8;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(214,221,255,.11);
}
.icon-delete:active { color: #fff; background: rgba(255,120,170,.18); }

.range {
  width: 100%;
  height: 5px;
  margin-top: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--space-violet), var(--space-blue));
}
.range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(205,213,255,.5);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 20px rgba(133,111,255,.46);
  -webkit-appearance: none;
}

.page-header h1 span { color: var(--space-lilac); font-size: 13px; vertical-align: top; text-shadow: 0 0 13px var(--space-violet); }

@supports not (backdrop-filter: blur(2px)) {
  .card,
  .bottom-nav,
  .passcode-sheet,
  .settings-panel { background: rgba(12, 24, 64, .96); }
}

@media (max-width: 350px) {
  .bottom-nav { left: 8px; right: 8px; }
  .nav-item span { font-size: 8px; }
  .locked-setting-card { grid-template-columns: 50px 1fr; }
  .locked-setting-card .restricted { grid-column: 2; width: max-content; }
  .status-grid { grid-auto-rows: 142px; }
  .status-option { height: 142px; min-height: 142px; flex-basis: 142px; }
  .settings-row { height: 80px; min-height: 80px; flex-basis: 80px; }
}
