.caelestia-lock {
  --lock-expand-progress: 0;
  --lock-content-progress: 0;
  position: fixed;
  z-index: var(--sp-layer-lock, 100);
  inset: 0;
  overflow: clip;
  color: var(--sp-color-on-surface);
  font-family: var(--sp-font-sans);
  isolation: isolate;
  touch-action: manipulation;
}

.caelestia-lock[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.caelestia-lock-shade {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: rgb(12 11 14 / var(--lock-shade-opacity, 0.22));
  pointer-events: none;
}

.lock-surface {
  position: fixed;
  z-index: 1;
  left: var(--lock-surface-left, calc(50vw - 104px));
  top: var(--lock-surface-top, calc(50svh - 104px));
  width: var(--lock-surface-width, 208px);
  height: var(--lock-surface-height, 208px);
  contain: layout paint style;
  overflow: hidden;
  border: 0;
  border-radius: var(--lock-surface-radius, 52px);
  background: color-mix(in srgb, var(--sp-color-surface) 85%, transparent);
  box-shadow: 0 0 15px rgb(0 0 0 / 0.7);
  opacity: var(--lock-surface-opacity, 1);
  transform: rotate(var(--lock-surface-rotation, 0deg)) scale(var(--lock-surface-scale, 1));
  transform-origin: 50% 50%;
  will-change: left, top, width, height, border-radius, opacity, transform;
}

html[data-visual-mode="low"] .lock-surface {
  background: color-mix(in srgb, var(--sp-color-surface) 96%, transparent);
  box-shadow: 0 0 8px rgb(0 0 0 / 0.38);
}

.caelestia-lock:is([data-lock-state="booting"], [data-lock-state="desktop"]) .lock-surface {
  opacity: 0;
}

.lock-tile {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: calc(1 - var(--lock-content-progress));
  -webkit-tap-highlight-color: transparent;
}

.lock-tile:disabled,
.lock-dashboard[aria-hidden="true"] {
  pointer-events: none;
}

.lock-tile::before,
.lock-back::before,
.lock-password-shell button::before,
.lock-player-controls button::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  content: "";
  opacity: 0;
  pointer-events: none;
}

.lock-tile:is(:hover, :focus-visible)::before,
.lock-back:is(:hover, :focus-visible)::before,
.lock-password-shell button:is(:hover, :focus-visible)::before,
.lock-player-controls button:is(:hover, :focus-visible)::before {
  opacity: var(--sp-opacity-hover);
}

.lock-tile:active::before,
.lock-back:active::before,
.lock-password-shell button:active::before,
.lock-player-controls button:active::before {
  opacity: var(--sp-opacity-pressed);
}

.lock-tile:focus-visible,
.lock-back:focus-visible,
.lock-password-shell :is(input, button):focus-visible,
.lock-player-controls button:focus-visible {
  outline: 3px solid var(--sp-color-primary);
  outline-offset: -5px;
}

.lock-shared {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  display: grid;
  width: min(600px, 41.667svh, calc(100% - 40px));
  grid-template-areas:
    "mark"
    "clock"
    "date"
    "identity";
  justify-items: center;
  gap: calc(4px + 8px * var(--lock-expand-progress));
  pointer-events: none;
  transform: translate3d(-50%, calc(-50% - 52px * var(--lock-expand-progress)), 0);
  transform-origin: 50% 50%;
}

.caelestia-lock:is(
    [data-lock-state="booting"],
    [data-lock-state="tile"],
    [data-lock-state="locking"]
  ) .lock-shared {
  width: 192px;
  height: 192px;
}

.caelestia-lock:is(
    [data-lock-state="dashboard-expanding"],
    [data-lock-state="dashboard"]
  ) .lock-shared {
  grid-template-areas:
    "clock"
    "date"
    "mark"
    "identity";
}

.caelestia-lock[data-lock-state="unlocking"] .lock-shared {
  width: max-content;
  height: max-content;
  grid-template-areas: "mark";
  place-items: center;
  gap: 0;
  transform: translate3d(-50%, -50%, 0);
}

.caelestia-lock[data-lock-state="unlocking"]
  :is(.lock-clock, .lock-date, .lock-identity) {
  display: none;
}

