:root {
  --bg: #fbfbfc;
  --ink: #2f3140;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sys: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --mb: 30px;
  --accent: #0a74ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body { font-family: var(--mono); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; -webkit-user-drag: none; }

/* ====================================================== HOME */
#home {
  position: fixed; inset: 0; z-index: 1;
  padding: clamp(24px, 4.2vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
}
#stampSlot { width: clamp(150px, 17vw, 250px); aspect-ratio: 4 / 5; flex: none; }
#homeText {
  max-width: min(980px, 100%);
  font-size: clamp(14px, 1.72vw, 25px); font-weight: 400;
  line-height: 1.85; letter-spacing: -.012em; will-change: opacity, transform;
}
#homeText p + p { margin-top: 1.6em; }
#homeText a { color: inherit; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
#homeText a:hover { opacity: .65; }
#hint {
  position: fixed; right: clamp(24px, 4vw, 64px); bottom: clamp(20px, 3.4vw, 48px);
  font-size: 13px; letter-spacing: .04em; opacity: .7; padding: 8px 4px;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(5px); } }
body.on-desktop #hint { display: none; }

/* ====================================================== THE STAMP / CARD */
#cardWrap {
  position: fixed; z-index: 50; pointer-events: none;
  filter: drop-shadow(0 16px 20px rgba(32, 34, 52, .2)) drop-shadow(0 2px 3px rgba(32, 34, 52, .16));
  will-change: transform, left, top, width, height;
}
#cardWrap.flat { filter: none; }
#card { position: absolute; inset: 0; background: #fff; overflow: hidden; }
#card.perf {
  --pr: 6px; --ps: 18px;
  -webkit-mask:
    radial-gradient(circle at 50% 0, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / var(--ps) 100% round no-repeat,
    radial-gradient(circle at 50% 100%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / var(--ps) 100% round no-repeat,
    radial-gradient(circle at 0 50%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / 100% var(--ps) no-repeat round,
    radial-gradient(circle at 100% 50%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / 100% var(--ps) no-repeat round;
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle at 50% 0, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / var(--ps) 100% round no-repeat,
    radial-gradient(circle at 50% 100%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / var(--ps) 100% round no-repeat,
    radial-gradient(circle at 0 50%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / 100% var(--ps) no-repeat round,
    radial-gradient(circle at 100% 50%, #0000 var(--pr), #000 calc(var(--pr) + .6px)) 0 0 / 100% var(--ps) no-repeat round;
  mask-composite: intersect;
}
#front, #back { position: absolute; inset: var(--pad, 14px); overflow: hidden; }
#front img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
#back { background: var(--bg); }

/* ====================================================== DESKTOP */
#desktop {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden;
  background: var(--bg); color: #1d1d1f; font-family: var(--sys); font-size: 13px;
  -webkit-user-select: none; user-select: none;
}

/* menu bar */
#menubar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--mb); z-index: 9500;
  display: flex; justify-content: space-between; align-items: center; padding: 0 10px;
  background: rgba(251, 251, 252, .55); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8);
  font-size: 13.5px; font-weight: 500;
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 2px; }
.mb-item { padding: 3px 9px; border-radius: 6px; line-height: 1.2; display: inline-flex; align-items: center; }
.mb-left .mb-item:hover, .mb-apple.open { background: rgba(0, 0, 0, .08); }
.mb-app { font-weight: 700; }
.mb-dim { font-weight: 400; }
.mb-apple { padding: 3px 11px; }
.mb-right { gap: 0; }
.mb-right .mb-clock { padding: 3px 9px 3px 4px; }
.mb-glyph { display: inline-flex; align-items: center; height: 24px; }
.dd {
  position: absolute; left: 8px; top: calc(var(--mb) - 2px); min-width: 230px; padding: 6px;
  border-radius: 12px; background: rgba(250, 250, 252, .85);
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22), 0 0 0 .5px rgba(0, 0, 0, .14);
  font-weight: 400; font-size: 13.5px; animation: pop .14s ease-out;
}
.dd[hidden] { display: none; }
.dd button { display: block; width: 100%; text-align: left; padding: 5px 10px; border-radius: 6px; }
.dd button:hover { background: var(--accent); color: #fff; }
.dd hr { border: 0; height: 1px; background: rgba(0, 0, 0, .1); margin: 5px 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* kit glyphs drawn via mask so they follow the text colour */
.mbi { display: inline-block; flex: none; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.dimg img { width: 100%; height: 100%; object-fit: contain; }
.dimg img[src$='/txt.png'], .fi > img { mix-blend-mode: multiply; }
.fi { position: relative; width: 100%; height: 100%; }
.fi > img { position: absolute; inset: 0; }
.fi-b { position: absolute; left: 33%; top: 38%; width: 30%; height: 30%; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.fi-b > * { width: 100%; height: 100%; display: block; }

/* desktop icons (left column, medium size) */
#icons { position: absolute; inset: 0; pointer-events: none; }
.dicon { position: absolute; width: 112px; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; border-radius: 10px; outline: 0; cursor: default; touch-action: none; }
.dicon.dragging { opacity: .85; z-index: 5; }
.dicon.dragging .dimg { transform: scale(1.05); }
.dicon .dimg { width: 84px; height: 84px; }
.dicon .dimg svg { width: 100%; height: 100%; }
.dname { font-size: 12.5px; line-height: 1.25; text-align: center; max-width: 108px; word-break: break-word; }
.dname span { padding: 1.5px 6px; border-radius: 5px; display: inline-block; }
.dicon.sel .dimg, .dicon:focus-visible .dimg { background: rgba(0, 0, 0, .1); border-radius: 12px; }
.dicon.sel .dname span, .dicon:focus-visible .dname span { background: var(--accent); color: #fff; }
.dhint { position: absolute; width: 112px; font-size: 11px; color: #8d90a0; text-align: center; pointer-events: none; animation: hintIn 1s 1.2s both; transition: opacity .3s; }
.dhint.gone { opacity: 0 !important; animation: none; }
@keyframes hintIn { from { opacity: 0; } to { opacity: 1; } }

/* ====================================================== DOCK */
#dock {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 9000;
  display: flex; align-items: flex-end; justify-content: center; gap: 8px; padding: 9px 12px; height: 76px; box-sizing: border-box; transition: width .14s ease-out;
  border-radius: 26px;
  background: rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(28px) saturate(1.9); backdrop-filter: blur(28px) saturate(1.9);
  box-shadow: 0 10px 30px rgba(30, 32, 50, .16), inset 0 0 0 .5px rgba(255, 255, 255, .9), 0 0 0 .5px rgba(0, 0, 0, .12);
}
.ditem { position: relative; width: 56px; height: 56px; flex: none; transform-origin: 50% 100%; will-change: transform; touch-action: none; transition: transform .14s ease-out; }
.ditem.dragging { transition: none; z-index: 3; cursor: grabbing; }
.ditem .dimg, .ditem .dimg svg { width: 100%; height: 100%; }
.ditem .dimg { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .22)); }
.ditem .dot { position: absolute; left: 50%; bottom: -7px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(0, 0, 0, .55); opacity: 0; }
.ditem.run .dot { opacity: 1; }
.reordering { transition: none; }
.ditem.bounce .dimg { animation: bounce .55s cubic-bezier(.3, 0, .4, 1) 2; }
@keyframes bounce { 50% { transform: translateY(-24px); } }
.dtip {
  position: absolute; z-index: 9100; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity .12s;
  padding: 5px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; white-space: nowrap;
  background: rgba(250, 250, 252, .8); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .12);
}
.dtip.show { opacity: 1; }

/* ====================================================== LAUNCHPAD */
.launchpad {
  position: absolute; inset: 0; z-index: 9400; display: none; align-items: center; justify-content: center;
  background: rgba(251, 251, 252, .55); -webkit-backdrop-filter: blur(40px) saturate(1.6); backdrop-filter: blur(40px) saturate(1.6);
}
.launchpad.on { display: flex; animation: lpIn .3s cubic-bezier(.2, .8, .3, 1); }
.launchpad.out { animation: lpOut .22s cubic-bezier(.4, 0, .7, .6) forwards; pointer-events: none; }
@keyframes lpOut { to { opacity: 0; transform: scale(1.08); } }
@keyframes lpIn { from { opacity: 0; transform: scale(1.08); } }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, 120px); gap: 30px 24px; justify-content: center; width: min(760px, 90%); padding-bottom: 60px; }
.lp-app { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.lp-app .dimg { width: 88px; height: 88px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .2)); transition: transform .15s; }
.lp-app:hover .dimg { transform: scale(1.06); }
.lp-app .dimg svg { width: 100%; height: 100%; }

/* ====================================================== WINDOWS */
#windows { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column; border-radius: 22px;
  background: rgba(252, 252, 253, .88); color: #1d1d1f;
  -webkit-backdrop-filter: blur(34px) saturate(1.8); backdrop-filter: blur(34px) saturate(1.8);
  box-shadow: 0 10px 30px rgba(20, 22, 40, .14), 0 0 0 .5px rgba(0, 0, 0, .16), inset 0 0 0 .5px rgba(255, 255, 255, .8);
  overflow: hidden; transition: box-shadow .2s;
}
.win.focus { box-shadow: 0 28px 70px rgba(20, 22, 40, .3), 0 0 0 .5px rgba(0, 0, 0, .2), inset 0 0 0 .5px rgba(255, 255, 255, .8); }
.win.animating { transition: left .34s cubic-bezier(.3, .8, .3, 1), top .34s cubic-bezier(.3, .8, .3, 1), width .34s cubic-bezier(.3, .8, .3, 1), height .34s cubic-bezier(.3, .8, .3, 1); }
.titlebar { position: relative; flex: none; height: 46px; display: flex; align-items: center; padding: 0 16px; gap: 12px; cursor: default; }
.title { position: absolute; left: 90px; right: 90px; text-align: center; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: .85; }
.win:not(.focus) .title { opacity: .45; }
.tb-right { margin-left: auto; display: flex; gap: 4px; z-index: 2; }
.tb-btn { min-width: 30px; height: 28px; padding: 0 8px; border-radius: 14px; font-size: 16px; line-height: 1; background: rgba(0, 0, 0, .05); }
.tb-btn:hover { background: rgba(0, 0, 0, .1); }
.tb-btn.txt { font-size: 13px; font-weight: 500; padding: 0 12px; }
.lights { display: flex; gap: 8px; z-index: 2; }
.l { width: 13px; height: 13px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); background: #c9c9cf; }
.win.focus .l.close { background: #ff5f57; } .win.focus .l.min { background: #febc2e; } .win.focus .l.max { background: #28c840; }
.lights:hover .l.close { background: #ff5f57; } .lights:hover .l.min { background: #febc2e; } .lights:hover .l.max { background: #28c840; }
.lights:hover .l::after { content: ''; position: absolute; inset: 0; background: center / 8px no-repeat; opacity: .6; }
.lights:hover .l.close::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 1.5l5 5m0-5l-5 5' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E"); }
.lights:hover .l.min::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1 4h6' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E"); }
.lights:hover .l.max::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 1.5h3.5L1.5 5zM6.5 6.5H3L6.5 3z' fill='%23000'/%3E%3C/svg%3E"); }
.body { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 0 0 22px 22px; user-select: text; -webkit-user-select: text; }
.rz { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; z-index: 5; }
.win.maxed .rz { display: none; }
.win.resizing { transition: none; }
.win.resizing iframe, .win.resizing video { pointer-events: none; }

/* dark windows */
.win.dark { background: rgba(32, 32, 35, .9); color: #f2f2f4; box-shadow: 0 10px 30px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .5), inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.win.dark.focus { box-shadow: 0 28px 70px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(0, 0, 0, .6), inset 0 0 0 .5px rgba(255, 255, 255, .14); }
.win.dark .tb-btn { background: rgba(255, 255, 255, .1); }

/* ====================================================== APP: Finder */
.finder { display: flex; height: 100%; }
.f-side { width: 176px; flex: none; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; background: rgba(240, 240, 244, .55); border-right: 1px solid rgba(0, 0, 0, .06); }
.f-side button { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px; text-align: left; font-size: 13px; }
.f-side button.on { background: rgba(0, 0, 0, .08); }
.f-ic { width: 16px; height: 14px; border-radius: 3px; background: var(--accent); opacity: .85; }
.f-ic.apps { border-radius: 50%; width: 15px; height: 15px; }
.f-main { flex: 1; overflow: auto; padding: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; background: rgba(255, 255, 255, .6); }
.f-item { width: 108px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 4px; border-radius: 10px; outline: 0; }
.f-item .dimg { width: 64px; height: 64px; }
.f-item .dimg svg { width: 100%; height: 100%; }
.f-item span { font-size: 12px; text-align: center; padding: 1px 6px; border-radius: 5px; }
.f-item.sel { background: rgba(0, 0, 0, .07); }
.f-item.sel span { background: var(--accent); color: #fff; }

/* ====================================================== APP: TextEdit / CV.txt */
.win.paper { background: rgba(255, 255, 255, .96); }
.txt a { color: #0a58c8; text-decoration: underline; text-underline-offset: 2px; }
.txt { height: 100%; overflow: auto; padding: 8px 28px 32px; font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: #24262f; }

/* ====================================================== APP: Terminal */
.win.term-win { background: rgba(18, 18, 20, .88); }
.term { height: 100%; overflow: auto; padding: 4px 16px 16px; font-family: Menlo, 'SF Mono', Consolas, monospace; font-size: 12.5px; line-height: 1.5; color: #e8e8ec; }
.t-row { white-space: pre-wrap; word-break: break-word; }
.t-line { display: flex; }
.t-prompt { white-space: pre; color: #7ee787; }
.t-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: inherit; font: inherit; caret-color: #e8e8ec; }

/* ====================================================== APP: Photo Booth */
.win.pb-win { background: #25282c; color: #f2f2f4; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .5), inset 0 0 0 .5px rgba(255, 255, 255, .1); }
.win.pb-win.focus { box-shadow: 0 28px 70px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(0, 0, 0, .6), inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.win.pb-win .titlebar { height: 42px; background: #25282c; }
.win.pb-win .title { left: 104px; right: 16px; text-align: left; font-size: 15px; font-weight: 700; opacity: .8; }
.pb { display: flex; flex-direction: column; height: 100%; background: #25282c; }
.pb-stage { flex: 1; min-height: 0; position: relative; background: #000; overflow: hidden; }
.pb-stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; display: block; }
.pb-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: #c9c9d0; font-size: 14px; line-height: 1.5; }
.pb-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 150px; font-weight: 700; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); pointer-events: none; }
.pb-count.pop { animation: cd .85s ease-out; }
@keyframes cd { from { transform: scale(1.5); opacity: 0; } 30% { opacity: 1; } to { transform: scale(.9); opacity: .2; } }
.pb-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.pb-flash.go { animation: flash .6s ease-out; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
.pb-bar { flex: none; height: 62px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px; background: #25282c; }
.pb-segs { display: inline-flex; width: max-content; padding: 0; border-radius: 8px; background: #3a3d42; overflow: hidden; }
.pb-seg { width: 32px; height: 26px; display: grid; place-items: center; color: #d5d7dc; }
.pb-seg:hover:not(:disabled):not(.on) { background: rgba(255, 255, 255, .08); }
.pb-seg.on { background: #3b82f6; color: #fff; border-radius: 6px; }
.pb-seg:disabled { opacity: .4; cursor: default; }
.pb-shutter { width: 50px; height: 50px; border-radius: 50%; background: #ff0a0a; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .1s, filter .1s; }
.pb-shutter:hover:not(:disabled) { filter: brightness(1.08); }
.pb-shutter:active:not(:disabled) { transform: scale(.94); filter: brightness(.85); }
.pb-shutter:disabled { opacity: .6; cursor: default; }
.pb-review { position: absolute; inset: 0; z-index: 5; background: rgba(18, 19, 22, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; animation: lpIn .18s ease-out; }
.pb-review[hidden] { display: none; }
.pb-review img { max-width: 100%; max-height: calc(100% - 84px); object-fit: contain; border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.pb-ask { display: flex; align-items: center; gap: 22px; }
.pb-note { font-size: 14px; font-weight: 500; }
.pb-btns { display: flex; gap: 10px; }
.pb-btn { min-width: 92px; height: 32px; padding: 0 18px; border-radius: 9px; background: #3a3d42; color: #f2f2f4; font-size: 13.5px; font-weight: 500; }
.pb-btn:hover:not(:disabled) { background: #4a4d53; }
.pb-btn.primary { background: #3b82f6; color: #fff; }
.pb-btn.primary:hover:not(:disabled) { background: #5593f8; }
.pb-btn:disabled { opacity: .6; cursor: default; }

/* ====================================================== APP: Notes */
.notes { display: flex; height: 100%; }
.n-side { width: 250px; flex: none; display: flex; flex-direction: column; background: rgba(245, 245, 248, .7); border-right: 1px solid rgba(0, 0, 0, .07); }
.n-search { margin: 4px 12px 10px; height: 30px; border: 0; border-radius: 10px; padding: 0 12px; background: rgba(0, 0, 0, .06); font: inherit; font-size: 13px; outline: 0; }
.n-list { flex: 1; overflow: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.n-item { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 9px 12px; border-radius: 11px; min-width: 0; }
.n-item b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-item span { font-size: 12px; color: #777a86; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-item em { font-style: normal; color: #3c3c43; margin-right: 6px; }
.n-item.on { background: #ffe58a; }
.n-edit { flex: 1; display: flex; flex-direction: column; min-width: 0; background: rgba(255, 255, 255, .8); }
.n-date { text-align: center; font-size: 11.5px; color: #98999f; padding: 6px 0 2px; }
.n-ta { flex: 1; resize: none; border: 0; outline: 0; background: transparent; padding: 10px 28px 28px; font: 15px/1.55 var(--sys); color: #1d1d1f; user-select: text; }

/* ====================================================== APP: Spotify */
.sp { width: 100%; height: 100%; border: 0; display: block; background: #121212; }

/* ====================================================== APP: Photos */
.ph { height: 100%; overflow: auto; background: rgba(255, 255, 255, .7); }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px; padding: 3px; }
.ph-cell { aspect-ratio: 1; overflow: hidden; background: #e8e8ee; }
.ph-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.ph-cell:hover img { transform: scale(1.04); }
.ph-empty { grid-column: 1 / -1; padding: 60px; text-align: center; color: #999; }

.lightbox { position: absolute; inset: 0; z-index: 20; background: rgba(12, 12, 14, .92); display: flex; align-items: center; justify-content: center; animation: lpIn .2s ease-out; }
.lightbox img { max-width: 86%; max-height: 86%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lb-x { position: absolute; top: 12px; left: 14px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; font-size: 34px; color: #fff; opacity: .7; }
.lb-nav:hover { opacity: 1; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lightbox.single .lb-nav { display: none; }
.lb-btn { position: absolute; top: 14px; right: 16px; padding: 6px 14px; border-radius: 14px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 12.5px; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .28); }

/* ====================================================== APP: Calendar */
.cal { display: flex; flex-direction: column; height: 100%; background: rgba(255, 255, 255, .85); }
.cal-title { padding: 2px 24px 12px; font-size: 24px; font-weight: 300; }
.cal-title b { font-weight: 700; }
.cal-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid rgba(0, 0, 0, .08); }
.cal-dow { padding: 6px 10px; font-size: 11px; font-weight: 500; color: #8e8e93; text-align: right; border-left: 1px solid rgba(0, 0, 0, .06); }
.cal-cell { border-left: 1px solid rgba(0, 0, 0, .06); border-top: 1px solid rgba(0, 0, 0, .06); padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden; }
.cal-cell.out { color: #b4b4bb; }
.cal-cell.we { background: rgba(0, 0, 0, .02); }
.cal-n { align-self: flex-end; font-size: 12.5px; min-width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 11px; padding: 0 5px; }
.cal-n.today { background: #ff3b30; color: #fff; font-weight: 600; }
.cal-ev { font-size: 11px; padding: 2px 6px; border-radius: 5px; background: rgba(10, 116, 255, .14); color: #0a58c8; border-left: 3px solid var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ====================================================== APP: Contacts */
.win.ct-win { background: #24272b; color: #f2f2f4; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .5), inset 0 0 0 .5px rgba(255, 255, 255, .1); }
.win.ct-win.focus { box-shadow: 0 28px 70px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(0, 0, 0, .6), inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.win.ct-win .titlebar { height: 46px; background: #24272b; }
.win.ct-win .tb-btn { background: rgba(255, 255, 255, .1); color: #f2f2f4; }
.win.ct-win .tb-btn:hover { background: rgba(255, 255, 255, .18); }
.win.ct-win .title { display: none; }
.tb-btn { font-family: var(--sys); }
.ct-round { width: 34px; height: 34px; min-width: 34px; border-radius: 50%; display: grid; place-items: center; padding: 0; margin-left: 4px; }
.ct-pill { height: 32px; border-radius: 16px; padding: 0 14px; }
.tb-right { align-items: center; gap: 8px; }
.ct-sbox { display: flex; align-items: center; gap: 8px; width: 180px; height: 34px; padding: 0 12px; border-radius: 17px; background: rgba(255, 255, 255, .1); color: #c9c9d0; }
.ct-search { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #f2f2f4; font: inherit; font-size: 14px; }
.ct-search::placeholder { color: #a9abb3; }
.ct { display: flex; height: 100%; }
.ct-list { width: 300px; flex: none; overflow: auto; padding: 0 0 16px 12px; }
.ct.no-list .ct-list { display: none; }
.ct-letter { position: sticky; top: 0; z-index: 1; background: #24272b; padding: 2px 8px; font-size: 12px; font-weight: 600; color: #9a9ca5; }
.ct-row { display: flex; align-items: center; gap: 10px; width: calc(100% - 4px); padding: 6px 8px; border-radius: 12px; text-align: left; }
.ct-row.on { background: rgba(255, 255, 255, .13); }
.ct-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(#8a7cb8, #544a82); }
.ct-nm { display: flex; flex-direction: column; min-width: 0; }
.ct-nm b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-nm small { font-size: 12px; color: #9a9ca5; }
.ct-none, .ct-empty { padding: 40px 16px; text-align: center; color: #8b8d96; font-size: 14px; }
.ct-detail { position: relative; flex: 1; min-width: 0; margin: 0 8px 8px 0; border-radius: 22px; overflow: hidden; background: #2b2a38; }
.ct.no-list .ct-detail { margin-left: 8px; }
.ct-poster { position: absolute; inset: 0; background:
  radial-gradient(120% 70% at 15% 0%, rgba(160, 140, 220, .75), transparent 60%),
  radial-gradient(90% 60% at 100% 35%, rgba(110, 160, 230, .45), transparent 65%),
  linear-gradient(#52457d 0%, #2f2a4d 45%, #25232f 100%); }
.ct-scroll { position: absolute; inset: 0; overflow: auto; padding: 150px 36px 36px; }
.ct-head { text-align: center; margin-bottom: 26px; }
.ct-sub { font-size: 13px; font-style: italic; font-weight: 600; letter-spacing: .04em; color: rgba(255, 255, 255, .72); margin-bottom: 4px; }
.ct-head h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.1; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 2px 14px rgba(0, 0, 0, .25); }
.ct-head.edit { display: grid; gap: 8px; max-width: 420px; margin: 0 auto 22px; }
.ct-card { max-width: 440px; margin: 0 auto 14px; border-radius: 22px; background: rgba(120, 120, 130, .38); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); overflow: hidden; }
.ct-share { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; }
.ct-sh { flex: 1; display: flex; flex-direction: column; }
.ct-sh b { font-size: 14px; font-weight: 500; } .ct-sh small { font-size: 14px; color: rgba(255, 255, 255, .7); }
.ct-chev { color: rgba(255, 255, 255, .7); }
.ct-field { padding: 11px 20px; }
.ct-field + .ct-field { border-top: 1px solid rgba(255, 255, 255, .14); }
.ct-lab { font-size: 13.5px; color: rgba(255, 255, 255, .78); }
.ct-val { font-size: 15px; white-space: pre-line; color: #fff; text-decoration: none; word-break: break-word; display: block; }
a.ct-val:hover { text-decoration: underline; }
.ct-in { width: 100%; background: rgba(0, 0, 0, .22); border: 0; border-radius: 9px; color: #fff; font: inherit; font-size: 15px; padding: 7px 10px; outline: 0; resize: none; margin-top: 4px; user-select: text; }
.ct-in.big { margin: 0; font-size: 16px; text-align: center; }
.ct-in:focus { box-shadow: 0 0 0 2px #3b82f6; }
@media (max-width: 700px) { .ct-list { width: 200px; } .ct-sbox { width: 120px; } }

/* ====================================================== small screens */
@media (max-width: 700px) {
  #icons { left: 10px; width: 100px; }
  .dicon .dimg { width: 60px; height: 70px; }
  .f-side, .n-side { width: 130px; }
  .lp-grid { grid-template-columns: repeat(auto-fit, 90px); gap: 22px 12px; }
  .lp-app .dimg { width: 66px; height: 66px; }
  .mb-dim { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #hint, .reordering { transition: none; }
.ditem.bounce .dimg { animation: none; }
}
