/* ST 映境 design system — shared by the studio and the admin console.
   Tokens → reset → typography → controls → dialogs → shared components (password, rich text,
   announcements, image viewer, toast). Light first; dark mode only swaps tokens. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-raised: #ffffff;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --fill-3: rgba(118, 118, 128, .18);
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #86868b;
  --label-4: #aeaeb2;
  --separator: rgba(60, 60, 67, .12);
  --separator-strong: rgba(60, 60, 67, .22);

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-press: #0066cc;
  --accent-soft: rgba(0, 113, 227, .1);
  --accent-text: #0066cc;
  --on-accent: #ffffff;
  --green: #248a3d;
  --green-soft: rgba(52, 199, 89, .14);
  --orange: #c93400;
  --orange-soft: rgba(255, 149, 0, .14);
  --red: #d70015;
  --red-soft: rgba(255, 59, 48, .1);
  --purple: #8944ab;

  --material: rgba(250, 250, 252, .74);
  --material-thick: rgba(255, 255, 255, .88);
  --blur: saturate(180%) blur(20px);
  --scrim: rgba(0, 0, 0, .32);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
  --shadow-lg: 0 4px 14px rgba(0, 0, 0, .06), 0 28px 72px rgba(0, 0, 0, .18);
  --ring: 0 0 0 4px rgba(0, 113, 227, .22);

  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --fast: 160ms;
  --medium: 260ms;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 9.5 5 5 5-5'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #161618;
    --surface-raised: #2c2c2e;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .16);
    --fill-3: rgba(118, 118, 128, .32);
    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #8e8e93;
    --label-4: #636366;
    --separator: rgba(255, 255, 255, .1);
    --separator-strong: rgba(255, 255, 255, .18);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-press: #0077ed;
    --accent-soft: rgba(10, 132, 255, .18);
    --accent-text: #4da3ff;
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, .16);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, .16);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, .16);
    --purple: #bf5af2;
    --material: rgba(22, 22, 24, .72);
    --material-thick: rgba(30, 30, 32, .9);
    --scrim: rgba(0, 0, 0, .56);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 4px 14px rgba(0, 0, 0, .4), 0 28px 72px rgba(0, 0, 0, .6);
    --ring: 0 0 0 4px rgba(10, 132, 255, .32);
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--label); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "kern"; letter-spacing: 0;
}
h1, h2, h3, h4, p, figure, pre, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--label); }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 600; }
small { font-size: 12px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
svg { flex: none; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
code, pre, .numeric { font-family: var(--mono); font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--separator); margin: 20px 0; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--fill-3) transparent; }

/* ---------- buttons ---------- */
button { font: inherit; color: inherit; margin: 0; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--radius-sm); background: var(--fill-2); color: var(--label); font-size: 14px; font-weight: 500;
  line-height: 1.2; white-space: nowrap; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
button:hover:not(:disabled) { background: var(--fill); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .38; cursor: default; }
button svg { width: 17px; height: 17px; stroke-width: 1.8; }
.primary, button.primary {
  min-height: 40px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.primary:active:not(:disabled) { background: var(--accent-press); }
button.secondary { border-radius: 999px; min-height: 40px; padding: 0 18px; background: var(--fill); }
button.secondary:hover:not(:disabled) { background: var(--fill-3); }
button.danger { border-radius: 999px; min-height: 40px; padding: 0 18px; background: var(--red); color: #fff; font-weight: 600; }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 88%, #000); }
.danger-text { color: var(--red) !important; }
.icon-button, button.icon-button { width: 36px; min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--label-2); }
.icon-button:hover:not(:disabled) { background: var(--fill-2); color: var(--label); }
.text-button, button.text-button { min-height: 32px; padding: 0 8px; border-radius: var(--radius-xs); background: transparent; color: var(--accent-text); font-weight: 500; }
.text-button:hover:not(:disabled) { background: var(--accent-soft); }
.text-button.subtle { color: var(--label-2); }
.text-button.subtle:hover:not(:disabled) { background: var(--fill-2); color: var(--label); }
.text-button svg { width: 16px; height: 16px; }
.mini-button, button.mini-button { min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--fill-2); color: var(--label-2); gap: 4px; }
.mini-button:hover:not(:disabled) { background: var(--fill); color: var(--label); }
.mini-button svg { width: 14px; height: 14px; }
.mini-button.accent { background: var(--accent-soft); color: var(--accent-text); }
.mini-button.accent:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---------- form controls ---------- */
input, select, textarea { font: inherit; color: var(--label); margin: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background-color: var(--fill-2); font-size: 14px; line-height: 1.45;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):hover, select:hover, textarea:hover { background-color: var(--fill); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):focus, select:focus, textarea:focus {
  outline: none; background-color: var(--surface); border-color: var(--accent); box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--label-3); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