.lock-mark {
  grid-area: mark;
  display: grid;
  width: calc(192px + (min(420px, 29.167svh) - 192px) * var(--lock-expand-progress));
  height: calc(192px + (min(420px, 29.167svh) - 192px) * var(--lock-expand-progress));
  place-items: center;
  overflow: hidden;
  border-radius: 0;
  color: var(--sp-color-on-surface-variant);
  background: transparent;
}

.lock-tile-glyph,
.lock-profile-glyph {
  grid-area: 1 / 1;
  transition: opacity var(--sp-duration-expressive-effects) var(--sp-curve-expressive-effects);
}

.lock-tile-glyph {
  color: var(--sp-color-on-surface);
  font-size: 144px;
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 48;
  opacity: calc(1 - var(--lock-expand-progress));
}

.lock-profile-glyph {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: var(--lock-expand-progress);
}

.lock-profile-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.lock-profile-surface {
  fill: #fff;
}

.lock-profile-art {
  width: 100%;
  height: 100%;
  filter: none;
  opacity: 0.98;
}

.lock-shape-defs {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.caelestia-lock[data-lock-state="tile"] .lock-mark,
.caelestia-lock[data-lock-state="tile-entering"] .lock-mark,
.caelestia-lock[data-lock-state="locking"] .lock-mark {
  width: 192px;
  height: 192px;
  border-radius: 0;
  background: transparent;
}

.caelestia-lock:is([data-lock-state="tile"], [data-lock-state="tile-entering"], [data-lock-state="locking"])
  .lock-shared {
  width: 192px;
  height: 192px;
  grid-template-areas: "mark";
  gap: 0;
}

.caelestia-lock:is([data-lock-state="tile"], [data-lock-state="tile-entering"], [data-lock-state="locking"])
  :is(.lock-clock, .lock-date, .lock-identity) {
  display: none;
}

.lock-clock {
  grid-area: clock;
  display: flex;
  align-items: baseline;
  gap: var(--sp-space-small);
  font-family: var(--sp-font-sans);
  font-size: calc(22px + (min(224px, 20.741svh) - 22px) * var(--lock-expand-progress));
  font-weight: 500;
  font-variation-settings: "ROND" 25, "wdth" 30;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 0.82;
}

.lock-clock-hours {
  color: var(--sp-color-primary);
}

.lock-clock-minutes {
  color: var(--sp-color-secondary);
}

.lock-date,
.lock-identity {
  margin: 0;
  font-weight: 700;
  line-height: 1.1;
}

.lock-date {
  grid-area: date;
  color: var(--sp-color-on-surface);
  font-size: calc(10px + 6px * var(--lock-expand-progress));
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lock-identity {
  grid-area: identity;
  color: var(--sp-color-on-surface-variant);
  font-size: calc(10px + 4px * var(--lock-expand-progress));
  letter-spacing: 0.03em;
}

.lock-dashboard {
  position: absolute;
  z-index: 2;
  inset: var(--sp-padding-larger);
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(360px, min(600px, 41.667svh)) minmax(210px, 1fr);
  gap: 40px;
  opacity: var(--lock-content-progress);
}

.lock-back {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--sp-radius-full);
  color: var(--sp-color-on-surface-variant);
  background: transparent;
  font: 400 22px / 1 var(--sp-font-sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--sp-duration-small) var(--sp-curve-expressive-effects);
}

.lock-back:is(:hover, :focus-visible) {
  opacity: 0.62;
}

.lock-dashboard-left,
.lock-dashboard-right {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.lock-dashboard-left {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.28fr) minmax(0, 0.82fr);
}

.lock-dashboard-right {
  grid-template-rows: auto minmax(0, 1fr);
}

.lock-dashboard-center {
  position: relative;
  min-width: 0;
}

.lock-card,
.lock-resources,
.lock-notifications {
  color: var(--sp-color-on-surface);
  border: 0;
  background: var(--sp-color-surface-container);
}

.lock-card,
.lock-resources,
.lock-notifications {
  padding: var(--sp-padding-larger);
  border-radius: var(--sp-radius-normal);
}

.lock-signal-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--sp-space-extra-small);
  text-align: center;
  border-radius: var(--sp-radius-extra-extra-large);
}

