/* Portal pages (web UI area): design tokens, base rules and the shared
   components (buttons, forms, menus, tables, dialogs, toasts, sign-in).
   Sticker look, light only for now: white cards with a thin blue line inside a white
   ring and no blurred shadow; a blue accent, yellow for the current place. sticker.css
   (loaded last) draws the rings and lines. The stream page keeps a dark palette.
   The sidebar and page frame are in shell.css, the computer cards in
   computers.css, the stream page in pc.css. Bare element rules stay
   minimal so pc.css is not affected; components use classes that set
   every property they rely on. */

/* Pretendard, the same typeface on every system (Windows, macOS, ...). The
   file is served by the portal itself (fonts/, embedded with the page): the
   Content-Security-Policy allows no other site. Until the file is there (or
   when it cannot load) the system fonts of --font are used. */
/* The titles and the logo: Baemin Hanna (Woowahan Brothers, free to use, not to be sold as a file; fonts/README-hanna.txt). */
@font-face {
  font-family: "BM Hanna";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: local("BM HANNA 11yrs old"), url("/static/fonts/BMHANNA.woff") format("woff");
}
@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: local("Pretendard Variable"), url("/static/fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  color-scheme: light;
  /* Surfaces: a pale blue paper, white cards (stickers), a pale yellow sidebar. */
  --bg: #f5f8ff;
  --sidebar: rgba(255, 255, 255, 0.62); /* frosted: the pattern behind it shows blurred */
  --card-glass: rgba(255, 255, 255, 0.78); /* a frosted card */
  --veil: rgba(255, 255, 255, 0.62);        /* the frosted veil over a second-level page: the same as the sidebar */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27380%27 height=%27380%27 viewBox=%270 0 380 380%27%3E%3Cg opacity=%270.6%27 stroke-linejoin=%27round%27 stroke-linecap=%27round%27%3E%3Cg transform=%27translate%2878 78%29 rotate%28-14%29 scale%283.4%29 translate%28-12 -12%29%27%3E%3Cpath d=%27M22.37 9.81A10.6 10.6 0 1 1 14.19 1.63a3.4 3.4 0 0 0 4.76 3.42 3.4 3.4 0 0 0 3.42 4.76z%27 fill=%27%23ffffff%27 stroke=%27%235b83ff%27 stroke-width=%271.2%27/%3E%3Ccircle cx=%278.1%27 cy=%278.2%27 r=%271.75%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2713%27 cy=%2712.6%27 r=%271.6%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%277.6%27 cy=%2715.4%27 r=%271.45%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2714.4%27 cy=%2717.6%27 r=%271.4%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2717.3%27 cy=%2713.4%27 r=%271.15%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3C/g%3E%3Cg transform=%27translate%28300 150%29 rotate%2822%29 scale%282.4%29 translate%28-12 -12%29%27%3E%3Cpath d=%27M22.37 9.81A10.6 10.6 0 1 1 14.19 1.63a3.4 3.4 0 0 0 4.76 3.42 3.4 3.4 0 0 0 3.42 4.76z%27 fill=%27%23ffb3c9%27 stroke=%27%235b83ff%27 stroke-width=%271.2%27/%3E%3Ccircle cx=%278.1%27 cy=%278.2%27 r=%271.75%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2713%27 cy=%2712.6%27 r=%271.6%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%277.6%27 cy=%2715.4%27 r=%271.45%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2714.4%27 cy=%2717.6%27 r=%271.4%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2717.3%27 cy=%2713.4%27 r=%271.15%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3C/g%3E%3Cg transform=%27translate%28150 300%29 rotate%288%29 scale%282.8%29 translate%28-12 -12%29%27%3E%3Cpath d=%27M22.37 9.81A10.6 10.6 0 1 1 14.19 1.63a3.4 3.4 0 0 0 4.76 3.42 3.4 3.4 0 0 0 3.42 4.76z%27 fill=%27%23cfe6ff%27 stroke=%27%235b83ff%27 stroke-width=%271.2%27/%3E%3Ccircle cx=%278.1%27 cy=%278.2%27 r=%271.75%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2713%27 cy=%2712.6%27 r=%271.6%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%277.6%27 cy=%2715.4%27 r=%271.45%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2714.4%27 cy=%2717.6%27 r=%271.4%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2717.3%27 cy=%2713.4%27 r=%271.15%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3C/g%3E%3Cg transform=%27translate%28340 336%29 rotate%28-30%29 scale%281.6%29 translate%28-12 -12%29%27%3E%3Cpath d=%27M22.37 9.81A10.6 10.6 0 1 1 14.19 1.63a3.4 3.4 0 0 0 4.76 3.42 3.4 3.4 0 0 0 3.42 4.76z%27 fill=%27%23ffffff%27 stroke=%27%235b83ff%27 stroke-width=%271.2%27/%3E%3Ccircle cx=%278.1%27 cy=%278.2%27 r=%271.75%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2713%27 cy=%2712.6%27 r=%271.6%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%277.6%27 cy=%2715.4%27 r=%271.45%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2714.4%27 cy=%2717.6%27 r=%271.4%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3C/g%3E%3Cg transform=%27translate%2824 226%29 rotate%2840%29 scale%281.5%29 translate%28-12 -12%29%27%3E%3Cpath d=%27M22.37 9.81A10.6 10.6 0 1 1 14.19 1.63a3.4 3.4 0 0 0 4.76 3.42 3.4 3.4 0 0 0 3.42 4.76z%27 fill=%27%23fff1a8%27 stroke=%27%235b83ff%27 stroke-width=%271.2%27/%3E%3Ccircle cx=%278.1%27 cy=%278.2%27 r=%271.75%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2713%27 cy=%2712.6%27 r=%271.6%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%277.6%27 cy=%2715.4%27 r=%271.45%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3Ccircle cx=%2714.4%27 cy=%2717.6%27 r=%271.4%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%27.7%27/%3E%3C/g%3E%3Ccircle cx=%27190%27 cy=%2740%27 r=%277%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%272%27/%3E%3Ccircle cx=%27236%27 cy=%27250%27 r=%276%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%272%27/%3E%3Ccircle cx=%2720%27 cy=%2736%27 r=%275%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%272%27/%3E%3Ccircle cx=%27330%27 cy=%2748%27 r=%276%27 fill=%27%23ffd43b%27 stroke=%27%235b83ff%27 stroke-width=%272%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ff8fb1%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28176 120%29 rotate%28-30%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%235b83ff%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28222 196%29 rotate%2840%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ffd43b%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%2862 168%29 rotate%2870%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%235b83ff%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28262 88%29 rotate%2810%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ffb3c9%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28100 196%29 rotate%28-60%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ffd43b%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28360 230%29 rotate%28-25%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ff8fb1%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28250 340%29 rotate%2850%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%235b83ff%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%2840 332%29 rotate%28-10%29%27/%3E%3Cpath d=%27M-7.5 0H7.5%27 stroke=%27%23ffd43b%27 stroke-width=%275%27 stroke-linecap=%27round%27 transform=%27translate%28130 22%29 rotate%2825%29%27/%3E%3Ccircle cx=%27206%27 cy=%27288%27 r=%273.5%27 fill=%27%235b83ff%27/%3E%3Ccircle cx=%2792%27 cy=%27262%27 r=%273%27 fill=%27%23ffb3c9%27/%3E%3Ccircle cx=%27300%27 cy=%2720%27 r=%273%27 fill=%27%235b83ff%27/%3E%3Ccircle cx=%27328%27 cy=%27292%27 r=%273%27 fill=%27%23ffb3c9%27/%3E%3Ccircle cx=%27168%27 cy=%27214%27 r=%273%27 fill=%27%23ffd43b%27/%3E%3C/g%3E%3C/svg%3E");
  --surface: #ffffff;     /* cards, grouped lists, dialogs */
  --surface-2: #eef3ff;   /* raised on a surface */
  --fill: #e9eefb;        /* controls: inputs, buttons */
  --fill-strong: #dbe5fb; /* controls, hovered */
  --hover: rgba(79, 120, 245, 0.09);
  --pressed: rgba(79, 120, 245, 0.16);
  --separator: #d8e3fb;   /* hairlines, the quiet lines of controls */
  --radius: 12px;         /* controls */
  --radius-card: 18px;    /* cards */
  --radius-lg: 22px;      /* dialogs, sign-in card */
  /* Older names, kept for the rules that use them. */
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --input-bg: var(--fill);
  --border: transparent;
  --border-strong: var(--separator);
  --text: #1b2547;
  --muted: #525e82;
  --faint: #6f7ba3;
  --accent: #4f78f5;
  --accent-hover: #6a8cf7;
  --accent-ink: #ffffff; /* text on the accent colour */
  --accent-soft: rgba(79, 120, 245, 0.14);
  --glass: #ffffff;
  --glass-strong: #ffffff;
  --glass-line: transparent;
  --blur: none;
  --ok: #17804a;
  --ok-soft: #d3f4e1;
  --warn: #8a6100;
  --warn-soft: #fff4c2;
  --error: #b83030;
  --error-soft: #ffe9e9;
  --shadow: 0 0 0 0 transparent; /* no blurred shadows: a sticker has a ring and a line */
  --shadow-sm: 0 0 0 0 transparent;
  /* The sticker: a white ring outside, a thin blue line inside. */
  --ring-c: #ffffff;
  --sticker-line: #6f93f7;   /* a little paler and thicker than before: a thin dark line looks sharp at a corner */
  --sticker-w: 2px;
  --line-hi: rgba(255, 255, 255, 0.7); /* a 1px highlight inside the line, so the line has a rounded profile */
  --sticker-ring: 0 0 0 3px var(--ring-c), inset 0 0 0 1px var(--line-hi);
  --sticker-ring-sm: 0 0 0 2px var(--ring-c), inset 0 0 0 1px var(--line-hi);
  --yellow: #ffd43b;
  --pink: #ffb3c9;
  --on-yellow: #1b2547;
  --yellow-soft: #fff4c2;
  --side-ink: #1b2547;
  --side-line: #e1e9fb;
  --side-hover: rgba(79, 120, 245, 0.08);
  --check-bg: #cdd9f7;
  --zebra: rgba(79, 120, 245, 0.05);
  --plain-bg: linear-gradient(120deg, #b9cdf5 0%, #dce8fb 45%, #ffffff 100%); /* dark at the start, bright at the end */
  --plain-ink-a: rgba(27, 37, 71, 0.82);
  --plain-ink-b: rgba(27, 37, 71, 0.5);
  --sb-bg: linear-gradient(90deg, #a9c2f2 0%, #d6e4fb 50%, #ffffff 100%); /* a server banner with its icon: dark at the name, bright where the icon is */
  --sb-ink: #1b2547;
  --sb-shadow: none;
  --k-dir: #2b4bc2; --k-archive: #b05f00; --k-jar: #6f3bc4; --k-json: #7d5a00; --k-yaml: #0d7a6d; --k-config: #3a58c4;
  --k-skript: #17804a; --k-code: #b8336f; --k-image: #b8336f; --k-text: #1b2547; --k-data: #5f6b8e; --k-file: #5f6b8e;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
/* The stream page is always dark, whatever the mode. */
:root.pc-mode {
  color-scheme: dark;
  --bg: #080e2b;
  --sidebar: #03061a;
  --surface: #0f1744;
  --surface-2: #162057;
  --fill: #172270;
  --fill-strong: #1f2e86;
  --hover: rgba(157, 183, 255, 0.1);
  --pressed: rgba(157, 183, 255, 0.16);
  --separator: #2a3c8c;
  --text: #f2f6ff;
  --muted: #a9b9ea;
  --faint: #8d9dd2;
  --accent: #9db7ff;
  --accent-hover: #c4d6ff;
  --accent-ink: #07102f;
  --accent-soft: rgba(157, 183, 255, 0.16);
  --glass: #0f1744;
  --glass-strong: #0f1744;
  --ok: #8ff0c2;
  --ok-soft: #0e3858;
  --warn: #ffd43b;
  --warn-soft: #3d3d18;
  --error: #ffa0b8;
  --error-soft: #4a1b3a;
  --ring-c: #ffffff;
  --sticker-line: #4f78f5;
  --yellow-soft: #3d3d18;
  --side-ink: #ffe9a3;
  --side-line: #121d58;
  --side-hover: rgba(255, 233, 163, 0.1);
  --check-bg: #3a4fa6;
  --zebra: rgba(157, 183, 255, 0.05);
  --plain-bg: linear-gradient(120deg, #22337a 0%, #18266b 50%, #0f1950 100%);
  --plain-ink-a: rgba(240, 245, 255, 0.95);
  --plain-ink-b: rgba(240, 245, 255, 0.6);
  --k-dir: #bcd2ff; --k-archive: #ffc27a; --k-jar: #d8bfff; --k-json: #ffd84d; --k-yaml: #72e8d8; --k-config: #aac0ff;
  --k-skript: #86eaa8; --k-code: #ffa6cc; --k-image: #ffa6cc; --k-text: #f2f6ff; --k-data: #a9b9ea; --k-file: #a9b9ea;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  word-break: keep-all;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--muted); }
.warn-text { color: var(--warn); }
.mono { font-family: var(--mono); font-size: 13px; }

/* ---- icons ---- */
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.small { width: 14px; height: 14px; }
.ok-icon { color: var(--ok); }

/* ---- buttons ----
   Filled, never outlined: grey by default, the accent for the main action,
   a red tint for destructive ones, bare for ghost and icon buttons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 7px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}
/* :where() keeps these two as light as a bare .btn:hover, so the pages'
   own button rules (shell.css, computers.css) still win over them. */
.btn:hover:where(:not(:disabled)) { background: var(--fill-strong); }
.btn:active:where(:not(:disabled)) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn[aria-busy="true"] { opacity: 0.75; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
/* Unavailable (not merely busy): grey, so it does not read as clickable. */
.btn.primary:disabled:not([aria-busy="true"]) { background: var(--fill); color: var(--faint); opacity: 1; }
/* Destructive: red text on a red tint. */
.btn.danger, .btn.danger-outline { background: var(--error-soft); color: var(--error); }
.btn.danger:hover:not(:disabled), .btn.danger-outline:hover:not(:disabled) { background: rgba(255, 105, 97, 0.26); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn.small { min-height: 30px; padding: 4px 12px; border-radius: 8px; font-size: 13px; }
.btn.block { display: flex; width: 100%; min-height: 44px; }
/* Icon only (the ⋯ menus): a bare round glyph until hovered or open. */
.btn.icon-btn { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.btn.icon-btn:hover, .btn.icon-btn[aria-expanded="true"] { background: var(--fill); color: var(--text); }
.btn[aria-busy="true"]::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.link-btn {
  display: inline;
  width: auto;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ---- form controls ----
   Grey fields without a border; focus is a 2px accent ring. */
.input {
  display: block;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--text);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming in */
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow 0.15s ease;
}
.input::placeholder { color: var(--faint); opacity: 1; }
/* The ring shows for keyboard focus (and in text fields, which always
   count as such), not after a mouse click on a pop-up menu. */
.input:focus { outline: none; }
.input:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.input:disabled { opacity: 0.5; cursor: default; }
.input[readonly] { color: var(--muted); }
.input.mono { font-family: var(--mono); font-size: 14px; }
/* Autofilled fields keep their grey (--fill on a surface) instead of the
   browser's tint. */
.input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: inset 0 0 0 1000px var(--fill); }
.input:-webkit-autofill:focus-visible { box-shadow: inset 0 0 0 1000px var(--fill), 0 0 0 2px var(--accent); }
/* Pop-up menus: the up-and-down chevron of a macOS pop-up button. */
.select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 9.5l4-4 4 4M8 14.5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}
.select option { background-color: var(--surface); color: var(--text); }
.code-input {
  height: 56px;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.45em;
  text-align: center;
  text-indent: 0.45em; /* balances the spacing after the last digit */
}

.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 46px; }
.reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  transform: translateY(-50%);
  cursor: pointer;
}
.reveal:hover { color: var(--text); }
.reveal[aria-pressed="true"] { color: var(--accent); }

.form { display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.field-label { display: block; margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.field-help { margin: 0; color: var(--faint); font-size: 13px; line-height: 1.45; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 0 18px; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: -2px 0 16px; }
.form-row .check { margin: 0; }

.check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; color: var(--text); font-size: 15px; cursor: pointer; }
/* A filled rounded square, the accent with a dark tick when checked (no
   outline, like the rest of the controls). */
.check-input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  border: 0;
  border-radius: 5px;
  /* Light enough to read as a box (3:1) on cards, dialogs and groups. */
  background: var(--check-bg) no-repeat center / 18px 18px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.check-input:checked {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.6 9.3l3 3 5.9-6.3' fill='none' stroke='%230a1730' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check-input:disabled { opacity: 0.5; cursor: default; }
.check-text { display: flex; flex-direction: column; gap: 2px; }
.check-help { color: var(--faint); font-size: 13px; line-height: 1.45; }

/* iOS-style switch: a grey track and a white knob; the accent when on. */
.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 26px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(16px); }
.switch:disabled { opacity: 0.5; cursor: default; }
.switch-wrap { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; cursor: pointer; }

/* A group of choices in a dialog: a raised block, its legend as the first
   line (floated, so it sits inside the block, not on its edge). */
.fieldset { min-width: 0; margin: 4px 0 16px; padding: 12px 14px 2px; border: 0; border-radius: 12px; background: var(--surface-2); }
.fieldset > legend { float: left; width: 100%; margin: 0 0 10px; padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.fieldset > legend + * { clear: both; }
.fieldset:disabled { opacity: 0.5; }

.msg { margin: 10px 0 0; font-size: 14px; line-height: 1.5; }
.msg:empty { margin: 0; }
.msg[data-kind="error"] { color: var(--error); }
.msg[data-kind="ok"] { color: var(--ok); }
.msg[data-kind="info"] { color: var(--muted); }

.rules { display: grid; gap: 3px; margin: -4px 0 14px; padding: 0; color: var(--faint); font-size: 13px; list-style: none; }
.rules li::before { content: "•"; display: inline-block; width: 18px; text-align: center; }
.rules li.good { color: var(--ok); }
.rules li.good::before { content: "✓"; }
.rules li.bad { color: var(--error); }
.rules li.bad::before { content: "✕"; }

/* Copy fields live in dialogs, so the code box takes the field grey, like
   the one-line copy field (an .input) next to it. */
.copy-field { display: flex; gap: 8px; margin: 8px 0 4px; }
.copy-field .input { flex: 1; min-width: 0; }
.copy-field.block { align-items: flex-start; }
.code-block {
  display: block;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

/* ---- small blocks ---- */
.spinner {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 0; color: var(--muted); }
.boot { display: grid; place-items: center; min-height: 100vh; }

/* Empty states and errors: a quiet panel; an error gets a red "!" mark. */
.notice { padding: 32px 20px; border-radius: var(--radius-card); background: var(--surface); color: var(--muted); text-align: center; }
.notice.error::before {
  content: "!";
  content: "!" / "";
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--error-soft);
  color: var(--error);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}
.notice-title { margin: 0 0 6px; color: var(--text); font-size: 17px; font-weight: 700; }
.notice-text { margin: 0; overflow-wrap: anywhere; }
.notice-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--error-soft); color: var(--error); }

/* ---- menus ---- */
.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 210px;
  max-width: min(300px, calc(100vw - 32px));
  padding: 5px;
  border-radius: 13px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  animation: menu-in 0.15s ease-out; /* a fade only: right for menus that open upwards too */
}
.menu.start { right: auto; left: 0; }
@keyframes menu-in { from { opacity: 0; } }
.menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--fill); outline: none; }
.menu-item:disabled { color: var(--faint); cursor: default; }
.menu-item.danger { color: var(--error); }
.menu-sep { height: 1px; margin: 5px 12px; background: var(--separator); }
.menu-head { padding: 6px 12px 7px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

/* ---- signed-out pages ---- */
.auth-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 32px 16px; }
.auth-brand { display: flex; align-items: center; gap: 1px; margin-bottom: 24px; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.auth-card { width: 100%; max-width: 400px; padding: 32px 28px; border-radius: var(--radius-lg); background: var(--surface); }
.auth-card.wide { max-width: 480px; }
.auth-card .notice { padding: 8px 0; background: none; }
.auth-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.auth-title + .form { margin-top: 20px; }
.auth-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.auth-card .btn.block { margin-top: 4px; }
.auth-card > .btn.block { margin-top: 10px; }
.auth-links { margin-top: 16px; text-align: center; }
/* A quiet line under a form: a question and where to go for it ("아직
   계정이 없나요? 회원가입"), or two ways on. On the login page it keeps its
   place, unseen, until the portal has said whether it takes sign-ups. */
.auth-alt { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 8px; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.auth-alt.is-waiting { visibility: hidden; }
.auth-help { margin-top: 16px; color: var(--muted); font-size: 13px; }
.auth-help summary { cursor: pointer; }
.auth-help ul { margin: 8px 0 0; padding-left: 18px; }
.auth-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
/* The "address changed" page of the old address (app.js showMoved). */
.moved-card { text-align: center; }
.moved-title { font-size: 34px; }
.moved-address { margin: 8px 0 18px; padding: 18px 12px; border-radius: var(--radius); background: var(--yellow-soft); color: var(--text); font-size: 36px; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.moved-card .auth-sub { font-size: 16px; }

/* ---- setup guide (computers.js, in a dialog) ---- */
.guide-steps { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.guide-step { position: relative; padding-left: 42px; counter-increment: step; }
.guide-step::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.guide-step h3 { margin: 3px 0 6px; font-size: 16px; }
.guide-step p { margin: 0 0 8px; }
.guide-step > .muted { font-size: 13px; }
.guide-sub { display: grid; gap: 8px; margin: 6px 0 10px; padding-left: 20px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.guide-command { margin-top: 10px; }
.guide-step .guide-expiry { margin: 2px 0 0; font-size: 13px; }
.guide-fallback { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.guide-fallback summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.guide-fallback[open] summary { margin-bottom: 10px; }
.guide-fallback .guide-actions { margin: 0 0 4px; }
.guide-wait { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.guide-wait.done { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.guide-notes { margin-top: 20px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.guide-notes h3 { margin: 0 0 6px; font-size: 14px; }
.guide-notes ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }

/* ---- tables (users, audit) ----
   An inset grouped list: one surface, rows split by inset hairlines. The
   wrapper is the size container of the card layout below, and must not
   clip: the row menus open below their rows. */
.table-wrap { container: table-wrap / inline-size; overflow: visible; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: var(--radius-card); background: var(--surface); font-size: 14px; }
.table th { padding: 12px 14px 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.table td { padding: 11px 14px; vertical-align: middle; }
.table tbody tr + tr td { background-image: linear-gradient(var(--separator), var(--separator)); background-repeat: no-repeat; background-size: 100% 1px; }
.table tbody tr + tr td:first-child { background-position: 14px 0; background-size: calc(100% - 14px) 1px; }
.table tbody tr + tr td:last-child { background-size: calc(100% - 14px) 1px; }
.table tbody tr:hover td { background-color: var(--hover); }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-card); }
.table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-card); }
.table .select { width: auto; min-width: 104px; min-height: 32px; padding-top: 5px; padding-bottom: 5px; border-radius: 8px; font-size: 14px; }
.cell-user { min-width: 180px; }
/* Names are what people typed, also when they signed up by themselves: a
   long one without spaces wraps instead of pushing the table wide. */
.user-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.user-email { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; white-space: nowrap; }
.cell-actions { width: 48px; text-align: right; }
tr.is-disabled td:not(.cell-actions) { opacity: 0.55; }
/* People who signed up and wait for approval (admin-users.js): the line
   above the table that says how many, and who it is in the 승인 dialog. */
.await-note { margin: 0 0 12px; padding: 12px 16px; border-radius: var(--radius-card); background: var(--accent-soft); color: var(--text); font-size: 14px; }
.approve-who { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.cell-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-wrap { max-width: 320px; overflow-wrap: anywhere; }
.kind { font-weight: 600; white-space: nowrap; }
/* Failures (audit): red, after a red dot. */
.kind.bad { color: var(--error); }
.kind.bad::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; vertical-align: 1px; }

/* Too narrow for the columns (a phone, or a page beside the sidebar): one
   card per row, each value under its column's name. */
@container table-wrap (max-width: 800px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { border-radius: 0; background: none; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { position: relative; margin-bottom: 10px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface); }
  .table tbody td { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
  .table tbody tr + tr td, .table tbody tr:hover td { background: none; }
  .table td[data-label]::before { content: attr(data-label); flex: 0 0 72px; color: var(--faint); font-size: 13px; }
  .table td.cell-user { display: block; padding-right: 44px; }
  .table td.cell-user::before { content: none; }
  .table td.cell-actions { position: absolute; top: 10px; right: 10px; width: auto; padding: 0; }
  .table td[data-label]:empty { display: none; }
  .audit-table td.mono { overflow-wrap: anywhere; }
  .cell-wrap { max-width: none; }
  /* The audit log has many short rows: two label columns per card where
     they fit, so a page of 200 entries stays scrollable. */
  .audit-table tbody tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); column-gap: 16px; }
  @media (forced-colors: active) {
    .table-wrap .table { border: 0; }
    .table tr { border: 1px solid CanvasText; }
  }
}

/* Browsers without container queries (Safari before 16): the same card
   layout, by viewport width. */
@supports not (container-type: inline-size) {
  @media (max-width: 760px) {
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table { border-radius: 0; background: none; }
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table tr { position: relative; margin-bottom: 10px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface); }
    .table tbody td { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
    .table tbody tr + tr td, .table tbody tr:hover td { background: none; }
    .table td[data-label]::before { content: attr(data-label); flex: 0 0 72px; color: var(--faint); font-size: 13px; }
    .table td.cell-user { display: block; padding-right: 44px; }
    .table td.cell-user::before { content: none; }
    .table td.cell-actions { position: absolute; top: 10px; right: 10px; width: auto; padding: 0; }
    .table td[data-label]:empty { display: none; }
    .audit-table td.mono { overflow-wrap: anywhere; }
    .cell-wrap { max-width: none; }
    /* The audit log has many short rows: two label columns per card where
       they fit, so a page of 200 entries stays scrollable. */
    .audit-table tbody tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); column-gap: 16px; }
    @media (forced-colors: active) {
      .table-wrap .table { border: 0; }
      .table tr { border: 1px solid CanvasText; }
    }
  }
}

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters .field { flex: 1 1 220px; max-width: 360px; margin: 0; }
.audit-count { margin: 16px 0 8px; color: var(--muted); font-size: 13px; }
.more-row { margin-top: 16px; text-align: center; }

/* ---- settings ---- */
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip-btn {
  min-height: 32px;
  margin: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.chip-btn:hover { background: var(--fill-strong); }
/* Forms stay readable on wide windows (the page itself is as wide as the
   window, shell.css). */
.settings-area { max-width: 880px; }
.settings-card { margin: 0 0 18px; padding: 22px 22px 20px; border-radius: var(--radius-card); background: var(--surface); scroll-margin-top: 24px; }
.settings-title { margin: 0 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.settings-title:focus { outline: none; }
.settings-intro { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; }
.settings-actions .msg { margin: 0; }
.settings-subtitle { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.test-mail { margin-top: 26px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.inline-form .field { flex: 1 1 240px; margin: 0; }

/* ---- dialogs ----
   Frosted glass with a soft shadow; head, body and buttons are told apart
   by spacing, with no lines between them. */
.dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog[open] { animation: dialog-in 0.2s ease-out; }
.dialog.wide { width: min(660px, calc(100vw - 32px)); }
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.dialog[open]::backdrop { animation: backdrop-in 0.2s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.97); } }
@keyframes backdrop-in { from { opacity: 0; } }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 6px 24px; }
.dialog-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
/* Close: a small grey circle with a cross, as on Apple's sheets. */
.btn.dialog-close { flex: none; width: 30px; min-height: 30px; background: var(--fill); color: var(--muted); }
.btn.dialog-close:hover { background: var(--fill-strong); color: var(--text); }
.dialog-close .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.dialog-body { flex: 1 1 auto; min-height: 0; padding: 8px 24px 20px; overflow-y: auto; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 6px 24px 22px; }
.dialog-actions:empty { display: none; }
.dialog-actions .btn { min-width: 84px; }
.dialog-text { margin: 0 0 12px; overflow-wrap: anywhere; }
.dialog-text.muted { font-size: 14px; }
.link-details { margin: 4px 0 8px; }
.link-details summary { color: var(--muted); font-size: 14px; cursor: pointer; }

/* Trusted browsers (account.js): one grouped list, rows split by inset
   hairlines. */
.device-list { margin: 12px 0 0; padding: 0; border-radius: 12px; background: var(--surface-2); list-style: none; }
.device-list:empty { display: none; }
.device { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.device + .device::before { content: ""; position: absolute; top: 0; right: 0; left: 14px; height: 1px; background: var(--separator); }
.device-main { min-width: 0; }
.device-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.device-meta { margin-top: 2px; color: var(--muted); font-size: 13px; }
.device-empty { padding: 14px; color: var(--muted); }

/* ---- toasts ---- */
.toasts {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 340px;
  max-width: calc(100vw - 28px);
  pointer-events: none;
}
/* Like a macOS notification: a frosted card in the top right corner. */
.toast {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text);
  box-shadow: var(--shadow), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere; /* a long name in it wraps, as in the tables */
  animation: toast-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
/* Only a problem is marked: the frosted card is tinted red (no edge). Plain messages stay plain. */
.toast.error { background: rgba(255, 69, 58, 0.34); box-shadow: var(--shadow); }
.toast.leaving { opacity: 0; transform: translateX(24px); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } }

/* ---- the unsaved-changes bar (ui.js trackUnsaved): springs up from the bottom ---- */
.unsaved-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, calc(100vw - 32px));
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  /* The curve overshoots, so the bar pops up past its place and settles. */
  animation: unsaved-in 0.55s cubic-bezier(0.2, 1.5, 0.35, 1) both;
}
.unsaved-bar[hidden] { display: none; }
.unsaved-bar.leaving { animation: unsaved-out 0.2s ease-in forwards; }
.unsaved-bar.shake { animation: unsaved-shake 0.4s ease-in-out; }
.unsaved-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--warn);
  color: #1c1c1e;
  font-weight: 800;
  font-size: 14px;
}
.unsaved-text { flex: 1; margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
.unsaved-actions { flex: none; display: flex; align-items: center; gap: 6px; }
@keyframes unsaved-in { from { opacity: 0; transform: translate(-50%, 160%); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes unsaved-out { to { opacity: 0; transform: translate(-50%, 160%); } }
@keyframes unsaved-shake {
  0%, 100% { transform: translate(-50%, 0); }
  20% { transform: translate(calc(-50% - 9px), 0); }
  40% { transform: translate(calc(-50% + 8px), 0); }
  60% { transform: translate(calc(-50% - 5px), 0); }
  80% { transform: translate(calc(-50% + 3px), 0); }
}
/* The forms the bar saves do not need their own button. */
.tracked .settings-actions .btn.primary, .mc-save-row .btn.primary { display: none; }
@media (max-width: 520px) {
  .unsaved-bar { flex-wrap: wrap; }
  .unsaved-text { flex-basis: calc(100% - 40px); }
  .unsaved-actions { width: 100%; justify-content: flex-end; }
}

/* ---- the delete button that must be held (ui.js holdConfirmDialog) ---- */
.hold-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}
.hold-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--error);
  opacity: 0.55;
  transform: scaleX(0);
  transform-origin: left;
}
.hold-btn.holding .hold-fill { animation: hold-fill 3s linear forwards; }
.hold-btn.held .hold-fill { transform: scaleX(1); opacity: 0.8; }
.hold-btn.holding, .hold-btn.held { color: #fff; }
.hold-hint { font-size: 14px; color: var(--muted); }
@keyframes hold-fill { to { transform: scaleX(1); } }
/* The window shakes harder the longer the button is held (data-stage 1..3), and once more at the end. */
@media (prefers-reduced-motion: no-preference) {
  .dialog[data-stage="1"] { animation: dlg-shake-1 0.12s linear infinite; }
  .dialog[data-stage="2"] { animation: dlg-shake-2 0.09s linear infinite; }
  .dialog[data-stage="3"] { animation: dlg-shake-3 0.07s linear infinite; }
  .dialog[data-stage="done"] { animation: dlg-boom 0.26s ease-out forwards; }
}
@keyframes dlg-shake-1 { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-1px, 0); } 50% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 1px); } }
@keyframes dlg-shake-2 { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-3px, 1px); } 50% { transform: translate(3px, -2px); } 75% { transform: translate(-2px, 2px); } }
@keyframes dlg-shake-3 { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-6px, 2px) rotate(-0.4deg); } 50% { transform: translate(6px, -3px) rotate(0.4deg); } 75% { transform: translate(-4px, 3px) rotate(-0.3deg); } }
@keyframes dlg-boom {
  0% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-10px, 0) scale(1.03); }
  50% { transform: translate(9px, 0) scale(1.03); }
  75% { transform: translate(-5px, 0) scale(1); }
  100% { transform: translate(0, 0) scale(0.96); opacity: 0.4; }
}