input[readonly] { color: var(--label-2); }
input[aria-invalid=true] { border-color: var(--red) !important; box-shadow: 0 0 0 4px var(--red-soft) !important; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; cursor: pointer; text-overflow: ellipsis; }
textarea { resize: vertical; line-height: 1.6; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--fill-3); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-3); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.18); transition: transform var(--fast) var(--ease); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.18); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.1); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring), 0 2px 6px rgba(0,0,0,.18); }
output { font-variant-numeric: tabular-nums; color: var(--label-2); font-weight: 500; }
.field-error { color: var(--red); font-size: 12px; line-height: 1.5; }
.field-error:empty { display: none; }

/* Segmented control (iOS style). */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); }
.segmented > button { min-height: 30px; padding: 0 10px; border-radius: 7px; background: transparent; color: var(--label); font-size: 13px; font-weight: 500; gap: 5px; }
.segmented > button:hover:not(:disabled) { background: transparent; opacity: .72; }
.segmented > button[aria-pressed=true], .segmented > button.active { background: var(--surface-raised); box-shadow: 0 3px 8px rgba(0,0,0,.08), 0 3px 1px rgba(0,0,0,.03), 0 0 0 .5px rgba(0,0,0,.04); opacity: 1; font-weight: 600; }
.segmented > button:active:not(:disabled) { transform: none; }
.segmented svg { width: 15px; height: 15px; }
/* Sliding pill (motion.js setupPills). Without JS the per-button highlight above stays in place. */
.has-pill { position: relative; isolation: isolate; }
.has-pill::before { content: ""; position: absolute; z-index: -1; top: 0; left: 0; width: var(--pill-w, 0); height: var(--pill-h, 0); opacity: var(--pill-o, 0); transform: translate(var(--pill-x, 0), var(--pill-y, 0)); border-radius: var(--pill-r, 7px); background: var(--surface-raised); box-shadow: 0 3px 8px rgba(0,0,0,.08), 0 3px 1px rgba(0,0,0,.03), 0 0 0 .5px rgba(0,0,0,.04); pointer-events: none; }
.has-pill.pill-animate::before { transition: transform 380ms cubic-bezier(.3, 1.2, .5, 1), width 380ms cubic-bezier(.3, 1.2, .5, 1), opacity 160ms ease; }
.has-pill > button:is(.active, .nav-active, [aria-pressed=true], [aria-selected=true]) { background: transparent; box-shadow: none; }
.has-pill > button { transition: color var(--fast) var(--ease), opacity var(--fast) var(--ease), font-weight var(--fast); }

/* Switch */
.switch-row, .admin-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 14px; cursor: pointer; }
.admin-switch input[type=checkbox], .switch-row input[type=checkbox] {
  -webkit-appearance: none; appearance: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--fill-3); transition: background-color var(--medium) var(--ease); flex: none; cursor: pointer;
}
.admin-switch input[type=checkbox]::after, .switch-row input[type=checkbox]::after {
  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,.18), 0 0 0 .5px rgba(0,0,0,.04); transition: transform var(--medium) var(--spring);
}
.admin-switch input[type=checkbox]:checked, .switch-row input[type=checkbox]:checked { background: var(--green); }
.admin-switch input[type=checkbox]:checked::after, .switch-row input[type=checkbox]:checked::after { transform: translateX(18px); }