.lock-signal-card .lock-card-heading {
  justify-content: center;
}

.lock-fetch-card {
  overflow: hidden;
}

.lock-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--sp-color-on-surface-variant);
  font-size: 11px;
  font-weight: 700;
}

.lock-card p,
.lock-card span {
  color: var(--sp-color-on-surface-variant);
}

.lock-signal-card strong {
  color: var(--sp-color-primary);
  font: 600 32px / 1 var(--sp-font-sans);
  font-variation-settings: "ROND" 25, "wdth" 80;
}

.lock-signal-card p {
  margin: 0;
  color: var(--sp-color-on-surface-variant);
  font-size: 14px;
}

.lock-signal-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-space-small);
  margin-block: var(--sp-space-small) var(--sp-space-extra-small);
}

.lock-signal-icon {
  color: var(--sp-color-secondary);
  font-size: 38px;
}

.lock-signal-card .lock-signal-viewport {
  font-size: 12px;
}

.lock-signal-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--sp-radius-full);
  background: var(--sp-color-primary);
}

.lock-terminal-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: var(--sp-radius-medium);
  color: var(--sp-color-on-primary);
  background: var(--sp-color-primary);
}

.lock-fetch-card .lock-card-heading {
  justify-content: flex-start;
  gap: var(--sp-space-smaller);
}

.lock-fetch-content {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-space-extra-large);
  margin-top: var(--sp-space-small);
}

.lock-fetch-glyph {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  border-radius: var(--sp-radius-normal);
  object-fit: contain;
  padding: var(--sp-padding-smaller);
  background: var(--sp-color-primary-container);
}

.lock-fetch-content dl,
.lock-fetch-content dl div {
  margin: 0;
  padding: 0;
}

.lock-fetch-content dl div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font: 400 11px / 1.45 var(--sp-font-mono);
}

.lock-fetch-content dt {
  color: var(--sp-color-outline);
}

.lock-fetch-content dd {
  margin: 0;
  color: var(--sp-color-on-surface);
}

.lock-fetch-palette {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: var(--sp-space-small);
}

.lock-fetch-palette span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: var(--sp-radius-medium);
  background: var(--sp-color-on-surface);
}

.lock-fetch-palette span:nth-child(2) {
  background: var(--sp-color-surface-container-highest);
}

.lock-fetch-palette span:nth-child(3) {
  background: var(--sp-color-outline);
}

.lock-fetch-palette span:nth-child(4) {
  background: var(--sp-color-primary);
}

.lock-fetch-palette span:nth-child(5) {
  background: var(--sp-color-secondary);
}

.lock-fetch-palette span:nth-child(6) {
  background: var(--sp-color-tertiary);
}

.lock-fetch-palette span:nth-child(7) {
  background: var(--sp-color-outline-variant);
}

.lock-player-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  align-content: center;
  justify-items: center;
  gap: var(--sp-space-extra-small);
  min-height: 0;
  padding: var(--sp-padding-extra-large);
  border-radius: var(--sp-radius-extra-large);
  text-align: center;
}

.lock-player-kicker {
  font-size: 10px;
  font-weight: 700;
}

.lock-player-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--sp-color-primary);
  font: var(--sp-type-title-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lock-player-card > span:not(.lock-player-kicker) {
  font: var(--sp-type-body-small);
}

.lock-player-controls {
  display: flex;
  grid-row: auto;
  grid-column: auto;
  align-items: center;
  gap: 2px;
  margin-top: var(--sp-space-small);
}

.lock-player-controls button,
.lock-password-shell button {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--sp-radius-full);
  color: var(--sp-color-on-surface);
  background: transparent;
  cursor: pointer;
}

.lock-player-controls [data-lock-player-toggle] {
  color: var(--sp-color-on-primary);
  background: var(--sp-color-primary);
}

.lock-form {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(480px, 33.333svh, 80%);
  margin-inline: auto;
}

.lock-password-shell {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 52px;
  padding: 4px;
  border: 0;
  border-radius: var(--sp-radius-full);
  color: var(--sp-color-on-surface);
  background: var(--sp-color-surface-container);
}