/* ---- stream page host (pc.js draws inside .pc-host) ---- */
html.pc-mode, html.pc-mode body { overflow: hidden; overscroll-behavior: none; }
.pc-host { position: fixed; inset: 0; background: #000; color: var(--text); }
.pc-message { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; }
.pc-message .notice, .pc-host > .notice { width: min(440px, 100%); border-radius: var(--radius-lg); }
.pc-message .loading { color: var(--muted); }

/* ---- narrow screens ---- */
@media (max-width: 520px) {
  .auth-card { padding: 26px 20px; }
  .dialog-head { padding-left: 20px; }
  .dialog-body { padding: 8px 20px 18px; }
  .dialog-actions { flex-direction: column-reverse; padding: 6px 20px 20px; }
  .dialog-actions .btn { width: 100%; min-height: 44px; }
  .copy-field { flex-direction: column; }
  .device { flex-direction: column; align-items: stretch; }
  .settings-card { padding: 20px 16px 16px; }
}

/* No blur available (or asked not to): the glass becomes a solid surface. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: var(--surface); --glass-strong: var(--surface); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--surface); --glass-strong: var(--surface); }
  .dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
}

/* Forced colors (e.g. Windows contrast themes) drop fills and shadows, so
   the borderless controls and panels get a system-colour border back, and
   what showed focus or state by fill shows it another way. */
@media (forced-colors: active) {
  .btn, .chip-btn, .switch { border: 1px solid ButtonText; }
  .btn:disabled { border-color: GrayText; }
  .input, .code-block, .badge, .chip, .notice, .menu, .dialog, .toast, .auth-card, .settings-card,
  .table, .device-list, .fieldset, .guide-fallback, .guide-notes, .guide-wait, .guide-step::before,
  .await-note, .approve-who { border: 1px solid CanvasText; }
  .auth-card .notice { border: 0; }
  .input:focus-visible { outline: 2px solid Highlight; outline-offset: 1px; }
  /* The drawn checkbox has no fill here: use the system one. */
  .check-input { -webkit-appearance: auto; appearance: auto; background: none; }
  .menu-item:hover:not(:disabled), .menu-item:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
  .switch::before { background: ButtonText; box-shadow: none; }
  .switch:checked { background: Highlight; }
  .switch:checked::before { background: HighlightText; }
  .kind.bad::before { background: CanvasText; }
}

/* Each time the page changes (app.js render) the new page comes into focus: it starts
   slightly blurred and sharpens (the sidebar stays as it is; nothing fades). */
.page-fade :is(.page, .auth-page) { animation: page-blur 0.5s ease-out backwards; }
@keyframes page-blur { from { filter: blur(8px); } }

/* The frosted cards (sticker.css) cannot blur what is behind them while the page itself is under that filter: they
   would look merely see-through, then jump to blurred when it ends. So they stay clear while the page comes into
   focus (0.5s) and frost slowly after it. The strength of the frost is a number, --frost (0 clear, 1 the full blur
   and saturation of sticker.css); it is the number that moves, not backdrop-filter itself: a transition of
   backdrop-filter showed nothing until its last frame and then jumped (Chrome), and Safari cut it short.
   app.js adds .page-frost when the page's own animation ends (one time for the whole page, so a card that arrives
   late from the server frosts with the rest) and takes both classes off when it is over. */
@property --frost { syntax: "<number>"; inherits: true; initial-value: 1; }
.page-fade:not(.page-frost) { --frost: 0; }
.page-fade.page-frost { animation: frost-in 0.7s ease-out backwards; }
@keyframes frost-in { from { --frost: 0; } }

/* A second-level page (a server's page, adding a server): the background frosts first, fading from clear to
   blurred, then the panel springs up from below. No filter on the page itself: it would cut off the veil's blur. */
.page-fade .page.server-veil { --frost: 1; animation: veil-in 0.4s ease-out backwards; }
.page-fade .page.server-veil > * { animation: panel-up 0.65s cubic-bezier(0.3, 1.4, 0.5, 1) 0.2s backwards; }
@keyframes veil-in {
  from { background-color: transparent; -webkit-backdrop-filter: blur(0) saturate(100%); backdrop-filter: blur(0) saturate(100%); }
}
@keyframes panel-up { from { opacity: 0; transform: translateY(72px); } }

@media (prefers-reduced-motion: reduce) {
  .page-fade :is(.page, .auth-page) { animation: none; }
  .page-fade.page-frost { animation: none; }
  .page-fade .page.server-veil, .page-fade .page.server-veil > * { animation: none; }
  .spinner, .btn[aria-busy="true"]::after { animation-duration: 2.4s; }
  .menu, .dialog[open], .dialog[open]::backdrop, .toast, .unsaved-bar, .unsaved-bar.leaving, .unsaved-bar.shake { animation: none; }
  .toast { transition: none; }
  .btn, .input, .chip-btn, .switch, .switch::before { transition: none; }
  .btn:active:where(:not(:disabled)) { transform: none; }
}

/* ---- editable texts (views/admin-texts.js) ---- */
/* Two tabs, like a segmented control: a grey track, the current one raised. */
.texts-tabs { display: inline-flex; gap: 2px; margin: 0 0 16px; padding: 3px; border-radius: 10px; background: var(--fill); }
.texts-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin: 0;
  padding: 4px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.texts-tab:hover { color: var(--text); }
.texts-tab.is-current { background: var(--surface-2); color: var(--text); }
.tab-count { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 18px; text-align: center; }
@media (forced-colors: active) {
  .texts-tab.is-current { outline: 2px solid Highlight; outline-offset: -2px; }
}
.texts-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.texts-cat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 999px; background: var(--fill); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.texts-cat:hover { color: var(--text); }
.texts-cat[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.texts-cat[aria-pressed="true"] .tab-count { background: rgba(0, 0, 0, 0.18); color: inherit; }
.texts-group { margin: 18px 0 2px; font-size: 15px; color: var(--text); }
.texts-group:first-child { margin-top: 4px; }
.texts-filters { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 0 16px; margin-bottom: 4px; }
.texts-count { margin: 0 0 14px; font-size: 13px; }
.texts-list { display: flex; flex-direction: column; gap: 12px; }
.text-row { padding: 14px 16px 12px; border-radius: var(--radius-card); background: var(--surface-2); }
.text-row.is-edited { box-shadow: inset 3px 0 0 var(--accent); }
.text-area { margin: 0 0 4px; color: var(--faint); font-size: 12px; font-weight: 600; }
.text-default { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.text-edit { field-sizing: content; min-height: 44px; max-height: 280px; resize: vertical; font-size: 14px; line-height: 1.5; }
.text-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.text-spacer { flex: 1 1 auto; }
.text-chip { font-family: var(--mono); font-size: 12px; }
.text-note { margin: 8px 0 0; font-size: 13px; }
@media (max-width: 520px) {
  .texts-filters { grid-template-columns: minmax(0, 1fr); }
}

/* ---- notices (views/notices.js) ---- */
.posts-area { max-width: 880px; margin-top: 24px; }
.posts { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.post-item { margin: 0; padding: 0; }
/* A row is one link: title, a two-line summary, then when and how often read. */
.post-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
@media (hover: hover) {
  .post-row:hover { background: var(--surface-2); }
}
.post-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.4; overflow-wrap: anywhere; }
.post-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.post-meta { color: var(--faint); font-size: 13px; }

.back-link { display: inline-flex; align-items: center; gap: 2px; margin: -4px 0 14px -4px; padding: 4px 10px 4px 4px; border-radius: 8px; color: var(--accent); font-size: 14px; text-decoration: none; }
.back-link:hover { background: var(--hover); }
.back-icon { width: 16px; height: 16px; transform: rotate(90deg); }
.post-area { max-width: 760px; }
.post-area .page-head { align-items: flex-start; margin-bottom: 6px; }
.post-area .page-title { overflow-wrap: anywhere; }
.post-area .page-sub.post-meta { margin: 0 0 28px; color: var(--faint); font-size: 13px; }

/* The editor: toolbar above the text, the preview in the text's place. */
.post-editor { max-width: 880px; margin-top: 8px; }
.post-body-wrap { display: flex; flex-direction: column; gap: 10px; }
.post-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.post-toolbar .texts-tabs { margin: 0; }
.post-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.post-body { min-height: 360px; resize: vertical; font-size: 15px; line-height: 1.65; }
.post-preview { min-height: 360px; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); }
.post-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* The share link dialog. */
.share-make { margin: 0 0 4px; }
.share-result { margin: 14px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.share-result .dialog-text { margin-bottom: 4px; }
.share-result .copy-field { margin-top: 10px; }
.share-subtitle { margin: 24px 0 10px; }

/* ---- Markdown text (markdown.js) ----
   Readable running text on the page: 16px, generous leading; code, quotes
   and tables sit on fills, with no borders. */
.md-body { color: var(--text); font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 { margin: 1.7em 0 0.55em; font-weight: 700; letter-spacing: -0.015em; line-height: 1.35; }
.md-body h1 { font-size: 28px; }
.md-body h2 { font-size: 22px; }
.md-body h3 { font-size: 18px; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 16px; }
.md-body p { margin: 0 0 1.05em; }
.md-body a { color: var(--accent); text-decoration: none; }
.md-body a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.md-body strong { font-weight: 700; }
.md-body del { color: var(--muted); }
.md-body ul, .md-body ol { margin: 0 0 1.05em; padding-left: 1.5em; }
.md-body li { margin: 0.25em 0; }
.md-body li > ul, .md-body li > ol { margin: 0.25em 0 0; }
.md-body li > p { margin: 0 0 0.5em; }
.md-body ul ul { list-style: circle; }
.md-body ul ul ul { list-style: square; }
.md-body blockquote { margin: 0 0 1.05em; padding: 12px 18px; border-radius: 12px; background: var(--surface); color: var(--muted); }
.md-body blockquote > :last-child { margin-bottom: 0; }
.md-body code { padding: 0.12em 0.4em; border-radius: 6px; background: var(--fill); font-family: var(--mono); font-size: 0.88em; }
.md-body .md-code { margin: 0 0 1.2em; padding: 14px 16px; overflow-x: auto; border-radius: 12px; background: var(--surface); tab-size: 4; }
.md-body .md-code code { padding: 0; background: none; font-size: 13.5px; line-height: 1.6; white-space: pre; overflow-wrap: normal; }
.md-body .md-rule { height: 1px; margin: 2em 0; border: 0; background: var(--separator); }
.md-body img { max-width: 100%; height: auto; border-radius: 12px; vertical-align: middle; }
.md-body p > img:only-child { display: block; margin: 1.4em 0; }
.md-body .md-table { margin: 0 0 1.2em; overflow-x: auto; }
.md-body table { min-width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 12px; background: var(--surface); font-size: 15px; line-height: 1.5; }
.md-body th, .md-body td { padding: 10px 16px; text-align: left; vertical-align: top; }
.md-body th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.md-body th:first-child { border-top-left-radius: 12px; }
.md-body th:last-child { border-top-right-radius: 12px; }
.md-body tbody tr + tr td { background-image: linear-gradient(var(--separator), var(--separator)); background-repeat: no-repeat; background-size: 100% 1px; }
.md-body tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
.md-body tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
.md-body .align-center { text-align: center; }
.md-body .align-right { text-align: right; }
.md-body .md-more { color: var(--faint); font-size: 14px; }
@media (max-width: 520px) {
  .md-body { font-size: 15.5px; }
  .md-body h1 { font-size: 24px; }
  .md-body h2 { font-size: 20px; }
  .post-row { padding: 14px 16px; }
}
@media (forced-colors: active) {
  .post-row, .post-preview, .share-result, .md-body blockquote, .md-body .md-code, .md-body code, .md-body table { border: 1px solid CanvasText; }
}

/* ---- personal options (views/my-settings.js) ---- */
.settings-group { margin: 34px 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.pref-group + .pref-group { margin-top: 28px; }
.pref-group .settings-subtitle { margin-bottom: 4px; font-size: 16px; }
.pref-intro { margin: 0 0 14px; }
.pref-body .field-grid { margin-bottom: 4px; }
.pref-body .check { margin-bottom: 14px; }
.pref-body .settings-actions { margin-top: 2px; }