/* ---------- dialog ---------- */
dialog { color: var(--label); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#dialog {
  width: min(560px, calc(100vw - 32px)); max-height: min(88dvh, 900px); padding: 0; border: 0; border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; display: none; flex-direction: column;
}
/* Open and close both animate: closed state + @starting-style, with display/overlay kept alive during the exit. */
#dialog { opacity: 0; transform: translateY(8px) scale(.97); transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), overlay var(--fast) allow-discrete, display var(--fast) allow-discrete; }
#dialog[open] { display: flex; opacity: 1; transform: none; transition-duration: var(--medium); transition-timing-function: var(--ease-out); }
@starting-style { #dialog[open] { opacity: 0; transform: translateY(8px) scale(.97); } }
#dialog::backdrop { opacity: 0; transition: opacity var(--fast) var(--ease), overlay var(--fast) allow-discrete, display var(--fast) allow-discrete; }
#dialog[open]::backdrop { opacity: 1; transition-duration: var(--medium); }
@starting-style { #dialog[open]::backdrop { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 10px 24px; flex: none; }
.dialog-heading h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.close-button, .dialog-heading .icon-button { width: 30px; min-width: 30px; min-height: 30px; background: var(--fill-2); color: var(--label-2); }
.close-button svg { width: 16px; height: 16px; stroke-width: 2.2; }
#dialog-content { padding: 6px 24px 24px; overflow: auto; overscroll-behavior: contain; font-size: 14px; }
#dialog-content > * + * { margin-top: 12px; }
.dialog-note { color: var(--label-2); font-size: 14px; line-height: 1.65; }
.dialog-field { display: grid; gap: 6px; }
.dialog-field > span { font-size: 13px; font-weight: 500; color: var(--label-2); }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.stack-form { display: grid; gap: 14px; }
.stack-form > .primary { margin-top: 6px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 1000; max-width: min(520px, calc(100vw - 32px));
  padding: 12px 20px; border-radius: 999px; background: color-mix(in srgb, var(--label) 88%, transparent); color: var(--bg);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; line-height: 1.45; text-align: center;
  opacity: 0; transform: translate(-50%, 12px) scale(.96); pointer-events: none; transition: opacity var(--medium) var(--ease), transform var(--medium) var(--ease-out);
}
#toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
@starting-style { #toast.visible { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }
#toast:empty { display: none; }
#toast[popover] { top: auto; right: auto; margin: 0; border: 0; overflow: visible; width: max-content; height: auto; color: var(--bg); }
#toast[popover]:popover-open:not(:empty) { display: block; }

/* ---------- password field ---------- */
.password-field { position: relative; display: block; }
.password-field > input { padding-right: 46px !important; }
.password-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--label-3); }
.password-toggle:hover:not(:disabled) { background: var(--fill-2); color: var(--label); }
.password-toggle:active:not(:disabled) { transform: translateY(-50%) scale(.94); }
.password-toggle svg { width: 18px; height: 18px; }
.password-caps { display: block; margin-top: 6px; font-size: 12px; color: var(--orange); }
.password-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--label-2); }
.password-meter-bars { display: grid; grid-template-columns: repeat(4, 22px); gap: 4px; }
.password-meter-bars i { height: 4px; border-radius: 2px; background: var(--fill-3); transition: background-color var(--medium) var(--ease); }
.password-meter[data-score="1"] i:nth-child(-n+1) { background: var(--red); }
.password-meter[data-score="2"] i:nth-child(-n+2) { background: var(--orange); }
.password-meter[data-score="3"] i:nth-child(-n+3) { background: var(--green); }
.password-meter[data-score="4"] i { background: var(--green); }
.remember-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--label); cursor: pointer; }
.remember-field small { color: var(--label-3); }

