/* The shell stays mounted during sleep. Inert and visibility block all desktop controls. */
#desktop-shell {
  position: fixed;
  inset: 0;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  transition: opacity 350ms ease, visibility 0s linear 350ms;
}

body[data-system-state="DESKTOP"] #desktop-shell {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.power-toggle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  color: #c0cfdb;
}

.power-toggle[aria-expanded="true"] {
  background: #ffffff0b;
  color: var(--accent);
}

.system-menu {
  min-width: 210px;
}

.system-menu-label {
  display: block;
  margin: 4px 5px 6px;
  padding: 6px 7px 11px;
  border-bottom: 1px solid var(--line);
  color: #91a9bc;
  font-size: 12px;
  letter-spacing: .4px;
}

.system-menu .menu-item {
  min-height: 44px;
  font-size: 14px;
}

.system-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #080d13;
  opacity: 1;
  visibility: visible;
  transition: opacity 350ms ease, visibility 0s linear;
}

body[data-system-state="DESKTOP"] .system-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition-delay: 0s, 350ms;
}

body[data-system-state="POWERED_OFF"] .system-screen {
  background: #000;
}

body[data-system-state="SLEEPING"] .system-screen {
  background: transparent;
}

.system-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  transform: translateY(-14px);
  animation: system-appear 350ms ease-out;
}

.system-logo {
  width: 84px;
  height: 84px;
  margin-bottom: 27px;
}

#system-title {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -.8px;
}

#system-subtitle {
  margin-top: 9px;
  color: #8496a7;
  font-size: 14px;
  letter-spacing: .15px;
}

.system-loader {
  display: block;
  position: relative;
  width: 64px;
  height: 3px;
  overflow: hidden;
  margin-top: 38px;
  border-radius: 3px;
  background: #ffffff13;
}

.system-loader::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 30px;
  border-radius: inherit;
  background: #8dc3d1;
  animation: system-loading 1s ease-in-out infinite;
}

.lock-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(64px, 13vh) 24px max(40px, env(safe-area-inset-bottom));
  color: #eff6fa;
  background-color: transparent;
  background-image: linear-gradient(#040e1840, #020a1299);
  background-position: center;
  background-size: cover;
  text-align: center;
  cursor: pointer;
}

.lock-screen:focus-visible {
  outline-offset: -7px;
}

.lock-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 3px 28px #020d1855;
}

#lock-time {
  font-size: clamp(72px, 9vw, 128px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -5px;
  line-height: 1.2;
}

#lock-date {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 400;
  color: #c5d6e1;
}

.lock-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: auto;
  padding-top: 36px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .2px;
}

.lock-identity img {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  box-shadow: 0 6px 24px #0003;
}

.wake-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 45px;
  font-size: 13px;
  line-height: 1.8;
  color: #b7cbd8;
}

.wake-hint > span:last-child {
  color: #94acbd;
  font-size: 12px;
}

.wake-chevron {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 7px;
}

.power-on {
  position: absolute;
  bottom: max(38px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 88px;
  min-height: 80px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #929aa3;
  font-size: 13px;
  transition: color 150ms ease, background 150ms ease;
}

.power-on > .inline-icon {
  width: 23px;
  height: 23px;
}

.power-on:hover {
  color: #d3dfe8;
  background: #ffffff06;
}

.noscript {
  z-index: 1300;
}

@keyframes system-appear {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(-14px); }
}

@keyframes system-loading {
  0%, 100% { transform: translateX(-22px); }
  50% { transform: translateX(56px); }
}

@media (max-width: 700px) {
  .system-bar { padding: 0 10px 0 15px; }
  .panel-right { gap: 0; }
  .power-toggle { min-width: 44px; width: 44px; height: 44px; }
  .lock-screen { padding-top: 15vh; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  #lock-time { font-size: clamp(68px, 21vw, 104px); letter-spacing: -3px; }
  #lock-date { font-size: 16px; }
  .wake-hint { margin-top: 36px; }
}

@media (max-height: 550px) {
  .lock-screen { padding-top: 30px; padding-bottom: 20px; }
  #lock-time { font-size: 64px; letter-spacing: -3px; }
  #lock-date { font-size: 15px; margin-top: 0; }
  .lock-identity { padding-top: 16px; gap: 9px; font-size: 14px; }
  .lock-identity img { width: 40px; height: 40px; border-radius: 11px; }
  .wake-hint { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #desktop-shell, .system-screen, .system-stage, .system-loader::after {
    transition: none;
    animation: none;
  }
}