.lock-field-mark {
  display: grid;
  place-items: center;
  color: var(--sp-color-on-surface-variant);
  font-size: 18px;
}

.lock-password-shell input {
  z-index: 2;
  min-width: 0;
  height: 42px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  color: transparent;
  caret-color: var(--sp-color-on-surface);
  background: transparent;
  font: 400 15px / 1 var(--sp-font-sans);
}

.lock-password-shell input:not(:placeholder-shown) {
  caret-color: transparent;
}

.caelestia-lock .lock-password-shell input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.lock-password-shell input::placeholder {
  color: var(--sp-color-outline);
  opacity: 1;
}

.lock-password-visual {
  position: absolute;
  z-index: 1;
  left: 44px;
  display: flex;
  max-width: calc(100% - 96px);
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  pointer-events: none;
}

.lock-password-char {
  --lock-char-opacity: 0;
  --lock-char-scale: 0;
  --lock-char-width: 14px;
  position: relative;
  width: var(--lock-char-width);
  height: 14px;
  flex: 0 0 var(--lock-char-width);
  opacity: var(--lock-char-opacity);
}

.lock-password-shape {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21px;
  height: 21px;
  overflow: visible;
  color: var(--sp-color-on-surface);
  transform: translate(-50%, -50%) scale(var(--lock-char-scale));
  transform-origin: center;
}

.lock-password-shell button {
  width: 44px;
  height: 44px;
  color: var(--sp-color-on-surface-variant);
  background: var(--sp-color-surface-container-high);
  font-size: 20px;
  transform: scale(var(--lock-submit-scale, 0.78));
}

.lock-password-shell:has(input:not(:placeholder-shown)) button {
  color: var(--sp-color-on-primary);
  background: var(--sp-color-primary);
}

.lock-password-shell:focus-within {
  outline: 2px solid color-mix(in srgb, var(--sp-color-primary) 42%, transparent);
  outline-offset: 2px;
}

.lock-entry-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--sp-color-on-surface-variant);
  font: 400 12px / 1.35 var(--sp-font-sans);
  text-align: center;
}

.lock-resources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-spacing-medium);
  margin-right: 40px;
  border-radius: var(--sp-radius-extra-large);
}

.lock-resource {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-content: center;
  min-width: 0;
  text-align: center;
}

.lock-resource svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lock-resource-processors path {
  fill: var(--sp-color-primary-container);
}

.lock-resource-memory path {
  fill: var(--sp-color-tertiary-container);
}

.lock-resource-storage path {
  fill: var(--sp-color-secondary-container);
}

.lock-resource > span,
.lock-resource > strong,
.lock-resource > small {
  position: relative;
  z-index: 1;
}

.lock-resource > span {
  color: var(--sp-color-secondary);
  font-size: 18px;
}

.lock-resource > strong {
  color: var(--sp-color-on-surface);
  font: 650 18px / 1 var(--sp-font-sans);
}

.lock-resource > small {
  margin-top: 3px;
  color: var(--sp-color-on-surface-variant);
  font: 500 8px / 1 var(--sp-font-mono);
}

.lock-notifications {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto 1fr;
  border-bottom-right-radius: var(--sp-radius-extra-large);
}

.lock-notifications h2 {
  margin: 0;
  color: var(--sp-color-outline);
  font: 500 11px / 1.3 var(--sp-font-mono);
}

.lock-notifications-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--sp-spacing-medium);
  min-height: 0;
  color: var(--sp-color-outline-variant);
  text-align: center;
}

.lock-notifications-empty .sp-icon {
  font-size: 52px;
}

.lock-notifications-empty strong {
  max-width: 100%;
  font: 500 14px / 1.25 var(--sp-font-mono);
  overflow-wrap: anywhere;
  white-space: normal;
}

.lock-notifications-empty p {
  max-width: 22ch;
  margin: 0;
  color: var(--sp-color-outline);
  font-size: 9px;
  line-height: 1.4;
}

