/* TermsOS — system chrome: tokens, menu bar, dock, windows, notifications, lock screen */

@font-face {
  font-family: "Nohemi";
  src: url("../assets/fonts/Nohemi-VF.ttf") format("truetype-variations"),
       url("../assets/fonts/Nohemi-VF.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
  /* Nohemi's ampersand reads as an "S" ("T&C" → "TSC"), so "&" falls back to the system font */
  unicode-range: U+0000-0025, U+0027-FFFF;
}

:root {
  /* brand (matches live terms.club) */
  --ink: #0A0A0C;
  --pink: #FF2D78;
  --pink-strong: #D1105A;   /* white text on this passes AA */
  --paper: #F0EDE8;

  /* system surfaces */
  --glass: rgba(22, 22, 27, 0.72);
  --glass-strong: rgba(26, 26, 31, 0.88);
  --glass-light: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.08);
  --active: rgba(255, 255, 255, 0.14);

  --text: rgba(255, 255, 255, 0.94);
  --text-2: rgba(255, 255, 255, 0.64);
  --text-3: rgba(255, 255, 255, 0.46);

  --blur: blur(28px) saturate(170%);
  --radius-win: 14px;
  --menubar-h: 30px;
  --dock-icon: 54px;

  --shadow-win: 0 0 0 0.5px rgba(0, 0, 0, 0.7), 0 22px 70px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.3);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --font: "Nohemi", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* Redaction — the house motif. Reveals nothing, ever. */
.redact {
  background: var(--ink);
  color: transparent;
  border-radius: 1px;
  padding: 0 0.1em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  user-select: none;
}

/* ─── Desktop + wallpaper ─────────────────────────────── */
.desktop {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.wallpaper {
  position: absolute;
  inset: 0;
  background: var(--ink) url("../assets/img/wallpaper-neon.webp") center 42% / cover no-repeat;
}
.wallpaper::after {
  /* night-time grade: darkens the grey wall, keeps the neon */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(10, 10, 12, 0) 30%, rgba(10, 10, 12, 0.75) 100%),
    linear-gradient(rgba(12, 6, 14, 0.38), rgba(12, 6, 14, 0.38));
  mix-blend-mode: multiply;
}

/* ─── Menu bar ────────────────────────────────────────── */
.menubar {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--menubar-h);
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(12, 12, 15, 0.42);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 460;
  z-index: 1000;
  cursor: default; /* plain arrow over labels and the clock, like a real menu bar */
  -webkit-user-select: none;
  user-select: none;
}
.menubar .mb-item {
  height: 22px;
  padding: 0 9px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.menubar .mb-item:hover, .menubar .mb-item[aria-expanded="true"] { background: var(--active); }
.menubar .mb-app { font-weight: 680; }
.menubar .mb-spacer { flex: 1; }
.menubar .mb-clock { font-variant-numeric: tabular-nums; }

.mb-logo { padding: 0 10px; color: var(--pink); }
.mb-logo svg { width: 20px; height: 11px; display: block; filter: drop-shadow(0 0 5px rgba(255, 45, 120, 0.6)); }

.mb-sign {
  height: 22px;
  padding: 0 11px;
  margin: 0 4px;
  border-radius: 11px;
  background: var(--pink-strong);
  color: #fff;
  font-weight: 620;
  font-size: 12px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: none;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.2) inset, 0 0 16px rgba(255, 45, 120, 0.45);
}
.mb-sign:hover { background: var(--pink); }
.mb-icon svg { width: 16px; height: 16px; display: block; }
.mb-menus { display: contents; }

/* Larger Text: scale reading copy only (menu bar, dock and window chrome keep their size) */
html.large-text :is(
  .msg-paper, .thread, .msg-subject, .msg-head, .attachments, .mail-items, .mail-empty,
  .page, .viewer-image,
  .nt-items, .nt-stamp, .nt-title, .nt-body, .nt-checklist, .nt-deleted,
  .tickets-scroll, .cal-agenda,
  .zr-meeting, .zr-wait, .zr-sub, .zr-headline, .zr-prefix,
  .hm-heading, .hm-sub, .hm-privacy,
  .compose-fields, .compose-text,
  .docs-grid, .fmp-list,
  .sheet-title, .sheet-message, .sheet-form, .about-rows,
  .terms-intro, .terms-list, .lock-name-hint, .hud, .toast-main
) { zoom: 1.2; }
.mb-sign svg { width: 13px; height: 13px; }

