:root { --dim: 0.25; --blur: 0px; --scale: 1; }
* {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
html, body { height: 100%; overflow: hidden; background: #000; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; }
@media (display-mode: standalone) { html, body { height: 100vh; } }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
/* The lock screen stays loaded in the background, so it appears fully drawn. */
#perform[hidden] { display: block !important; visibility: hidden; }
.screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; }

/* Landing page */
#home { background: linear-gradient(#474f59, #3d434b); }
.landing { position: absolute; left: 50%; top: 0; width: 393px; height: 852px;
  transform-origin: top center; transform: translateX(-50%) scale(var(--scale)); }
.landing > * { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.logo { top: 178px; width: 172px; height: 172px; border-radius: 38px;
  box-shadow: 0 14px 26px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1); }
.brand { top: 413px; font-size: 56px; line-height: 66px; font-weight: 600; color: #f2f2f4; }
.by { top: 481px; font-size: 27px; line-height: 34px; color: #999da4; }
.start, .face, .gear { display: flex; align-items: center; justify-content: center; background: #24272b; color: #dcdde0; }
.start:active, .face:active, .gear:active { filter: brightness(1.3); }
.start { top: 573px; width: 268px; height: 69px; border-radius: 17px; gap: 14px; font-size: 31px !important; }
.start svg { width: 40px; height: 40px; fill: currentColor; stroke: none; }
.start .wand { stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; }
.start path:not(.wand) { stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; }
.face { top: 658px; width: 268px; height: 49px; border-radius: 14px; border: 2px solid #c9cbce; gap: 12px; font-size: 21px !important; }
.face svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.gear { top: 724px; width: 150px; height: 45px; border-radius: 12px; gap: 10px; font-size: 21px !important; color: #b9bbc0; }
.gear svg { width: 25px; height: 25px; fill: currentColor; }
.note { top: 786px; font-size: 14px; color: #c9cbce; }

/* Settings pages */
.page { display: flex; flex-direction: column; background: linear-gradient(#4b535c, #2b2e33); }
.nav { flex-shrink: 0; display: grid; grid-template-columns: 72px 1fr 72px; align-items: center;
  background: #222529; padding: calc(env(safe-area-inset-top) + 6px) 10px 6px; min-height: 52px; }
.nav h1 { font-size: 20px; font-weight: 600; text-align: center; white-space: nowrap; }
.nav button { height: 44px; color: #b09a86; font-size: 20px; }
.nav-back { justify-self: start; width: 44px; }
.nav-back svg { width: 12px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-done { justify-self: end; }
.content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 36px 17px calc(env(safe-area-inset-bottom) + 24px); }
.card { flex-shrink: 0; width: 100%; max-width: 420px; min-height: 102px; border-radius: 22px; background: #25272b;
  display: flex; align-items: center; justify-content: space-between; padding: 14px 22px 14px 92px;
  text-align: left; font-size: 24px !important; line-height: 30px; color: #e9e9ec; }
.card:nth-child(-n+2) { min-height: 124px; }
.card:active { filter: brightness(1.3); }
.chev { width: 10px; height: 18px; flex-shrink: 0; fill: none; stroke: #74777d; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.version { margin-top: auto; flex-shrink: 0; padding: 9px 14px; border-radius: 12px; background: #25272b; color: #8f9298; font-size: 15px; }
.btn { display: block; width: 100%; max-width: 360px; flex-shrink: 0; padding: 16px; border-radius: 16px;
  background: #25272b; text-align: center; font-size: 17px; font-weight: 600; cursor: pointer; }
.danger { color: #ff6961; }
.preview { width: 170px; aspect-ratio: 393 / 852; flex-shrink: 0; border-radius: 24px; border: 1px solid #5a6069;
  background: #1c1e21 center / cover no-repeat; display: grid; place-items: center; color: #8f9298; font-size: 13px; }
.preview.filled span { display: none; }
.range { width: 100%; max-width: 360px; display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: #b09a86; }
.hint { color: #b4b7bd; font-size: 13px; text-align: center; max-width: 320px; }
.status:empty { display: none; }

/* Lock screen */
#perform { touch-action: none; background: #000; }
#wall { position: absolute; inset: -60px; background: linear-gradient(#303a45, #101216) center / cover no-repeat;
  filter: blur(var(--blur)); }
#wall[style*="url"] { inset: 0; }
#shade { position: absolute; inset: 0; background: rgba(0, 0, 0, var(--dim)); }
#stage { position: absolute; left: 50%; top: 0; width: 393px; height: 852px;
  transform-origin: top center; transform: translateX(-50%) scale(var(--scale)); }
#stage > * { position: absolute; }

.title { top: 135px; left: 60px; width: 273px; height: 60px; text-align: center; font-size: 21.5px; line-height: 60px;
  touch-action: manipulation; cursor: pointer; }
#dots { top: 196.5px; left: 0; width: 100%; justify-content: center; display: flex; gap: 24px; }
#dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.3px solid #fff; }
#dots i.on { background: #fff; }
#dots.shake { animation: shake 0.45s linear; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45% { transform: translateX(-28px); }
  30%, 60% { transform: translateX(28px); }
  75% { transform: translateX(-12px); }
  88% { transform: translateX(8px); }
}

#keys { left: 56px; top: 293px; width: 281px; display: grid;
  grid-template-columns: repeat(3, 78px); grid-auto-rows: 78px; gap: 17.5px 23.5px; }
.key { position: relative; width: 78px; height: 78px; border-radius: 50%; overflow: hidden;
  background-color: transparent; background-image: var(--frost, none); background-size: var(--frost-size, auto);
  background-repeat: no-repeat;
  box-shadow: inset 0 0.7px 1px rgba(255,255,255,0.65), inset 0 -0.7px 1px rgba(255,255,255,0.4),
    inset 0 0 10px rgba(255,255,255,0.08); }
/* white glass tint, brighter while touched; also carries the rim highlight */
.key::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: rgba(255,255,255,0.14);
  box-shadow: inset 0 0.7px 1px rgba(255,255,255,0.65), inset 0 -0.7px 1px rgba(255,255,255,0.4),
    inset 0 0 10px rgba(255,255,255,0.08); transition: background 0.35s; }
.key.down::before { background: rgba(255,255,255,0.55); transition: none; }
.key.zero { grid-column: 2; }
.key b { position: absolute; left: 0; right: 0; top: 9px; font-size: 38px; line-height: 46px; font-weight: 400; }
.key small { position: absolute; left: 0; right: 0; top: 49px; font-size: 10px; line-height: 13px;
  font-weight: 700; letter-spacing: 2.6px; text-indent: 2.6px; }
.key.zero b { top: 16px; }

.text-btn { top: 770px; width: 110px; height: 30px; font-size: 16.5px !important; }
#emergency { left: 40px; }
#cancel { left: 243px; }

/* Unlock animation (movement is in main.js) */
#unlocked { position: absolute; inset: 0; background: #000; touch-action: none; visibility: hidden; pointer-events: none; }
#lock { position: absolute; inset: 0; overflow: hidden; }
.open #unlocked { visibility: visible; pointer-events: auto; }
.open #lock { pointer-events: none; }
#sheet { position: absolute; left: 0; right: 0; top: -120px; bottom: 0; opacity: 0; pointer-events: none;
  border-radius: 0 0 52px 52px; background: rgba(255,255,255,0.07);
  box-shadow: inset 0 -1px 1px rgba(255,255,255,0.45), inset 0 -18px 26px -18px rgba(255,255,255,0.25), 0 8px 24px rgba(0,0,0,0.15); }
#sheet i { position: absolute; left: 50%; bottom: 10px; width: 140px; height: 5px; margin-left: -70px;
  border-radius: 3px; background: #fff; }
#veil { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* Unlocked home screen, same 393 x 852 design as the lock screen */
#pager { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior: contain; touch-action: pan-x; scrollbar-width: none; }
#pager::-webkit-scrollbar { display: none; }
.slide { position: relative; flex: 0 0 100%; height: 100%; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always; }
.shot { background: center / cover no-repeat; }
#homeWall { position: absolute; inset: -80px; background: center / cover no-repeat; filter: blur(var(--home-blur, 20px)); }
#apps { position: absolute; left: 50%; top: 0; width: 393px; height: 852px;
  transform-origin: top center; transform: translateX(-50%) scale(var(--scale)); }
.app { position: absolute; width: 75px; height: 75px; -webkit-user-drag: none; }
.badge { position: absolute; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: #ea4b47;
  font-size: 16px; line-height: 26px; text-align: center; white-space: nowrap; pointer-events: none; }

/* Peek history */
#history { list-style: none; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
#history li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px;
  background: #25272b; border-radius: 16px; padding: 14px 16px; }
#history b { font-size: 24px; letter-spacing: 3px; font-weight: 600; }
#history time { font-size: 13px; color: #8f9298; }
#history input { grid-column: 1 / -1; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #41454b;
  background: #1c1e21; color: #fff; font: inherit; font-size: 16px; -webkit-user-select: text; user-select: text; }
.history { gap: 12px; padding-top: 20px; }