body:not(.caelestia-desktop-active) .caelestia-sidebar[data-shell-bar],
body[data-lock-state="unlocking"] .caelestia-sidebar[data-shell-bar],
body[data-lock-state="desktop-revealing"] .caelestia-sidebar[data-shell-bar],
body[data-lock-state="locking"] .caelestia-sidebar[data-shell-bar] {
  opacity: var(--lock-bar-opacity, 0);
  transform: translate3d(var(--lock-bar-x, -18px), 0, 0);
  pointer-events: none;
}

body:not(.caelestia-desktop-active) .shell-application-host,
body:not(.caelestia-desktop-active) .shell-overlay-layer,
body:not(.caelestia-desktop-active) .shell-controls-root {
  opacity: 0;
  pointer-events: none;
}

body[data-lock-state="unlocking"]
  :is(.shell-application-host, .shell-overlay-layer, .shell-controls-root),
body[data-lock-state="desktop-revealing"]
  :is(.shell-application-host, .shell-overlay-layer, .shell-controls-root) {
  opacity: var(--lock-desktop-progress, 0);
  pointer-events: none;
}

body.caelestia-lock-active {
  overflow: hidden;
}

html[data-visual-mode="low"] .lock-surface,
html[data-motion-policy="reduced"] .lock-surface {
  will-change: auto;
}

@media (max-width: 1160px) {
  .lock-dashboard {
    grid-template-columns: minmax(180px, 1fr) minmax(360px, 520px) minmax(180px, 1fr);
    gap: 20px;
  }

  .lock-fetch-card {
    display: none;
  }
}

@media (max-width: 900px) {
  .lock-dashboard {
    inset:
      max(12px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      max(12px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
    grid-template:
      "center" minmax(700px, 1fr)
      "left" auto
      "right" auto
      / minmax(0, 1fr);
    gap: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .lock-dashboard-center {
    grid-area: center;
    min-height: 700px;
  }

  .lock-dashboard-left {
    display: grid;
    grid-area: left;
    grid-template-rows: auto;
  }

  .lock-dashboard-right {
    grid-area: right;
  }

  .lock-signal-card,
  .lock-notifications {
    display: none;
  }

  .lock-shared {
    width: calc(100% - 24px);
    transform: translate3d(-50%, calc(-50% - 42px * var(--lock-expand-progress)), 0);
  }

  .lock-mark {
    width: calc(70px + 68px * var(--lock-expand-progress));
    height: calc(70px + 68px * var(--lock-expand-progress));
  }

  .lock-clock {
    font-size: calc(20px + 58px * var(--lock-expand-progress));
  }

  .lock-form {
    width: min(480px, 94%);
  }

  .lock-back {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    background: color-mix(in srgb, var(--sp-color-surface) 85%, transparent);
    opacity: 0.72;
  }

  .lock-resources {
    margin-right: 0;
  }
}

@media (max-height: 520px) {
  .lock-dashboard {
    inset: 10px;
    grid-template:
      "left center right" minmax(0, 1fr)
      / minmax(150px, 0.75fr) minmax(280px, 1.5fr) minmax(150px, 0.75fr);
    gap: 10px;
    overflow: auto;
  }

  .lock-dashboard-center {
    grid-area: center;
    min-height: 0;
  }

  .lock-dashboard-left {
    grid-area: left;
  }

  .lock-dashboard-right {
    grid-area: right;
  }

  .lock-signal-card,
  .lock-fetch-card,
  .lock-notifications {
    display: none;
  }

  .lock-resources {
    grid-template-columns: 1fr;
  }

  .lock-resource {
    padding: 8px;
  }

  .lock-shared {
    transform: translate3d(-50%, calc(-50% - 34px * var(--lock-expand-progress)), 0);
  }

  .lock-mark {
    width: calc(64px + 34px * var(--lock-expand-progress));
    height: calc(64px + 34px * var(--lock-expand-progress));
  }

  .lock-clock {
    font-size: calc(18px + 40px * var(--lock-expand-progress));
  }
}

@media (max-width: 700px) and (max-height: 520px) {
  .lock-dashboard {
    grid-template: "center" minmax(0, 1fr) / minmax(0, 1fr);
    overflow-x: hidden;
  }

  .lock-dashboard-left,
  .lock-dashboard-right {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lock-surface {
    will-change: auto;
  }
}