/* ─── Dropdown menus ──────────────────────────────────── */
.menu {
  position: fixed;
  top: calc(var(--menubar-h) + 2px);
  min-width: 230px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(34, 34, 40, 0.8);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 1500;
  animation: menu-in 0.12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-item {
  width: 100%;
  height: 26px;
  padding: 0 10px 0 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  text-align: left;
}
.menu-item:hover:not([aria-disabled]), .menu-item:focus-visible { background: var(--pink-strong); color: #fff; outline: none; }
.menu-item[aria-disabled] { color: var(--text-3); }
.menu-check { width: 16px; text-align: center; font-size: 11px; }
.menu-label { flex: 1; }
.menu-key { color: var(--text-3); font-size: 12px; }
.menu-item:hover .menu-key { color: inherit; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--hairline); }

/* ─── Desktop icons ───────────────────────────────────── */
.desk-icons {
  position: absolute;
  top: calc(var(--menubar-h) + 18px);
  right: 18px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.desk-icon {
  width: 96px;
  padding: 6px 4px 4px;
  border-radius: 8px;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}
.desk-icon img { width: 58px; height: 58px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45)); }
.desk-icon span {
  font-size: 11.5px;
  font-weight: 520;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  word-break: break-word;
}
.desk-icon:hover img { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45)) brightness(1.06); }
.desk-icon[aria-selected="true"] { background: rgba(255, 255, 255, 0.12); }
.desk-icon[aria-selected="true"] span { background: var(--pink-strong); text-shadow: none; }

/* ─── Dock ────────────────────────────────────────────── */
.dock-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 900;
}
.dock {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 24px;
  background: rgba(34, 34, 40, 0.42);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 8px 2px;
  background: var(--hairline-strong);
}
.dock-item {
  position: relative;
  flex: none;
  width: calc(var(--dock-icon) * var(--mag, 1));
  height: calc(var(--dock-icon) * var(--mag, 1));
  display: grid;
  place-items: center;
  transition: width 0.22s var(--ease-out), height 0.22s var(--ease-out);
  transform-origin: 50% 100%;
}
.dock.magnifying .dock-item { transition: width 0.06s linear, height 0.06s linear; }
.dock-item > img, .dock-item > .cal-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
@media (hover: none), (pointer: coarse) { .dock-item:active { transform: scale(0.92); } }
.dock-item:focus-visible { outline-offset: 4px; border-radius: 16px; }
.dock-item.bounce { animation: dock-bounce 0.9s var(--ease-out) 2; }
@keyframes dock-bounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-22px); } 55% { transform: translateY(0); } 70% { transform: translateY(-7px); } }
.dock-item.wobble { animation: wobble 0.6s ease-in-out; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
.dock-item:active > img { filter: brightness(0.8); }
.dock-item.running::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}
.dock-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--pink-strong);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  font-variant-numeric: tabular-nums;
}
.dock-tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip, .dock-tip.show { opacity: 1; }

/* Calendar icon is live DOM so it always shows today's date */
.cal-icon {
  border-radius: 14px;
  background: linear-gradient(#fff, #EDEAE4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  overflow: hidden;
  color: var(--ink);
}
.cal-icon { font-size: calc(var(--dock-icon) * var(--mag, 1)); }
.cal-icon .dow {
  margin-top: 13%;
  font-size: 0.17em;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--pink-strong);
  line-height: 1;
}
.cal-icon .dom {
  font-size: 0.5em;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.03em;
  align-self: center;
  margin-top: -6%;
}

/* ─── Windows ─────────────────────────────────────────── */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-win);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  backdrop-filter: blur(40px) saturate(170%);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-win);
  overflow: hidden;
  animation: win-open 0.28s var(--ease-out);
}
@keyframes win-open {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
}
.win-titlebar {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.win-heading { min-width: 0; }
.win-title { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; }
.win-toolbar { display: flex; align-items: center; gap: 2px; }
.win-toolbar:empty { display: none; }
.win-body { flex: 1; min-height: 0; position: relative; }
.window:not(.focused) .win-title, .window:not(.focused) .tb-btn { opacity: 0.55; }
.window:not(.focused) { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.6), 0 12px 40px rgba(0, 0, 0, 0.4); }
.window.dragging { transition: none; user-select: none; }
.window.dragging .win-titlebar { cursor: grabbing; }
.window.closing { animation: win-close 0.16s ease-in forwards; pointer-events: none; }
@keyframes win-close { to { opacity: 0; transform: scale(0.97); } }
.window.genie { transition: transform 0.3s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.3s ease-in; pointer-events: none; }
.window.restoring { animation: win-open 0.3s var(--ease-out); }
.window.maxed { border-radius: 10px; }
.window:focus { outline: none; }
.win-subtitle { font-size: 11.5px; color: var(--text-3); font-weight: 450; }
.win-back { display: none; }

