/* The Studio shell: layout and behaviour. Every colour, font and radius comes from a style's tokens
   (styles/*.css), so this file is the same for every style. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font-ui);
  color: var(--text);
  background: var(--stars), var(--wall);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.display { font-family: var(--font-display); font-weight: var(--display-weight); font-style: var(--display-style); letter-spacing: -.01em; }
.display em { font-style: italic; color: var(--accent); }
.eyebrow { font: 500 11px/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.eyebrow i { font-style: normal; opacity: .6; padding: 0 .2em; }
.lede { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0; }
.empty { color: var(--faint); text-align: center; padding: 32px 0; margin: 0; }
.broken { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }

/* ---- shared pieces ---------------------------------------------------------------------------- */
/* App icons: one flat colour, a white glyph, a hairline edge. No gloss and no coloured glow, so a
   row of them reads as a system's own apps. An uploaded image fills the same shape. */
.tile {
  display: inline-grid; place-items: center; flex: none; color: #fff; overflow: hidden;
  border-radius: var(--r-tile); background: var(--t);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .14);
}
.tile-sm { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.tile-md { width: 40px; height: 40px; }
.tile-lg { width: 56px; height: 56px; }
.tile.has-image { background: #fff; }
.tile.has-image img { width: 100%; height: 100%; object-fit: cover; }
.tile[data-color="red"]    { --t: #ff3b30; }
.tile[data-color="orange"] { --t: #ff9500; }
.tile[data-color="yellow"] { --t: #ffcc00; }
.tile[data-color="green"]  { --t: #34c759; }
.tile[data-color="teal"]   { --t: #30b0c7; }
.tile[data-color="blue"]   { --t: #0a7aff; }
.tile[data-color="indigo"] { --t: #5856d6; }
.tile[data-color="purple"] { --t: #af52de; }
.tile[data-color="pink"]   { --t: #ff2d55; }
.tile[data-color="gray"]   { --t: #8e8e93; }
.tile[data-color="dark"]   { --t: #1c1c1e; }
.tile[data-color="white"]  { --t: #fff; color: #1c1c1e; }

.avatar {
  display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 30%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 40%, #5b3df0));
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-initials b { color: #fff; font: 600 1em/1 var(--font-ui); letter-spacing: .02em; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: var(--r-btn); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: transform .12s, background .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--text);
}
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-static { color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 11px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--glass-line); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.pill-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); margin: 0; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

.list { display: grid; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px;
  border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text);
  transition: border-color .12s, transform .12s;
}
.list-row:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.list-row .tile-sm { width: 30px; height: 30px; border-radius: 8px; }
.list-text { flex: 1; min-width: 0; display: grid; }
.list-text b { font-weight: 600; font-size: 14.5px; }
.list-text small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-end { color: var(--faint); display: inline-grid; }

.badge {
  position: fixed; right: 16px; bottom: 16px; z-index: 5; padding: 5px 11px; border-radius: 99px;
  font-size: 12px; color: var(--muted); text-decoration: none; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

/* ---- app contents ------------------------------------------------------------------------------ */
.about { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 30px 28px 28px; }
.about-avatar { width: 112px; height: 112px; font-size: 34px; margin-bottom: 8px; }
.about h2 { font-size: 38px; line-height: 1; margin: 0; }
.about .lede { margin-top: 8px; font-size: 15px; text-align: left; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.social {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px 0 5px; border-radius: 99px;
  border: 1px solid var(--line-strong); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.social:hover { background: var(--surface-2); }
.social-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--surface); }
.social-ic svg { width: 15px; height: 15px; }
.pad { padding: 16px; }

/* Phone, Messages, Mail, Maps */
.utility { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 30px 24px 26px; }
.utility .tile-lg { width: 64px; height: 64px; margin-bottom: 4px; }
.utility-value { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; user-select: all; overflow-wrap: anywhere; }
.row.mid { justify-content: center; margin-top: 8px; }

/* Photos */
.tabs { display: flex; gap: 4px; padding: 12px 14px 0; overflow-x: auto; }
.tabs button { padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 3px; padding: 12px; }
.photo { aspect-ratio: 1; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photo:hover img { transform: scale(1.04); }
.photo-view { padding: 12px 16px 18px; display: grid; gap: 10px; }
.photo-view img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 8px; background: var(--surface-sunk); }
.photo-view p { margin: 0; color: var(--muted); font-size: 14px; }
.photo-close { display: inline-flex; align-items: center; gap: 2px; justify-self: start; color: var(--accent); font-weight: 600; font-size: 14px; }

/* Business apps */
.biz { display: grid; gap: 16px; padding: 20px 22px 24px; }
.biz-head { display: flex; align-items: center; gap: 14px; }
.biz-head .tile-lg { width: 64px; height: 64px; }
.biz-head h3 { margin: 2px 0 0; font-size: 32px; line-height: 1; }
.biz-tag { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.datecard { width: 64px; height: 64px; flex: none; border-radius: 14px; overflow: hidden; display: grid; grid-template-rows: 20px 1fr; text-align: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.datecard small { background: #ff3b30; color: #fff; font: 700 10.5px/20px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.datecard b { font: 600 28px/44px var(--font-ui); letter-spacing: -.02em; }
.promo-art { margin: -20px -22px 0; background: var(--surface-sunk); }
.promo-art img { width: 100%; max-height: 300px; object-fit: contain; }
.offer { margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.offer b { font: var(--display-weight) 24px/1.15 var(--font-display); }
.offer span { color: var(--accent); font-weight: 700; }
.facts { display: grid; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.fact { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; color: var(--muted); }
.fact + .fact { border-top: 1px solid var(--line); }
.fact svg { margin-top: 2px; flex: none; }
.fact span { display: grid; color: var(--text); font-size: 14.5px; }
.fact small { color: var(--muted); font-size: 11.5px; }
.fact a { color: var(--accent); text-decoration: none; }
.biz .lede { font-size: 15px; }
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -22px; padding: 0 22px; scrollbar-width: none; }
.strip img { height: 150px; border-radius: 10px; flex: none; }
.biz-notices { display: grid; gap: 8px; }

/* Notices: the same card as a banner, in the center, on the lock screen and on a business page */
.notice { display: block; width: 100%; text-align: left; text-decoration: none; color: var(--text); }
.notice-in, .notice-inline {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 13px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
}
.notice-inline { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 25%, transparent); backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: var(--r-card); }
.notice-rich { display: grid; gap: 10px; padding: 12px; }
.notice-img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }
.notice-video { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #111; }
.notice-video button { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; color: #fff; font-weight: 600; }
.notice-video button svg { width: 54px; height: 54px; padding: 12px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.notice-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.notice-btn { justify-self: start; }
.notice .tile-sm { width: 34px; height: 34px; border-radius: 9px; }
.notice .tile-sm svg { width: 19px; height: 19px; }
.notice-text { display: grid; gap: 1px; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.notice-text small { font: 500 10.5px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.notice-text b { font-size: 14px; }
.notice-text span { color: var(--muted); }
.notice-text em { font-style: normal; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dot {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: #ff3b30; color: #fff; font: 700 11px/19px var(--font-ui); font-style: normal; text-align: center;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 60%, transparent);
}
.icon-wrap, .bell { position: relative; display: inline-grid; }
.bell .dot { top: -2px; right: -4px; min-width: 15px; height: 15px; font-size: 9.5px; line-height: 15px; padding: 0 4px; }

.music { display: grid; gap: 12px; padding: 14px; }
.music-cover { aspect-ratio: 2.3 / 1; border-radius: 10px; background: linear-gradient(120deg, #b58cff, #ff6e4a) center / cover; }
.music-row { display: flex; align-items: center; gap: 10px; }
.music-text { flex: 1; display: grid; }
.music-text b { font-size: 14px; }
.music-text small { color: var(--muted); font-size: 12.5px; }
.play { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--text); }
.play:hover { border-color: var(--accent); color: var(--accent); }

.note-page { padding: 26px; background: var(--sticky); color: var(--sticky-ink); min-height: 180px; }
.note-page p { margin: 0; font: 24px/1.25 var(--font-display); }
.text-page { padding: 22px 26px; display: grid; gap: 12px; }
.text-page p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

/* ---- desktop ----------------------------------------------------------------------------------- */
#studio.is-desktop { position: fixed; inset: 0; }
.menubar {
  position: fixed; inset: 0 0 auto; height: 30px; z-index: 50; display: flex; align-items: center; gap: 4px; padding: 0 14px;
  background: var(--menubar); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.mb-avatar { width: 18px; height: 18px; font-size: 7px; }
.mb-name { margin: 0 10px 0 8px; font-weight: 700; }
.mb-items { display: flex; gap: 2px; }
.mb-items button { padding: 3px 9px; border-radius: 6px; }
.mb-items button:hover { background: var(--line); }
.mb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mb-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--text); }
.mb-icon:hover { background: var(--line); }
.mb-clock { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }

.icons {
  position: fixed; top: 46px; left: 18px; bottom: 120px; z-index: 2;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 92px); grid-auto-columns: 84px; gap: 0;
}
.icon { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 4px 2px 2px; border-radius: 12px; }
/* One line under each icon, cut with an ellipsis, so every row of the grid is the same height. */
.icon > span:last-child { font-size: 12px; font-weight: 600; text-shadow: 0 1px 6px var(--glass); max-width: 80px; text-align: center; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon:hover .tile { transform: translateY(-2px); }
.icon .tile { transition: transform .15s; }

.widgets { transition: transform .35s cubic-bezier(.2, .8, .2, 1); position: fixed; top: 52px; right: 28px; width: 300px; z-index: 3; display: grid; gap: 28px; justify-items: end; }
.sticky {
  width: 200px; padding: 16px 18px 20px; background: var(--sticky); color: var(--sticky-ink);
  transform: rotate(1.5deg); box-shadow: var(--shadow-soft); border-radius: 2px;
}
.sticky small { display: block; font: 500 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; opacity: .7; margin-bottom: 10px; }
.sticky p { margin: 0; font: 19px/1.2 var(--font-display); }
.widget { width: 300px; border-radius: var(--r-win); background: var(--surface); box-shadow: var(--shadow-win); overflow: hidden; }
.widget-bar, .window-bar {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13.5px;
}
.widget-bar .tile-sm, .window-bar .tile-sm { width: 18px; height: 18px; border-radius: 5px; }
.widget-bar .tile-sm svg, .window-bar .tile-sm svg { width: 12px; height: 12px; }
.photo-widget { position: relative; width: 240px; aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-soft); display: block; }
.photo-widget img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s ease; }
.photo-widget img.is-on { opacity: 1; }
.photo-widget-label { position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.center, .toasts { position: fixed; top: 38px; right: 12px; width: 340px; z-index: 70; }
.center { padding: 14px; border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-win); backdrop-filter: blur(30px) saturate(1.5); -webkit-backdrop-filter: blur(30px) saturate(1.5); max-height: calc(100vh - 140px); overflow: auto; }
.center h2 { margin: 2px 4px 10px; font: 700 13px/1 var(--font-ui); color: var(--muted); }
.center-list { display: grid; gap: 8px; }
.center .notice-in { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); }
.toasts { display: grid; gap: 8px; z-index: 65; pointer-events: none; }
.toasts .notice { pointer-events: auto; opacity: 0; transform: translateX(24px); transition: opacity .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-soft); border-radius: 16px; }
.toasts.is-on .notice { opacity: 1; transform: none; }
.toasts.is-on .notice:nth-child(2) { transition-delay: .08s; }
.toasts.is-on .notice:nth-child(3) { transition-delay: .16s; }
.toasts:not(.is-on) .notice { pointer-events: none; }

.windows { position: fixed; inset: 30px 0 0; z-index: 10; pointer-events: none; }
.window {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  max-height: calc(100vh - 230px); border-radius: var(--r-win); background: var(--surface); box-shadow: var(--shadow-win);
  overflow: hidden; opacity: 0; transform: scale(.97) translateY(6px); transition: opacity .16s, transform .16s;
}
.window.is-open { opacity: 1; transform: none; }
.window.is-max { left: 10px !important; top: 10px !important; width: calc(100vw - 20px) !important; max-height: calc(100vh - 130px); height: calc(100vh - 130px); }
.window-bar { cursor: grab; user-select: none; touch-action: none; }
.window-bar:active { cursor: grabbing; }
.window-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window-btns { display: flex; gap: 2px; color: var(--muted); }
.window-btns button { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 6px; }
.window-btns button:hover { background: var(--line); color: var(--text); }
.window-btns [data-act="close"]:hover { background: #ef4444; color: #fff; }
.window-body { overflow: auto; flex: 1; outline: none; }
.window:not(.is-front) .window-bar { color: var(--muted); }

.dock {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
}
.dock-item { position: relative; padding: 2px; transition: transform .15s; }
.dock-item:hover { transform: translateY(-4px) scale(1.06); }

/* ---- share ------------------------------------------------------------------------------------- */
.share { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 10px 8px 8px; }
.share-qr { width: 200px; height: 200px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.share-qr svg { display: block; width: 100%; height: 100%; }
.share-hint { margin: 8px 0 0; font-weight: 600; font-size: 14px; }
.share-url { margin: 0; color: var(--muted); font-size: 13px; user-select: all; overflow-wrap: anywhere; }
.share-pop { width: 300px; right: 150px; background: var(--surface); }
.sheet-share .share { padding: 28px 20px; }

/* ---- simple view ------------------------------------------------------------------------------- */
#studio.is-simple { position: fixed; inset: 0; overflow: auto; }
.simple { max-width: 520px; margin: 0 auto; padding: 18px 18px 90px; }
.simple-top { display: flex; justify-content: flex-end; }
.simple-head { display: grid; justify-items: center; gap: 8px; text-align: center; margin: 18px 0 26px; }
.simple-avatar { width: 84px; height: 84px; font-size: 26px; }
.simple-head h1 { font-size: 42px; line-height: 1; margin: 6px 0 0; }

/* ---- phone ------------------------------------------------------------------------------------- */
#studio.is-phone { position: fixed; inset: 0; overflow: auto; padding: max(12px, env(safe-area-inset-top)) 18px 130px; }
.ph-top { display: flex; align-items: center; gap: 8px; height: 40px; }
.ph-top b { font-size: 16px; font-weight: 700; }
.ph-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ph-card {
  width: 100%; margin: 4px 0 14px; padding: 12px 14px; border-radius: 18px; text-align: left;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.ph-avatar { width: 54px; height: 54px; font-size: 18px; grid-row: span 1; }
.ph-who { display: grid; gap: 2px; min-width: 0; }
.ph-who b { font-size: 26px; line-height: 1.05; }
.ph-who small { font-size: 10px; }
.ph-card .status { grid-column: 1 / -1; margin-top: 8px; font-size: 13px; }
.ph-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 2px; }
.ph-grid .icon > span:last-child { font-size: 11.5px; font-weight: 500; max-width: 100%; }
.ph-grid .tile-lg { width: 58px; height: 58px; }
.ph-dock {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20;
  display: flex; justify-content: space-around; padding: 12px; border-radius: 30px;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
}
.ph-dock .dock-item { position: relative; }
#studio.is-phone .badge { position: static; display: table; margin: 28px auto 0; }

.sheet {
  position: fixed; inset: max(30px, env(safe-area-inset-top)) 0 0; z-index: 60; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.45);
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.sheet.is-open { transform: none; }
.sheet-grab { display: grid; place-items: center; height: 18px; touch-action: none; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet-bar { display: flex; align-items: center; padding: 0 18px 10px; border-bottom: 1px solid var(--line); touch-action: none; }
.sheet-bar h2 { margin: 0; font: 700 17px/34px var(--font-ui); flex: 1; }
.sheet-close { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.sheet-body { flex: 1; overflow: auto; outline: none; padding-bottom: env(safe-area-inset-bottom); }
/* Over the owner's own background, names and the phone's top bar are white (on a photo or a dark
   colour) or dark (on a light colour), whatever the mode. */
html.wall-dark .icon > span:last-child, html.wall-dark .ph-top { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .75); }
html.wall-dark .ph-top .mb-icon { color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
html.wall-light .icon > span:last-child, html.wall-light .ph-top, html.wall-light .ph-top .mb-icon { color: #17161a; text-shadow: none; }

/* An app on a phone: full screen, grown out of its icon (main.js sets the origin). */
.appscreen {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--surface); overflow: hidden;
  transform: scale(.14); opacity: 0; border-radius: 44px; pointer-events: none;
  transition: transform .3s cubic-bezier(.2, .85, .25, 1), opacity .18s ease, border-radius .3s;
}
.appscreen.is-open { transform: none; opacity: 1; border-radius: 0; pointer-events: auto; }
.app-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 46px; padding: max(0px, env(safe-area-inset-top)) 8px 0; border-bottom: 1px solid var(--line); flex: none; box-sizing: content-box; }
.app-bar h2 { margin: 0; font: 700 16px/1 var(--font-ui); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 56vw; }
.app-back { justify-self: start; display: inline-flex; align-items: center; gap: 1px; height: 36px; padding: 0 8px 0 2px; border-radius: 9px; color: var(--accent); font-weight: 600; font-size: 15px; }
.appscreen .sheet-body { padding-bottom: 26px; }
.app-home { position: absolute; left: 0; right: 0; bottom: 0; height: 24px; display: grid; place-items: center; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box; touch-action: none; }
.app-home i { width: 128px; height: 5px; border-radius: 3px; background: var(--text); opacity: .28; }
.appscreen .note-page { min-height: 100%; }
.sheet-center .notice-in { background: var(--surface-2); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); }
#studio.is-phone .photo-widget { width: 100%; aspect-ratio: 16 / 9; margin: 0 0 16px; }

.lock {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; padding: max(56px, env(safe-area-inset-top)) 22px 28px;
  background: var(--stars), var(--wall); transition: transform .32s cubic-bezier(.3, 0, .2, 1), opacity .32s;
}
.lock.is-gone { transform: translateY(-100%); opacity: 0; }
.lock-time { margin: 6px 0 26px; font-size: 104px; line-height: .86; display: grid; }
.lock-time em { font-style: italic; color: var(--accent); }
.lock-list { display: grid; gap: 10px; }
.lock:focus { outline: none; }
.lock-open { margin-top: auto; align-self: center; font: 500 11px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 14px; }
.sheet .note-page { min-height: 100%; }

/* ---- loading screen ---------------------------------------------------------------------------- */
.loading {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--stars), var(--wall); transition: opacity .4s ease;
}
.loading.is-done { opacity: 0; pointer-events: none; }
.loading-center { display: grid; justify-items: center; gap: 10px; text-align: center; }
.loading-avatar { width: 88px; height: 88px; font-size: 28px; animation: pulse 1.6s ease-in-out infinite; }
.loading-name { font-size: 40px; line-height: 1; margin: 10px 0 0; }
.loading-msg { margin: 0; color: var(--muted); font-size: 14px; }
.loading-bar { width: 140px; height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; margin-top: 10px; }
.loading-bar i { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: inherit; animation: slide 1.1s ease-in-out infinite; }
.loading-chexi { position: absolute; bottom: 22px; font: 600 13px/1 var(--font-ui); letter-spacing: .02em; color: var(--faint); }
.loading[data-preset="boot"] .loading-avatar { animation: none; border-radius: 16px; }
.loading[data-preset="boot"] .loading-msg { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 12%, transparent); } }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* ---- age gate ---------------------------------------------------------------------------------- */
.gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--surface-sunk) 70%, transparent);
  backdrop-filter: blur(28px) saturate(1.2); -webkit-backdrop-filter: blur(28px) saturate(1.2);
  opacity: 0; transition: opacity .3s;
}
.gate.is-on { opacity: 1; }
.gate.is-gone { opacity: 0; pointer-events: none; }
.gate-card {
  width: min(400px, 100%); padding: 34px 28px 26px; border-radius: 18px; text-align: center;
  background: var(--surface); box-shadow: var(--shadow-win); display: grid; gap: 14px; justify-items: center;
}
.gate-age { margin: 0; font-size: 72px; line-height: .9; color: var(--accent); }
.gate-msg { margin: 0; color: var(--muted); font-size: 15px; }
.gate-row { display: grid; gap: 8px; width: 100%; margin-top: 6px; }
.gate-row .btn { justify-content: center; height: 48px; font-size: 15px; }
.gate-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gate-remember input { accent-color: var(--accent); width: 16px; height: 16px; }
.gate-deny { margin: 0; font-weight: 600; }
html.is-gated #studio { visibility: hidden; }
html.is-gated .loading { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