/* ---------- rich text ---------- */
.rich-text { font-size: 14px; line-height: 1.75; color: var(--label); overflow-wrap: anywhere; }
.rich-text p { margin: 0 0 .7em; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text h4 { margin: .9em 0 .4em; font-size: 15px; font-weight: 600; }
.rich-text ul, .rich-text ol { margin: .2em 0 .8em; padding-left: 1.3em; }
.rich-text li { margin: .2em 0; }
.rich-text a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.rich-text code { padding: 1px 5px; border-radius: 5px; background: var(--fill-2); font-size: .9em; }

/* ---------- announcements ---------- */
.announcement-bell { position: relative; width: 36px; min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--label-2); }
.announcement-bell:hover:not(:disabled) { background: var(--fill-2); color: var(--label); }
.announcement-bell svg { width: 19px; height: 19px; }
.announcement-bell.has-unread svg { animation: bell-ring 2.4s cubic-bezier(.36,.07,.19,.97) 1.2s 2; transform-origin: 50% 2px; }
.announcement-count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--material-thick); animation: pop-in .32s var(--spring); }
@keyframes bell-ring { 0%,60%,100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(8deg); } 40% { transform: rotate(-5deg); } 50% { transform: rotate(2deg); } }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#announcement-banner { --tone: var(--accent); position: relative; z-index: 8; overflow: hidden; max-height: 120px; background: color-mix(in srgb, var(--tone) 9%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--tone) 16%, transparent); transition: max-height var(--medium) var(--ease-out), opacity var(--fast) var(--ease); flex: none; }
#announcement-banner.entering, #announcement-banner.leaving { max-height: 0; opacity: 0; }
#announcement-banner[data-level=success], .announcement-item[data-level=success], .announcement-popup[data-level=success] { --tone: var(--green); }
#announcement-banner[data-level=warning], .announcement-item[data-level=warning], .announcement-popup[data-level=warning] { --tone: var(--orange); }
#announcement-banner[data-level=critical], .announcement-item[data-level=critical], .announcement-popup[data-level=critical] { --tone: var(--red); }
.announcement-banner-inner { display: flex; align-items: center; gap: 10px; max-width: 1280px; min-height: 42px; margin: 0 auto; padding: 6px 16px; }
.announcement-banner-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--tone); }
.announcement-banner-icon svg { width: 17px; height: 17px; }
.announcement-banner-text { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 30px; padding: 0; border-radius: 0; background: none !important; color: var(--label); text-align: left; font-weight: 400; }
.announcement-banner-text:active:not(:disabled) { transform: none; }
.announcement-banner-text strong { flex: none; font-size: 13px; font-weight: 600; color: var(--label); }
.announcement-banner-text span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--label-2); }
.announcement-banner-more { min-height: 28px; padding: 0 10px; border-radius: 999px; background: transparent; color: var(--accent-text); font-size: 13px; gap: 2px; }
.announcement-banner-more:hover:not(:disabled) { background: var(--fill-2); }
.announcement-banner-more svg { width: 14px; height: 14px; }
.announcement-banner-close { width: 28px; min-width: 28px; min-height: 28px; padding: 0; border-radius: 50%; background: transparent; color: var(--label-3); }
.announcement-banner-close:hover:not(:disabled) { background: var(--fill-2); color: var(--label); }
.announcement-banner-close svg { width: 15px; height: 15px; }