.win-controls { display: flex; gap: 2px; margin-left: 6px; }
.win-ctl {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.win-ctl svg { width: 12px; height: 12px; }
.win-ctl:hover { background: var(--hover); color: var(--text); }
.win-ctl.close:hover { background: var(--pink-strong); color: #fff; }

.tb-btn {
  height: 30px;
  min-width: 32px;
  padding: 0 9px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 520;
}
.tb-btn svg { width: 16px; height: 16px; }
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn[aria-disabled="true"] { opacity: 0.4; }
.tb-btn.text { color: var(--text); padding: 0 10px; }
.tb-btn.on { color: var(--pink); }
.tb-sep { width: 1px; height: 18px; background: var(--hairline); margin: 0 4px; }

/* ─── Notifications ───────────────────────────────────── */
.toasts {
  position: absolute;
  top: calc(var(--menubar-h) + 10px);
  right: 12px;
  width: 356px;
  display: grid;
  gap: 8px;
  z-index: 1100;
}
.toast {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  border-radius: 18px;
  background: rgba(36, 36, 42, 0.9);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.45s var(--ease-out);
  touch-action: none;
  transition: transform 0.25s var(--ease-out), opacity 0.25s;
}
.toast.dragging { transition: none; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }
.toast-main {
  width: 100%;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 2px 11px;
  align-items: start;
  padding: 12px 14px;
  border-radius: inherit;
  text-align: left;
  cursor: default;
}
.toast-main img { width: 38px; height: 38px; grid-row: span 3; -webkit-user-drag: none; pointer-events: none; }
.toast-main:focus-visible { outline: 2px solid var(--pink); outline-offset: -2px; }
.toast .t-title { font-weight: 650; font-size: 13px; }
.toast .t-time { font-size: 11.5px; color: var(--text-3); }
.toast .t-sub { grid-column: 2 / 4; font-weight: 560; font-size: 13px; }
.toast .t-body { grid-column: 2 / 4; color: var(--text-2); font-size: 13px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast:hover { background: rgba(48, 48, 54, 0.94); }
/* macOS-style close button, top-left on hover */
.toast-close {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(60, 60, 68, 0.96);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s, transform 0.15s;
}
.toast-close svg { width: 9px; height: 9px; }
.toast:hover .toast-close, .toast:focus-within .toast-close { opacity: 1; transform: scale(1); }
.toast-close:hover { background: var(--pink-strong); }
@media (hover: none) { .toast-close { display: none; } }
.toast.leaving { pointer-events: none; }
.toast.leaving-right { animation: toast-out-right 0.26s ease-in forwards; }
.toast.leaving-up { animation: toast-out-up 0.26s ease-in forwards; }
@keyframes toast-out-right { to { opacity: 0; transform: translateX(120%); } }
@keyframes toast-out-up { to { opacity: 0; transform: translateY(-120%); } }

/* ─── HUD (small transient message) ───────────────────── */
.hud {
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-icon) + 44px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 20, 24, 0.88);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  font-size: 13px;
  font-weight: 520;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
  z-index: 1200;
}
.hud.show { opacity: 1; transform: translate(-50%, 0); }

/* ─── System dialogs ──────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
  animation: fade-in 0.14s ease-out;
}
.modal-backdrop.closing { animation: fade-out 0.14s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  width: min(360px, 100%);
  padding: 22px 20px 16px;
  border-radius: 16px;
  background: rgba(38, 38, 44, 0.92);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: sheet-in 0.2s var(--ease-out);
}
@keyframes sheet-in { from { opacity: 0; transform: scale(0.94); } }
.sheet.nudge { animation: nudge 0.3s ease-in-out; }
@keyframes nudge { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.sheet-icon { width: 56px; height: 56px; margin: 0 auto 12px; }
.sheet-mark { border-radius: 14px; background: var(--ink); position: relative; box-shadow: inset 0 0 0 1px var(--hairline-strong); }
.sheet-mark::after { content: ""; position: absolute; left: 9px; right: 9px; top: 24px; height: 9px; background: var(--pink); transform: rotate(-6deg); box-shadow: 0 0 12px rgba(255, 45, 120, 0.6); }
.sheet-title { margin: 0 0 6px; font-size: 15px; font-weight: 680; }
.sheet-message { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.sheet-buttons { display: flex; gap: 8px; margin-top: 18px; }
.sheet-buttons .btn { flex: 1; justify-content: center; white-space: normal; height: auto; min-height: 32px; padding: 7px 12px; line-height: 1.25; text-align: center; }
.sheet-form { margin-top: 14px; text-align: left; }
.sheet-note, .form-note { margin: 8px 2px 0; font-size: 12px; color: var(--text-2); min-height: 1em; }
.sheet-note.error, .form-note.error { color: #FF7AA8; }
.about-rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; text-align: left; font-size: 13px; }
.about-rows dt { color: var(--text-3); }
.about-rows dd { margin: 0; font-weight: 520; }
.field {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  user-select: text;
}
.field::placeholder { color: var(--text-3); }
.field:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.25); }

/* ─── Buttons (shared) ────────────────────────────────── */
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--hairline);
  font-size: 13px;
  font-weight: 560;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.btn.primary { background: var(--pink-strong); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #E0186A; }
.btn.danger { background: #3A1020; color: #FF9CBF; border-color: rgba(255, 45, 120, 0.3); }
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.45; }
.btn.shake { animation: nudge 0.3s ease-in-out; }

/* ─── Boot ────────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: #000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  cursor: pointer;
}
.boot.leaving { animation: fade-out 0.4s ease-in forwards; }
.boot-logo { width: min(260px, 60vw); height: auto; }
.boot-bar { width: 200px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.boot-bar span { display: block; width: 0; height: 100%; background: #fff; transition: width 2.6s cubic-bezier(0.3, 0.1, 0.2, 1); }
.boot-line { height: 1.4em; font-size: 12.5px; color: var(--text-2); }
.boot-skip { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 11px; color: var(--text-3); }
@media (hover: none) { .boot-skip { display: none; } }

.fatal { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 24px; background: var(--ink); text-align: center; font-size: 15px; line-height: 1.6; }
.fatal a { color: var(--pink); }
body:not(.ready) .desktop > :not(.wallpaper) { visibility: hidden; }

/* ─── Lock screen ─────────────────────────────────────── */
.lock {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: calc(56px + env(safe-area-inset-top)) 24px calc(40px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: var(--ink);
}
.lock .wallpaper { filter: blur(22px) brightness(0.62) saturate(1.3); transform: scale(1.12); }
.lock > :not(.wallpaper) { position: relative; }
.lock-date { font-size: 20px; font-weight: 520; color: var(--text); text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.lock-time {
  font-size: clamp(88px, 14vw, 132px);
  font-weight: 640;
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.25);
}
.lock-user { display: grid; justify-items: center; gap: 12px; align-self: end; }
.lock-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(160deg, #F7F4EF, #CFC8BC);
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.lock-avatar svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lock-form { display: grid; justify-items: center; gap: 10px; }
.lock-name-input {
  width: 250px;
  height: 42px;
  padding: 0 18px;
  border-radius: 21px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font: inherit;
  font-size: 16px;            /* 16px stops iOS zooming in on focus */
  font-weight: 620;
  text-align: center;
  user-select: text;
}
.lock-name-input::placeholder { color: rgba(255, 255, 255, 0.78); font-weight: 620; }
.lock-name-input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.3); }
.lock-name-input:focus::placeholder { color: rgba(255, 255, 255, 0.4); }
.lock-name-hint { margin-top: -4px; font-size: 11.5px; color: var(--text-2); text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.lock-accept {
  height: 40px;
  padding: 0 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s, box-shadow 0.15s;
}
.lock-accept:hover { background: var(--pink-strong); border-color: transparent; box-shadow: 0 0 28px rgba(255, 45, 120, 0.5); }
.lock-accept svg { width: 16px; height: 16px; }
.lock-terms { font: inherit; font-size: 12.5px; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lock-terms:hover { color: var(--text); }
.lock.leaving { animation: lock-out 0.45s ease-in forwards; }
@keyframes lock-out { to { opacity: 0; transform: scale(1.04); } }
.lock-clock { text-align: center; }
.lock-terms { background: none; border: 0; }
.lock-foot { margin-top: 26px; font-size: 11px; color: var(--text-3); letter-spacing: 0.02em; text-align: center; }

/* ─── Terms small print (scrolls forever) ─────────────── */
.terms-panel {
  width: min(560px, 100%);
  max-height: min(640px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--paper);
  color: #1A1A1D;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: sheet-in 0.2s var(--ease-out);
}
.terms-panel h2 { margin: 22px 24px 4px; font-size: 18px; font-weight: 700; }
.terms-intro { margin: 0 24px 12px; font-size: 13px; color: rgba(0, 0, 0, 0.55); }
.terms-scroll { flex: 1; overflow-y: auto; padding: 0 24px 16px; border-top: 1px solid rgba(0, 0, 0, 0.1); user-select: text; }
.terms-list { margin: 12px 0 0; padding-left: 26px; font-size: 11.5px; line-height: 1.55; color: rgba(0, 0, 0, 0.72); }
.terms-list li { margin-bottom: 8px; }
.terms-sentinel { height: 1px; }
.terms-foot { padding: 12px 24px 16px; border-top: 1px solid rgba(0, 0, 0, 0.1); display: flex; justify-content: flex-end; }

/* ─── Mobile (< 768px): apps go full-screen ───────────── */
@media (max-width: 767px) {
  :root { --menubar-h: calc(34px + env(safe-area-inset-top)); --dock-icon: 50px; }
  .menubar { padding: env(safe-area-inset-top) 10px 0; }
  /* Phone: logo + app name on the left; Sign Contract + time on the right */
  .menubar .mb-hide-sm { display: none; }
  .menubar .mb-logo { padding: 0 8px 0 4px; }
  .menubar .mb-app { display: inline-flex; padding: 0 4px; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .menubar .mb-clock { font-weight: 640; font-size: 0; padding: 0 2px 0 6px; }
  .menubar .mb-clock::after { content: attr(data-short); font-size: 15px; }
  .menubar .mb-sign { height: 26px; border-radius: 13px; font-size: 12.5px; margin: 0 2px; }

  .desk-icons { display: none; }

  .dock-wrap { bottom: calc(6px + env(safe-area-inset-bottom)); padding: 0 8px; }
  .dock {
    max-width: 100%;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 7px 8px 9px;
    border-radius: 24px;
  }
  .dock::-webkit-scrollbar { display: none; }
  .dock { gap: 8px; }
  .dock-item { scroll-snap-align: start; }
  .dock-tip { display: none; }

  .window {
    position: fixed;
    top: var(--menubar-h) !important;
    left: 0 !important;
    right: 0;
    bottom: calc(var(--dock-icon) + 30px + env(safe-area-inset-bottom));
    width: auto !important;
    height: auto !important;
    border-radius: 0 0 18px 18px;
    border-width: 0 0 1px;
    background: #1A1A1F;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    animation-name: win-open-sm;
  }
  @keyframes win-open-sm { from { opacity: 0; transform: translateY(16px); } }
  .win-titlebar { cursor: default; padding-left: 4px; height: 50px; }
  .win-subtitle { display: none; }
  .win-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 36px;
    padding: 0 8px 0 4px;
    border-radius: 8px;
    color: var(--pink);
    font-size: 15px;
    font-weight: 520;
  }
  .win-back svg { width: 20px; height: 20px; }
  .win-controls .min, .win-controls .max { display: none; }
  .win-toolbar { gap: 0; }
  .win-toolbar .tb-btn.text { font-size: 0; gap: 0; padding: 0 8px; }
  .win-toolbar .tb-btn.text:not(:has(svg)) { display: none; }
  .window .win-heading { text-align: center; position: absolute; left: 90px; right: 90px; pointer-events: none; }
  .hud { bottom: calc(var(--dock-icon) + 40px + env(safe-area-inset-bottom)); }

  .toasts { left: 8px; right: 8px; width: auto; }
  .menubar .mb-text { display: inline-flex; padding: 0 6px; }
  /* iOS zooms into any text box under 16px; keep every input at 16px on phones */
  input, textarea, select, .field, .mail-search-input { font-size: 16px !important; }
  .sheet .field { height: 44px; padding: 0 14px; }
}

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