.announcement-dialog { width: min(600px, calc(100vw - 32px)); max-height: min(86dvh, 860px); padding: 0; border: 0; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; opacity: 1; transform: none; transition: opacity var(--fast) var(--ease), transform var(--medium) var(--ease-out); }
.announcement-dialog::backdrop { transition: opacity var(--fast) var(--ease); }
.announcement-dialog.opening, .announcement-dialog.closing { opacity: 0; transform: translateY(10px) scale(.97); }
.announcement-dialog.opening::backdrop, .announcement-dialog.closing::backdrop { opacity: 0; }
.announcement-sheet { display: flex; flex-direction: column; max-height: min(86dvh, 860px); }
.announcement-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 16px 12px 24px; }
.announcement-sheet-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.announcement-summary { display: block; margin-top: 2px; font-size: 13px; color: var(--label-2); }
.announcement-head-actions { display: flex; align-items: center; gap: 6px; }
.announcement-text-button { min-height: 30px; padding: 0 10px; border-radius: 999px; background: transparent; color: var(--accent-text); font-size: 13px; gap: 4px; }
.announcement-text-button:hover:not(:disabled) { background: var(--accent-soft); }
.announcement-text-button svg { width: 15px; height: 15px; }
.announcement-close { width: 30px; min-width: 30px; min-height: 30px; padding: 0; border-radius: 50%; background: var(--fill-2); color: var(--label-2); }
.announcement-close svg { width: 16px; height: 16px; stroke-width: 2.2; }
.announcement-list { overflow: auto; padding: 4px 12px 16px; overscroll-behavior: contain; }
.announcement-item { --tone: var(--accent); position: relative; border-radius: var(--radius); transition: background-color var(--fast) var(--ease); }
.announcement-item + .announcement-item::before { content: ""; position: absolute; top: 0; left: 60px; right: 12px; border-top: 1px solid var(--separator); }
.announcement-item:hover { background: var(--fill-2); }
.announcement-item:hover::before, .announcement-item:hover + .announcement-item::before { opacity: 0; }
.announcement-item-head { display: flex; align-items: flex-start; justify-content: flex-start; gap: 12px; width: 100%; min-height: 0; padding: 14px 12px; border-radius: var(--radius); background: none !important; color: inherit; text-align: left; font-weight: 400; white-space: normal; }
.announcement-item-head:active:not(:disabled) { transform: none; }
.announcement-level-dot { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); }
.announcement-level-dot svg { width: 17px; height: 17px; }
.announcement-item-title { flex: 1; min-width: 0; }
.announcement-item-title strong { display: block; font-size: 15px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.announcement-item.unread .announcement-item-title strong { font-weight: 650; }
.announcement-item-title small { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--label-3); }
.announcement-tag, .announcement-pin { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--tone) 13%, transparent); color: var(--tone); }
.announcement-pin { background: var(--fill); color: var(--label-2); }
.announcement-unread-dot { width: 9px; height: 9px; margin-top: 7px; flex: none; border-radius: 50%; background: var(--accent); }
.announcement-chevron { width: 16px; height: 16px; margin-top: 6px; flex: none; color: var(--label-4); transition: transform var(--medium) var(--ease-out); }
.announcement-item-head[aria-expanded=true] .announcement-chevron { transform: rotate(180deg); }
.announcement-item-body { padding: 0 16px 16px 58px; animation: reveal var(--medium) var(--ease-out); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.announcement-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 20px; color: var(--label-3); text-align: center; }
.announcement-empty svg { width: 40px; height: 40px; color: var(--label-4); margin-bottom: 8px; stroke-width: 1.4; }
.announcement-empty p { font-size: 17px; font-weight: 600; color: var(--label); }
.announcement-empty span { font-size: 13px; }
.announcement-popup { --tone: var(--accent); display: flex; flex-direction: column; align-items: center; padding: 34px 28px 24px; text-align: center; }
.announcement-popup-mark { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); animation: pop-in .42s var(--spring) .05s both; }
.announcement-popup-mark svg { width: 28px; height: 28px; }
.announcement-popup-kicker { margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--tone); }
.announcement-popup h2 { margin-top: 4px; font-size: 22px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.announcement-popup-body { width: 100%; max-height: min(46dvh, 420px); overflow: auto; margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); background: var(--fill-2); text-align: left; }
.announcement-popup-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; margin-top: 20px; }
.announcement-primary { min-height: 44px; padding: 0 26px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; }
.announcement-primary:hover:not(:disabled) { background: var(--accent-hover); }

#picture-delete { width: 40px; padding: 0; color: var(--red); }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 760px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea { font-size: 16px; }
  #dialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  #dialog { opacity: 1; transform: translateY(100%); transition: transform 240ms cubic-bezier(.4, 0, 1, 1), overlay 240ms allow-discrete, display 240ms allow-discrete; }
  #dialog[open] { transform: none; transition-duration: 380ms; transition-timing-function: var(--ease-out); }
  @starting-style { #dialog[open] { opacity: 1; transform: translateY(100%); } }
  #dialog-content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .announcement-dialog { width: 100vw; max-width: 100vw; max-height: 90dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .announcement-dialog.opening, .announcement-dialog.closing { transform: translateY(48px); }
  .announcement-sheet { max-height: 90dvh; }
  .announcement-list { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .announcement-item-body { padding-left: 16px; }
  .announcement-popup { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .announcement-banner-inner { padding: 6px 12px; }
  .announcement-banner-text { flex-direction: column; gap: 0; }
  .announcement-banner-more { display: none; }
}
#dialog:focus-visible { outline: none; }
