:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #777777;
  --muted-2: #9a968d;
  --line: #e7e7ea;
  --line-strong: #c9c9ce;
  --edge-divider-line: color-mix(in srgb, var(--line) 86%, transparent);
  --edge-divider-line-active: color-mix(in srgb, var(--line-strong) 74%, transparent);
  --edge-divider-surface: var(--paper);
  --edge-divider-shadow: 2px 0 12px rgba(0, 0, 0, 0.045);
  --wash: #f4f4f5;
  --active-wash: color-mix(in srgb, var(--ink) 6%, transparent);
  --active-ink: var(--ink);
  --black: #050505;
  --white: #ffffff;
  --content: 1480px;
  --ui-radius: 0;
  --ui-radius-sm: 0;
  --ui-border: 1px solid var(--line-strong);
  --ui-shadow-popover: 0 18px 44px rgba(17, 17, 17, 0.16);
  --ui-shadow-dialog: 0 28px 76px rgba(17, 17, 17, 0.24);
  --ui-shadow-sheet: -18px 0 54px rgba(17, 17, 17, 0.14);
  --ui-backdrop: rgba(5, 5, 5, 0.52);
  --ui-focus-ring: 0 0 0 3px color-mix(in srgb, var(--active-ink) 24%, transparent);
  --topbar-height: 64px;
  --notice-info-ink: #31566f;
  --notice-info-bg: #edf6fb;
  --notice-info-border: #b6d6e9;
  --notice-pending-ink: #8a5a00;
  --notice-pending-bg: #fff7e6;
  --notice-pending-border: #efc36d;
  --notice-success-ink: #1a7f37;
  --notice-success-bg: #edf8f1;
  --notice-success-border: #acd8bc;
  --notice-warning-ink: #946200;
  --notice-warning-bg: #fff7e6;
  --notice-warning-border: #e8bd66;
  --notice-error-ink: #b42318;
  --notice-error-bg: #fff1f0;
  --notice-error-border: #efb3ac;
  --notice-toast-top: var(--topbar-height);
  --color-filter-swatch-core: #ffffff;
  --color-filter-swatch-core-glint: rgba(255, 255, 255, 0.95);
  --color-filter-swatch-core-glow: rgba(255, 255, 255, 0.56);
  --color-filter-swatch-core-border: rgba(255, 255, 255, 0.78);
  --color-filter-swatch-core-shadow: rgba(17, 17, 17, 0.16);
  --color-filter-trigger-bg: transparent;
  --color-filter-trigger-hover-bg: color-mix(in srgb, var(--ink) 7%, var(--paper));
  --color-filter-trigger-open-bg: color-mix(in srgb, var(--ink) 10%, var(--paper));
  --color-filter-trigger-active-bg: color-mix(in srgb, var(--color-filter-active-color, var(--ink)) 10%, var(--paper));
  --font-title: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --font-body: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-rounded: "M PLUS Rounded 1c", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-number: "M PLUS Rounded 1c", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  /* Kill the grey/blue flash iOS/Android paint over every tapped button and
     card. :active / :focus-visible states still provide intentional feedback. */
  -webkit-tap-highlight-color: transparent;
}

body {
  --rail-width: 72px;
  --rail-item-size: 52px;
  --rail-gutter: 10px;
  --rail-mark-size: 32px;
  --page-inline-gutter: clamp(16px, 3vw, 40px);
  --notice-toast-start: calc(var(--rail-width) + var(--page-inline-gutter));
  --notice-toast-end: var(--page-inline-gutter);
  /* Detail panel width is a fraction of the viewport so the split adapts to
     any screen; a small px floor keeps it usable on narrow laptops. */
  --detail-ratio: 0.44;
  --detail-width: max(320px, calc(var(--detail-ratio) * 100vw));
  margin: 0;
  min-width: 320px;
  padding-left: var(--rail-width);
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--paper) 0, var(--bg) 360px),
    var(--bg);
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
  transition:
    padding-left 280ms cubic-bezier(0.22, 1, 0.36, 1),
    padding-right 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.is-right-panel-open {
  padding-right: var(--detail-width);
  --notice-toast-end: calc(var(--detail-width) + var(--page-inline-gutter));
}

/* These dynamically repacked surfaces own scroll position manually; browser
   scroll anchoring can otherwise fight the selected-card settle. */
#topics,
.style-grid,
.style-card,
.article-detail,
.detail-panel {
  overflow-anchor: none;
}

body.is-resizing {
  transition: none;
  user-select: none;
  cursor: col-resize;
}

body.is-rail-expanded {
  --rail-width: 188px;
}

body.is-auth-gate {
  --rail-width: 0px;
  --notice-toast-start: var(--page-inline-gutter);
  padding-left: 0;
}

body.is-auth-gate .app-rail,
body.is-auth-gate .site-header {
  display: none;
}

body.is-notification-center-open #newNotificationButton {
  display: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.rail-symbol,
.brand-mark,
.account-avatar {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-rounded);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.ui-surface,
.ui-dialog,
.ui-popover {
  border: var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--ui-shadow-dialog);
}

.ui-popover {
  box-shadow: var(--ui-shadow-popover);
}

.ui-sheet {
  box-shadow: var(--ui-shadow-sheet);
}

.ui-toast {
  border-radius: var(--ui-radius-sm);
  box-shadow: var(--ui-shadow-popover);
}

.ui-lightbox {
  background: rgba(8, 8, 8, 0.94);
}

.ui-dialog::backdrop {
  background: var(--ui-backdrop);
  backdrop-filter: blur(5px);
}

.member-dialog-card,
.ui-dialog-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.ui-dialog-head,
.member-dialog-head,
.auth-dialog-head,
.dialog-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.member-actions,
.ui-dialog-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.member-field,
.ui-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.member-field input,
.member-field textarea,
.ui-field input,
.ui-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.member-field input:focus,
.member-field textarea:focus,
.ui-field input:focus,
.ui-field textarea:focus,
.ui-button:focus-visible,
.icon-button:focus-visible,
.ghost-button:focus-visible,
.member-actions button:focus-visible,
.account-menu button:focus-visible {
  border-color: var(--active-ink);
  box-shadow: var(--ui-focus-ring);
  outline: none;
}

.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: var(--ui-radius-sm);
  color: var(--white);
  background: var(--ink);
  font-weight: 900;
}

.app-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, var(--rail-width));
  grid-template-rows: 66px minmax(0, 1fr) 66px;
  width: var(--rail-width);
  overflow: hidden;
  border-right: 1px solid var(--edge-divider-line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-width: 188px;
  padding: 0 10px;
}

/* Edge collapse/expand handle — vertically centered on the rail border, rectangular */
.rail-edge-toggle {
  position: fixed;
  top: 50%;
  left: var(--rail-width);
  transform: translate(-50%, -50%);
  z-index: 31;
  display: grid;
  place-items: center;
  width: 22px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--edge-divider-line);
  border-radius: 0;
  color: var(--muted);
  background: var(--edge-divider-surface);
  box-shadow: var(--edge-divider-shadow);
  transition: left 280ms cubic-bezier(0.22, 1, 0.36, 1),
    color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    background 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rail-edge-toggle:hover,
.rail-edge-toggle:focus-visible {
  color: var(--white);
  background: var(--black);
  outline: none;
}

.rail-edge-toggle .lucide {
  width: 16px;
  height: 16px;
}

body.is-auth-gate .rail-edge-toggle {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .rail-edge-toggle {
    transition: none;
  }
}

.rail-logo,
.rail-nav a,
.rail-nav-button,
.rail-account {
  color: var(--ink);
  text-decoration: none;
}

.rail-logo {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0;
  align-items: center;
  justify-items: center;
}

.rail-logo span,
.rail-nav a > span,
.rail-nav-button > span,
.rail-account > span,
.rail-symbol,
.account-avatar {
  display: grid;
  place-items: center;
  width: var(--rail-mark-size);
  height: var(--rail-mark-size);
  color: var(--white);
  background: var(--black);
  font-weight: 900;
  line-height: 1;
}

.account-avatar {
  overflow: hidden;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent);
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar.has-avatar-image {
  color: transparent;
  background: var(--paper);
}

.account-menu .account-avatar.has-avatar-image {
  color: transparent;
  background: var(--paper);
}

.account-avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: currentColor;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-rounded);
}

.rail-logo strong,
.rail-nav em,
.rail-nav-button em,
.rail-account em {
  min-width: 0;
  overflow: hidden;
  color: currentColor;
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
  font-family: var(--font-rounded);
  line-height: 1;
  opacity: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-6px);
  transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.is-rail-expanded .rail-logo strong,
body.is-rail-expanded .rail-nav em,
body.is-rail-expanded .rail-nav-button em,
body.is-rail-expanded .rail-account em {
  opacity: 1;
  transform: translateX(0);
}

.rail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 36px;
  width: auto;
  height: 36px;
  padding: 0 9px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  font-family: var(--font-rounded);
}

.rail-toggle:hover,
.rail-toggle:focus-visible {
  color: var(--white);
  background: var(--black);
}

.rail-toggle-label {
  display: none;
  line-height: 1;
  white-space: nowrap;
}

body.is-rail-expanded .rail-toggle-label {
  display: inline;
}

.rail-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 10px;
}

.rail-nav a,
.rail-nav-button,
.rail-account {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-item-size) minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  width: var(--rail-item-size);
  min-width: 0;
  min-height: var(--rail-item-size);
  color: var(--muted);
}

.rail-nav-button {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}

body.is-rail-expanded .rail-nav a,
body.is-rail-expanded .rail-nav-button,
body.is-rail-expanded .rail-account {
  width: calc(var(--rail-width) - (var(--rail-gutter) * 2));
  min-width: 0;
}

.rail-nav a::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 13px;
  bottom: 13px;
  width: 2px;
  background: currentColor;
  opacity: 0;
}

.rail-nav a:hover,
.rail-nav a:focus-visible,
.rail-nav-button:hover,
.rail-nav-button:focus-visible,
.rail-nav a[aria-current="page"],
.rail-account:hover,
.rail-account:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--active-wash) 72%, transparent);
}

.rail-nav a[aria-current="page"]::before {
  opacity: 1;
  color: var(--active-ink);
}

.rail-nav a > span,
.rail-nav-button > span,
.rail-account > span,
.rail-symbol,
.account-avatar {
  position: relative;
  width: var(--rail-mark-size);
  height: var(--rail-mark-size);
  color: var(--ink);
  background: transparent;
}

.rail-notify-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--paper);
  border-radius: 999px;
  color: var(--white);
  background: var(--notice-error-ink);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-number);
  box-shadow: 0 2px 8px rgba(180, 35, 24, 0.28);
}

.rail-notify-badge[hidden] {
  display: none;
}

.rail-logo strong,
.rail-nav em,
.rail-nav-button em,
.rail-account em {
  justify-self: start;
}

/* Lucide icon sizing + rail micro-animations */
.rail-symbol svg,
.rail-nav-button .rail-symbol svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rail-toggle .rail-symbol svg {
  width: 18px;
  height: 18px;
}

.rail-nav a:hover .rail-symbol svg,
.rail-nav a:focus-visible .rail-symbol svg,
.rail-nav-button:hover .rail-symbol svg,
.rail-nav-button:focus-visible .rail-symbol svg {
  transform: scale(1.14);
}

.rail-nav a[aria-current="page"] .rail-symbol svg {
  transform: scale(1.08);
}

.rail-toggle:hover .rail-symbol svg {
  transform: rotate(180deg);
}

/* Cascade the labels in as the rail expands */
body.is-rail-expanded .rail-nav a:nth-of-type(1) em { transition-delay: 40ms; }
body.is-rail-expanded .rail-nav a:nth-of-type(2) em { transition-delay: 80ms; }
body.is-rail-expanded .rail-nav a:nth-of-type(3) em { transition-delay: 120ms; }
body.is-rail-expanded .rail-nav-button em { transition-delay: 150ms; }
body.is-rail-expanded .rail-nav a:nth-of-type(4) em { transition-delay: 180ms; }
body.is-rail-expanded .rail-account em { transition-delay: 210ms; }

@media (prefers-reduced-motion: reduce) {
  .app-rail,
  .rail-logo strong,
  .rail-nav em,
  .rail-nav-button em,
  .rail-account em,
  .rail-symbol svg {
    transition: none;
  }
}

.rail-account {
  align-self: center;
  justify-self: start;
  margin-inline: var(--rail-gutter);
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: var(--topbar-height);
  padding: 12px var(--page-inline-gutter);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0;
  font-family: var(--font-rounded);
}

.topic-nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-search {
  display: none;
  width: min(280px, 32vw);
}

body.is-articles-view .article-search {
  display: block;
}

.article-search input {
  width: 100%;
  height: 36px;
  padding: 0 66px 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.article-search input:focus {
  border-color: var(--ink);
}

.toolbar button,
.copy-head button,
.prompt-head button,
.load-more,
.icon-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

/* Open, borderless topic nav — no dividers or boxes */
.topic-nav {
  gap: 2px;
}

.topic-nav button,
.topic-list button {
  flex: 0 0 auto;
  min-height: 34px;
  margin: 0;
  padding: 6px 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
}

.topic-nav button:hover,
.topic-list button:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.topic-nav button[aria-current="page"],
.topic-list button[aria-current="page"] {
  position: relative;
  color: var(--active-ink);
  background: color-mix(in srgb, var(--active-wash) 68%, transparent);
}

.topic-nav button[aria-current="page"]::after,
.topic-list button[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 4px;
  left: 10px;
  height: 2px;
  background: currentColor;
}

.topic-nav button[data-admin-only="true"],
.topic-list button[data-admin-only="true"] {
  color: var(--active-ink);
}

.topic-nav button[data-admin-only="true"]::before,
.topic-list button[data-admin-only="true"]::before {
  content: "ADMIN";
  margin-right: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.topic-nav-overflow-menu {
  position: relative;
  flex: 0 0 auto;
}

.topic-nav-nested-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: stretch;
}

.topic-nav-nested-menu > button[data-topic-nested-parent="true"] {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.topic-nav-nested-toggle {
  min-width: 30px !important;
  padding-inline: 7px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  color: var(--muted) !important;
}

.topic-nav-nested-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.topic-nav-nested-menu.is-open .topic-nav-nested-toggle svg {
  transform: rotate(180deg);
}

.topic-nav-nested-submenu {
  position: fixed;
  top: var(--topic-nav-nested-top, 56px);
  left: var(--topic-nav-nested-left, 0);
  z-index: 46;
  display: none;
  width: min(220px, calc(100vw - 16px));
  max-height: min(420px, calc(100dvh - var(--topic-nav-nested-top, 56px) - 12px));
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.topic-nav-nested-menu.is-open .topic-nav-nested-submenu {
  display: grid;
  gap: 2px;
}

.topic-nav-nested-submenu button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
}

.topic-nav-overflow-menu > button[data-topic-overflow="true"] {
  color: var(--ink);
}

.topic-nav-overflow-submenu {
  position: fixed;
  top: var(--topic-nav-overflow-top, 56px);
  left: var(--topic-nav-overflow-left, 0);
  z-index: 45;
  display: none;
  width: min(240px, calc(100vw - 16px));
  max-height: min(520px, calc(100dvh - var(--topic-nav-overflow-top, 56px) - 12px));
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.topic-nav-overflow-menu.is-open .topic-nav-overflow-submenu {
  display: grid;
  gap: 2px;
}

.topic-nav-overflow-submenu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
}

.topic-nav-overflow-settings {
  margin-top: 6px;
  border-top: 1px solid var(--line) !important;
  color: var(--ink) !important;
}

.admin-topic-menu {
  position: relative;
  flex: 0 0 auto;
}

.admin-topic-menu > button[data-admin-menu="true"] {
  color: var(--active-ink);
}

.admin-topic-submenu {
  position: fixed;
  top: var(--admin-topic-submenu-top, 56px);
  left: var(--admin-topic-submenu-left, 0);
  z-index: 40;
  display: none;
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.admin-topic-menu.is-open .admin-topic-submenu {
  display: grid;
  gap: 2px;
}

.admin-topic-submenu :is(button, a) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  color: var(--ink);
  text-decoration: none;
}

.admin-topic-count {
  min-width: 1.75em;
  color: var(--active-ink);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.header-icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
  transition: color 160ms var(--ease-out, ease), background 160ms var(--ease-out, ease), border-color 160ms var(--ease-out, ease);
}

.header-icon-button:hover,
.header-icon-button:focus-visible {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
  outline: none;
}

.header-icon-button[aria-pressed="true"] {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
}

.article-notification-button .rail-notify-badge {
  background: var(--accent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 32%, transparent);
}

.header-icon-button .lucide {
  width: 18px;
  height: 18px;
}

.account-menu {
  position: fixed;
  left: calc(var(--rail-width) + 12px);
  bottom: 14px;
  z-index: 50;
  width: min(320px, calc(100vw - 28px));
  padding: 12px;
  overflow: hidden;
}

.account-menu[hidden] {
  display: none;
}

.account-menu-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.account-menu .account-avatar {
  width: 38px;
  height: 38px;
  color: var(--white);
  background: var(--black);
}

.account-menu .account-avatar.has-avatar-image {
  color: transparent;
  background: var(--paper);
}

.account-menu .account-avatar-fallback {
  font-size: 13px;
}

.account-menu strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  color: var(--ink);
  background: var(--paper);
  font-weight: 900;
  font-family: var(--font-rounded);
}

.account-menu button svg {
  width: 16px;
  height: 16px;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
}

main {
  width: 100%;
  padding-inline: var(--page-inline-gutter);
}

.login-gate {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: clamp(28px, 6vw, 76px) 0;
}

.login-copy {
  display: grid;
  justify-items: center;
  max-width: 620px;
  text-align: center;
}

.login-logo {
  display: inline-grid;
  gap: 12px;
  justify-items: center;
  margin-bottom: clamp(44px, 8vw, 90px);
  color: var(--ink);
  text-decoration: none;
}

.login-logo span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--white);
  background: var(--black);
  font-weight: 900;
  font-family: var(--font-title);
}

.login-logo strong {
  font-size: 17px;
  font-weight: 900;
  font-family: var(--font-title);
}

.login-copy h1 {
  max-width: 8em;
  margin-bottom: 18px;
  font-size: clamp(46px, 8vw, 92px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
}

.login-copy .lede {
  max-width: 24em;
  margin-bottom: clamp(22px, 4vw, 38px);
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.7;
}

.public-count {
  display: inline-grid;
  gap: 18px;
  justify-items: center;
  margin-bottom: clamp(28px, 5vw, 46px);
}

.public-count strong {
  font-size: clamp(72px, 15vw, 180px);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: 0;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}

.public-count span {
  color: var(--muted);
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 900;
}

.gate-note {
  margin: 0;
  max-width: min(420px, 100%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.gate-note[hidden] {
  display: none;
}

.home-auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  width: min(310px, 100%);
}

.home-auth-actions .open-auth-button {
  min-width: 0;
}

.open-auth-button {
  min-width: 180px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--black);
  color: var(--white);
  background: var(--black);
  font-weight: 900;
  font-family: var(--font-rounded);
}

.open-auth-button-secondary {
  color: var(--ink);
  background: var(--paper);
}

.open-auth-button:hover,
.open-auth-button:focus-visible,
.open-auth-button-secondary:hover,
.open-auth-button-secondary:focus-visible {
  color: var(--white);
  background: var(--black);
}

.login-actions {
  display: grid;
  gap: 12px;
  align-self: center;
  padding-top: 4px;
}

.auth-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
}

.auth-dialog::backdrop {
  background: var(--ui-backdrop);
  backdrop-filter: blur(5px);
}

.auth-dialog-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.auth-dialog-head h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 32px;
  line-height: 1.12;
}

.auth-dialog .login-actions {
  padding: 18px;
}

.auth-panel,
.activation-panel {
  display: grid;
  gap: 10px;
}

.auth-panel[hidden],
.activation-panel[hidden] {
  display: none;
}

.activation-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.activation-note {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.login-actions button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  font-weight: 900;
  font-family: var(--font-rounded);
}

.login-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  font-weight: 900;
  font-family: var(--font-rounded);
}

.login-actions button {
  width: 100%;
}

.pay-panel {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.pay-panel[hidden] {
  display: none;
}

.pay-tip {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
}

.pay-qr {
  display: grid;
  place-items: center;
  min-height: 220px;
  width: 220px;
}

.pay-qr img {
  width: 220px;
  height: 220px;
  display: block;
}

.login-actions button.activation-logout {
  min-height: 36px;
  margin-top: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-actions button.activation-logout:hover {
  color: var(--ink);
  text-decoration: underline;
}

.activation-pay-link {
  border: 0;
  background: transparent;
}

.login-actions button.activation-pay-link {
  justify-self: center;
  width: auto;
  min-height: auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.activation-pay-link strong {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  font-size: 12px;
}

.login-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.login-actions label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-actions input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.login-actions input:focus {
  border-color: var(--ink);
}

.login-actions a:hover,
.login-actions a:focus-visible,
.login-actions button:hover,
.login-actions button:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
}

.login-row button:first-child {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
}

.login-actions button.forgot-password-button {
  justify-self: end;
  width: auto;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-actions button.forgot-password-button:hover,
.login-actions button.forgot-password-button:focus-visible {
  color: var(--ink);
  border-color: transparent;
  background: transparent;
}

.login-actions button:disabled,
.login-actions button[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--muted-2);
  border-color: var(--line);
  background: var(--wash);
}

.login-actions button:disabled:hover,
.login-actions button[aria-disabled="true"]:hover {
  color: var(--muted-2);
  border-color: var(--line);
  background: var(--wash);
}

.login-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-status[data-tone],
.form-status[data-tone],
.member-status-line[data-tone] {
  color: var(--notice-tone-ink);
}

.prompt-flow span,
.topic-list button span,
.card-meta,
.detail-meta,
.login-actions input::placeholder {
  font-family: var(--font-rounded);
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-family: var(--font-title);
  font-size: clamp(48px, 7vw, 102px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

h2,
h3,
h4 {
  letter-spacing: 0;
}

.lede {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.toolbar {
  --toolbar-control-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.search {
  display: block;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-field {
  position: relative;
  display: block;
  min-width: 0;
}

.search #searchInput {
  width: 100%;
  height: var(--toolbar-control-height);
  padding: 0 118px 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.search #searchInput:focus {
  border-color: var(--ink);
}

.search-field:has(.backfill-concurrency-input:not([hidden])) #searchInput {
  padding-right: 188px;
}

.search-count {
  position: absolute;
  top: 50%;
  right: 10px;
  max-width: 96px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
}

.search:focus-within .search-count {
  color: var(--ink);
}

.color-filter {
  display: grid;
  align-items: center;
  justify-self: end;
  position: relative;
  width: var(--toolbar-control-height);
  height: var(--toolbar-control-height);
  min-height: var(--toolbar-control-height);
}

.color-filter-trigger {
  display: grid;
  place-items: center;
  width: var(--toolbar-control-height);
  min-width: var(--toolbar-control-height);
  height: var(--toolbar-control-height);
  min-height: var(--toolbar-control-height);
  padding: 0;
  border: 0;
  color: var(--ink);
  background: var(--color-filter-trigger-bg);
  outline: none;
  transition:
    background 160ms var(--ease-out, ease),
    box-shadow 160ms var(--ease-out, ease),
    transform 160ms var(--ease-out, ease);
}

.toolbar .color-filter-trigger {
  align-self: center;
  min-width: 44px;
  padding: 0;
  border-width: 0;
}

.color-filter-swatch {
  display: block;
  position: relative;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border-radius: 999px;
  background:
    conic-gradient(from 8deg, #ff426d, #ff9f1c, #ffe66d, #22c55e, #06b6d4, #2563eb, #8b5cf6, #ec4899, #ff426d);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent),
    0 0 0 1px color-mix(in srgb, var(--paper) 88%, transparent),
    0 6px 14px color-mix(in srgb, var(--ink) 10%, transparent);
  pointer-events: none;
  transform: rotate(0deg);
  transition:
    box-shadow 180ms var(--ease-out, ease),
    filter 180ms var(--ease-out, ease),
    transform 180ms var(--ease-out, ease);
}

.color-filter-swatch::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  border: 1px solid var(--color-filter-swatch-core-border);
  background:
    radial-gradient(circle at 34% 28%, var(--color-filter-swatch-core-glint) 0 18%, var(--color-filter-swatch-core-glow) 19% 38%, transparent 39%),
    var(--color-filter-swatch-core);
  box-shadow:
    inset 0 -1px 2px color-mix(in srgb, var(--ink) 14%, transparent),
    0 1px 3px var(--color-filter-swatch-core-shadow);
  transition:
    background 180ms var(--ease-out, ease),
    border-color 180ms var(--ease-out, ease),
    box-shadow 180ms var(--ease-out, ease),
    transform 180ms var(--ease-out, ease);
}

.color-filter-swatch::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--color-filter-active-color, #ff4d4d) 18%, transparent);
  opacity: 0;
  filter: blur(6px);
  transition: opacity 180ms var(--ease-out, ease);
}

.color-filter:hover .color-filter-trigger,
.color-filter:focus-within .color-filter-trigger {
  background: var(--color-filter-trigger-hover-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
  transform: translateY(-1px);
}

.color-filter-trigger[aria-expanded="true"] {
  background: var(--color-filter-trigger-open-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent);
}

.color-filter.is-active .color-filter-trigger {
  background: var(--color-filter-trigger-active-bg);
}

.color-filter:hover .color-filter-swatch,
.color-filter:focus-within .color-filter-swatch {
  filter: saturate(1.16) brightness(1.05);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent),
    0 0 0 3px color-mix(in srgb, var(--color-filter-active-color, #ff4d4d) 16%, transparent),
    0 8px 18px color-mix(in srgb, var(--ink) 14%, transparent);
  transform: rotate(18deg) scale(1.04);
}

.color-filter:hover .color-filter-swatch::before,
.color-filter:focus-within .color-filter-swatch::before {
  opacity: 1;
}

.color-filter:hover .color-filter-swatch::after,
.color-filter:focus-within .color-filter-swatch::after {
  transform: scale(0.92);
}

.color-filter.is-active .color-filter-swatch {
  background:
    conic-gradient(from 8deg, #ff426d, #ff9f1c, #ffe66d, #22c55e, #06b6d4, #2563eb, #8b5cf6, #ec4899, #ff426d);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent),
    0 0 0 3px color-mix(in srgb, var(--color-filter-active-color, #000000) 18%, transparent),
    0 8px 18px color-mix(in srgb, var(--color-filter-active-color, #000000) 20%, transparent);
}

.color-filter.is-active .color-filter-swatch::after {
  border-color: color-mix(in srgb, var(--white) 82%, transparent);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.86) 0 16%, rgba(255, 255, 255, 0.32) 17% 35%, transparent 36%),
    var(--color-filter-active-color, #000000);
}

.color-filter-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: 204px;
  min-height: 272px;
  padding: 9px;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #f8fafc;
  background: #111827;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
}

.color-filter-panel[hidden] {
  display: none;
}

.color-filter-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}

.color-filter-panel-value {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-rounded);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.color-filter-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13px;
  gap: 7px;
  align-items: stretch;
  margin-bottom: 8px;
}

.color-filter-plane {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  background:
    linear-gradient(to top, #000000, transparent),
    linear-gradient(to right, #ffffff, var(--color-filter-picker-hue, #ff0000));
  cursor: crosshair;
  touch-action: none;
}

.color-filter-plane:focus-visible,
.color-filter-hue:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.color-filter-plane-thumb {
  position: absolute;
  left: var(--color-filter-picker-x, 100%);
  top: var(--color-filter-picker-y, 0%);
  width: 10px;
  height: 10px;
  border: 1px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.58);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-filter-hue {
  position: relative;
  width: 13px;
  height: 100%;
  min-height: 149px;
  border-radius: 4px;
  background: linear-gradient(to bottom, #ff0000 0%, #ff00ff 17%, #0000ff 33%, #00ffff 50%, #00ff00 67%, #ffff00 83%, #ff0000 100%);
  cursor: ns-resize;
  touch-action: none;
}

.color-filter-hue-thumb {
  position: absolute;
  left: 50%;
  top: var(--color-filter-hue-y, 0%);
  width: 14px;
  height: 6px;
  border: 1px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-filter-preset-grid {
  display: grid;
  grid-template-columns: repeat(7, 21px);
  gap: 5px;
  margin-bottom: 9px;
}

.color-filter-preset {
  width: 21px;
  min-width: 21px;
  height: 21px;
  min-height: 21px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: var(--preset-color, transparent);
}

.color-filter-preset.is-reset {
  position: relative;
  background:
    linear-gradient(45deg, transparent 0 44%, #ef4444 45% 55%, transparent 56%),
    #e5e7eb;
}

.color-filter-preset[aria-pressed="true"] {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.color-filter-custom {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 4px 5px;
  border: 1px solid #2563eb;
  border-radius: 5px;
  background: #0f172a;
}

.color-filter-current {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  background: var(--color-filter-display-color, #ff4d4d);
}

.color-filter-hex-input:focus {
  border-color: transparent;
  outline: none;
}

.color-filter-hex-input {
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 1px solid transparent;
  color: #d1d5db;
  background: transparent;
  font-family: var(--font-rounded);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.clear-color-filter {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #cbd5e1;
  background: color-mix(in srgb, #1f2937 74%, transparent);
}

.clear-color-filter:hover,
.clear-color-filter:focus-visible {
  color: #ffffff;
  background: #334155;
  outline: none;
}

.clear-color-filter:disabled {
  opacity: 0.42;
  cursor: default;
}

.clear-color-filter i {
  width: 14px;
  height: 14px;
}

.toolbar .color-filter-panel button {
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.sort-segment {
  display: flex;
  align-items: center;
  min-height: var(--toolbar-control-height);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sort-segment-options {
  display: inline-flex;
  align-items: stretch;
  min-height: var(--toolbar-control-height);
  border: 1px solid var(--line);
  background: var(--paper);
}

.sort-segment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 0;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.sort-segment-button:last-child {
  border-right: 0;
}

.sort-segment-button:hover,
.sort-segment-button:focus-visible {
  color: var(--ink);
  background: var(--wash);
  outline: none;
}

.sort-segment-button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
}

.toolbar button {
  min-height: var(--toolbar-control-height);
  height: var(--toolbar-control-height);
  padding: 0 16px;
}

.load-more {
  min-height: 44px;
  padding: 0 16px;
}

.toolbar button {
  align-self: center;
  min-width: 88px;
}

.toolbar button:hover,
.load-more:hover,
.copy-head button:hover,
.prompt-head button:hover,
.icon-button:hover {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
}

.toolbar .sort-segment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 74px;
  height: 100%;
  min-height: 0;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
}

.toolbar .sort-segment-options {
  height: var(--toolbar-control-height);
  min-height: var(--toolbar-control-height);
}

.toolbar .sort-segment-button:last-child {
  border-right: 0;
}

.toolbar .sort-segment-button:hover,
.toolbar .sort-segment-button:focus-visible {
  color: var(--ink);
  background: var(--wash);
}

.toolbar .sort-segment-button[aria-pressed="true"],
.toolbar .sort-segment-button[aria-pressed="true"]:hover,
.toolbar .sort-segment-button[aria-pressed="true"]:focus-visible {
  color: var(--paper);
  background: var(--ink);
}

.toolbar .clear-color-filter {
  align-self: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
}

.toolbar .clear-color-filter:hover,
.toolbar .clear-color-filter:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  background: var(--wash);
}

.toolbar .color-filter-trigger {
  align-self: center;
  min-width: var(--toolbar-control-height);
  height: var(--toolbar-control-height);
  min-height: var(--toolbar-control-height);
  padding: 0;
}

.toolbar .color-filter-panel button {
  align-self: center;
  height: auto;
  padding: 0;
}

.toolbar .color-filter-panel .clear-color-filter {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
}

.toolbar .color-filter-preset,
.toolbar .color-filter-preset:hover,
.toolbar .color-filter-preset:focus-visible {
  min-width: 21px;
  min-height: 21px;
  width: 21px;
  height: 21px;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--preset-color, transparent);
}

.toolbar .color-filter-preset.is-reset,
.toolbar .color-filter-preset.is-reset:hover,
.toolbar .color-filter-preset.is-reset:focus-visible {
  background:
    linear-gradient(45deg, transparent 0 44%, #ef4444 45% 55%, transparent 56%),
    #e5e7eb;
}

.toolbar .color-filter-preset[aria-pressed="true"],
.toolbar .color-filter-preset[aria-pressed="true"]:hover,
.toolbar .color-filter-preset[aria-pressed="true"]:focus-visible {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.toolbar .color-filter-panel .color-filter-preset {
  width: 21px;
  height: 21px;
}

.content-grid {
  display: block;
  padding: 18px 0 74px;
}

.topic-panel {
  border: 1px solid var(--line);
  background: var(--paper);
}

.topic-panel {
  position: sticky;
  top: 84px;
  align-self: start;
}

.topic-panel h2 {
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.topic-list {
  display: grid;
}

.topic-list button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-top: -1px;
  padding: 10px 12px;
  text-align: left;
}

.topic-list button span {
  color: inherit;
  opacity: 0.62;
}

.results {
  position: relative;
  padding: 0;
}

.toolbar-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  min-height: 44px;
}

.backfill-concurrency-input {
  position: absolute;
  top: 50%;
  right: 112px;
  width: 64px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  color: var(--ink);
  background: var(--panel);
  font: 900 12px/1 var(--font-number);
  text-align: center;
  transform: translateY(-50%);
}

.backfill-concurrency-input:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.admin-backfill-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  color: var(--white);
  background: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.toolbar .admin-backfill-all {
  align-self: center;
  min-height: var(--toolbar-control-height);
}

.toolbar .admin-backfill-all {
  height: var(--toolbar-control-height);
}

.admin-backfill-all svg {
  width: 15px;
  height: 15px;
}

.admin-backfill-all:disabled {
  cursor: wait;
  opacity: 0.72;
}

/* Subtle enter animation when switching nav destinations */
@keyframes viewEnter {
  from { opacity: 0; transform: translate3d(14px, 8px, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes newsletterViewEnter {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: none; }
}

.view-enter {
  animation: viewEnter 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.notification-history-view.is-newsletter-view.view-enter {
  animation-name: newsletterViewEnter;
}

@media (prefers-reduced-motion: reduce) {
  .view-enter { animation: none; }
  body,
  .detail-panel,
  .article-detail,
  .image-create-panel,
  .article-card,
  .image-api-card {
    transition: none;
  }
}

.prompt-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.prompt-flow span {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  padding: 0 10px;
  background: var(--wash);
}

.style-grid {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 1px;
}

.style-grid.is-layout-settling {
  width: var(--style-grid-freeze-width);
  height: var(--style-grid-freeze-height);
  max-width: none;
  overflow: visible;
}

.style-grid.is-layout-settling .style-card {
  transition: none;
}

/* After the detail panel settles we reposition the existing cards in place (no
   rebuild) and let their transform animate, so the grid visibly glides to the new
   column layout instead of snapping — you can follow the card you just opened. */
.style-grid.is-reflow-animating .style-card {
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.favorite-content-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 18px;
}

.favorite-content-list[hidden] {
  display: none;
}

.favorite-content-list.is-loading {
  display: block;
}

.favorites-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 42px 16px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
  font-size: 14px;
  text-align: center;
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.style-card {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  /* Keep layout isolated without clipping hover shadows or action feedback. */
  contain: layout style;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), filter 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.style-card-open {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.style-card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

/* Hover lifts the image with a shadow (no extra outline that fights the art). */
.style-card:hover .style-card-open,
.style-card:focus-within .style-card-open {
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.style-card.is-detail-selected .style-card-open,
.style-card.is-detail-selected:hover .style-card-open,
.style-card.is-detail-selected:focus-within .style-card-open {
  border-color: var(--active-ink);
  box-shadow:
    inset 0 0 0 1px var(--active-ink),
    0 0 0 3px color-mix(in srgb, var(--active-ink) 12%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

.style-card.is-detail-selected {
  z-index: 3;
}

/* The open card keeps a highlight ring (below) so you can see which detail is
   open, but the rest of the waterfall is NOT dimmed — dimming every other card
   was distracting and got in the way of the next action. */

.style-card-hit:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: -2px;
}

/* Favorite toggle */
.fav-button {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.fav-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  transition: fill 140ms ease, transform 140ms ease;
}

.fav-button.is-on {
  color: #e0245e;
}

.fav-button.is-on svg {
  fill: #e0245e;
  stroke: #e0245e;
}

.fav-button:active svg {
  transform: scale(0.85);
}

.fav-button-card {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 34px;
  height: 34px;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  border: 0;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}

/* Favorited heart sits subtly over the image — light scrim, soft glyph shadow. */
.fav-button-card svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.fav-button-card.is-on {
  color: #ff5278;
}

.fav-button-card.is-on svg {
  fill: #ff5278;
  stroke: #ff5278;
}

/* Hover/focus reveals it; a favorited card keeps the heart visible by default. */
.style-card:hover .fav-button-card,
.style-card:focus-within .fav-button-card,
.style-row:hover .fav-button-card,
.style-row:focus-within .fav-button-card,
.fav-button-card:focus-visible,
.fav-button-card.is-on {
  opacity: 1;
}

/* A saved image should keep its heart visible even inside the favorites view. */
.style-grid.is-favorites-view .fav-button-card.is-on {
  opacity: 1;
}

.style-grid.is-favorites-view .style-card:hover .fav-button-card,
.style-grid.is-favorites-view .style-card:focus-within .fav-button-card,
.style-grid.is-favorites-view .style-row:hover .fav-button-card,
.style-grid.is-favorites-view .style-row:focus-within .fav-button-card,
.style-grid.is-favorites-view .fav-button-card:focus-visible {
  opacity: 1;
}

/* Hover just deepens the same translucent scrim — no jarring light flip. */
.fav-button-card:hover {
  background: rgba(0, 0, 0, 0.32);
}

.admin-card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.admin-delete-card,
.admin-hide-card,
.admin-restore-card,
.admin-delete-article {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}

.admin-delete-article {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
}

.admin-delete-card,
.admin-hide-card,
.admin-restore-card,
.admin-delete-article {
  display: grid;
  width: 34px;
  border: 0;
  padding: 0;
  place-items: center;
  background: rgba(132, 24, 24, 0.82);
}

.admin-hide-card {
  background: rgba(26, 34, 44, 0.78);
}

.admin-restore-card {
  background: rgba(33, 105, 72, 0.84);
}

.admin-delete-card svg,
.admin-hide-card svg,
.admin-restore-card svg,
.admin-delete-article svg {
  width: 15px;
  height: 15px;
}

.style-card:hover .admin-card-actions,
.style-card:focus-within .admin-card-actions,
.admin-card-actions:focus-within,
.admin-delete-card:focus-visible {
  opacity: 1;
}

.admin-delete-card:hover,
.admin-delete-article:hover {
  background: rgba(172, 34, 34, 0.94);
}

.admin-hide-card:hover {
  background: rgba(17, 24, 33, 0.92);
}

.admin-restore-card:hover {
  background: rgba(27, 129, 82, 0.94);
}

.admin-delete-card:disabled,
.admin-hide-card:disabled,
.admin-restore-card:disabled,
.admin-delete-article:disabled {
  cursor: wait;
  opacity: 1;
}

.dialog-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.fav-button-detail {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
}

.fav-button-detail:hover {
  border-color: var(--black);
}

.fav-button-detail.is-on {
  border-color: #e0245e;
}

.grid-empty {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 46px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.grid-empty strong {
  color: var(--ink);
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.grid-empty span {
  max-width: 520px;
}

.grid-loading {
  display: grid;
  grid-template-columns: auto minmax(0, max-content);
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 18px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.grid-loading-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--active-ink);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--active-ink) 30%, transparent);
  animation: gridLoadingPulse 1.2s ease-out infinite;
}

.style-grid.is-loading {
  display: block;
}

.grid-loading-skeleton {
  columns: 190px;
  column-gap: 14px;
  padding: 0 2px 18px;
}

.grid-loading-skeleton--articles {
  columns: 320px;
  column-gap: 20px;
}

.grid-loading-skeleton--content {
  columns: 300px;
  column-gap: 16px;
}

.grid-loading-card {
  display: block;
  overflow: hidden;
  break-inside: avoid;
  width: 100%;
  aspect-ratio: var(--loading-card-ratio, 4 / 5);
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--paper) 72%, transparent), transparent),
    color-mix(in srgb, var(--wash) 82%, var(--paper));
  background-size: 220% 100%, 100% 100%;
  animation: gridLoadingSweep 1.25s ease-in-out infinite;
}

@keyframes gridLoadingPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--active-ink) 34%, transparent); }
  72% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--active-ink) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--active-ink) 0%, transparent); }
}

@keyframes gridLoadingSweep {
  from { background-position: 180% 0, 0 0; }
  to { background-position: -80% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .grid-loading-pulse,
  .grid-loading-card {
    animation: none;
  }
}

.thumb {
  position: relative;
  display: block;
  border-bottom: 1px solid var(--line);
  background: var(--wash);
}

.image-action-bar {
  position: absolute;
  z-index: 4;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.image-action-bar--primary {
  top: 8px;
  left: 8px;
  justify-content: flex-start;
  transform: translateY(-4px);
}

.image-action-bar--secondary {
  right: 8px;
  bottom: 8px;
  left: 8px;
  justify-content: flex-end;
  transform: translateY(4px);
}

.image-action-button {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--white);
  background: rgba(5, 5, 5, 0.64);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(7px);
  transition: background 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.image-action-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.image-action-button:hover,
.image-action-button:focus-visible {
  background: var(--black);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  outline: none;
}

.image-action-button:active {
  transform: scale(0.94);
}

.image-action-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.image-action-button[aria-busy="true"] svg {
  animation: image-action-spin 820ms linear infinite;
}

@keyframes image-action-spin {
  to {
    transform: rotate(360deg);
  }
}

.image-favorite-action.is-on {
  color: #ff5278;
}

.image-favorite-action.is-on svg {
  fill: #ff5278;
  stroke: #ff5278;
}

.image-delete-sample-action {
  background: rgba(132, 24, 24, 0.82);
}

.image-delete-sample-action:hover,
.image-delete-sample-action:focus-visible {
  background: rgba(172, 34, 34, 0.94);
}

.image-favorite-feedback {
  display: inline-flex;
  height: 28px;
  padding: 0 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  color: var(--white);
  background: rgba(17, 17, 17, 0.76);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px) scale(0.98);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.image-favorite-feedback[data-tone="error"] {
  border-color: rgba(255, 255, 255, 0.64);
  background: rgba(34, 34, 34, 0.82);
}

.image-favorite-feedback.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.image-action-button::after {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 7px);
  z-index: 10;
  padding: 4px 7px;
  color: #fff;
  background: rgba(0, 0, 0, 0.88);
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.image-action-button:hover::after,
.image-action-button:focus-visible::after {
  opacity: 1;
  transform: translate(50%, 0);
}

.style-card:hover .image-action-bar,
.style-card:focus-within .image-action-bar,
.gallery-tile:hover .image-action-bar,
.gallery-tile:focus-within .image-action-bar,
.image-action-bar--primary.has-active-favorite,
.image-action-bar--primary.has-local-feedback {
  opacity: 1;
  transform: translateY(0);
}

.thumb-copy-image {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--white);
  background: rgba(5, 5, 5, 0.64);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
  backdrop-filter: blur(6px);
}

.thumb-copy-image svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.thumb-copy-image:hover,
.thumb-copy-image:focus-visible {
  background: var(--black);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  outline: none;
}

.thumb-copy-image:disabled {
  cursor: wait;
}

.thumb-make-similar {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  color: var(--white);
  background: rgba(5, 5, 5, 0.64);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.thumb-make-similar svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.thumb-make-similar:hover,
.thumb-make-similar:focus-visible {
  background: var(--black);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  outline: none;
}

.thumb-make-similar:disabled {
  cursor: wait;
}

.style-card:hover .thumb-make-similar,
.style-card:focus-within .thumb-make-similar {
  opacity: 1;
  transform: translateY(0);
}

.style-card:hover .thumb-copy-image,
.style-card:focus-within .thumb-copy-image {
  opacity: 1;
  transform: translateY(0);
}

.thumb-inner {
  display: block;
  width: 100%;
  background: var(--wash);
}

.thumb-inner.has-preview-carousel {
  position: relative;
  overflow: hidden;
}

.thumb-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease;
}

.thumb-inner img.is-loaded {
  opacity: 1;
}

.thumb-inner.has-preview-carousel img,
.thumb-carousel-image {
  position: absolute;
  inset: 0;
  object-fit: contain;
  object-position: center;
  opacity: 0;
}

.thumb-inner.has-preview-carousel img.is-active,
.thumb-carousel-image.is-active {
  opacity: 1;
}

.thumb-inner.is-empty {
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(17, 17, 17, 0.08), transparent 36%),
    repeating-linear-gradient(135deg, #f4f4f5 0 10px, #ffffff 10px 20px);
  border-bottom: 1px solid var(--line);
}

.thumb-inner.is-backfill-empty {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 86%, transparent), color-mix(in srgb, var(--wash) 92%, transparent)),
    var(--wash);
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  width: calc(100% - 36px);
  min-height: 118px;
  padding: 18px;
  border: 1px dashed color-mix(in srgb, var(--ink) 22%, transparent);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  text-align: center;
}

.thumb-placeholder span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.thumb-placeholder strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.thumb-placeholder-backfill {
  width: min(46%, 112px);
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border-style: solid;
  border-color: color-mix(in srgb, var(--ink) 16%, transparent);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 150ms ease, transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.thumb-placeholder-backfill span {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0;
}

.style-card:hover .thumb-placeholder-backfill,
.style-card:focus-within .thumb-placeholder-backfill {
  border-color: color-mix(in srgb, var(--ink) 38%, transparent);
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14);
  opacity: 1;
  transform: translateY(0) scale(1);
}

.grid-sentinel {
  width: 100%;
  height: 1px;
}

.quiet-image-mode-button {
  position: fixed;
  right: var(--page-inline-gutter);
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 34px));
  z-index: 90;
  display: grid;
  width: 54px;
  height: 54px;
  padding: 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.quiet-image-mode-button[hidden] {
  display: none;
}

.quiet-image-mode-button svg {
  width: 18px;
  height: 18px;
}

.quiet-image-mode-progress {
  position: fixed;
  right: var(--page-inline-gutter);
  bottom: max(10px, calc(env(safe-area-inset-bottom) + 10px));
  z-index: 89;
  display: block;
  width: 54px;
  padding: 2px 4px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  font-family: var(--font-rounded);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  backdrop-filter: blur(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.quiet-image-mode-progress[hidden] {
  display: none;
}

.quiet-image-mode-progress.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.quiet-image-mode-button:hover,
.quiet-image-mode-button:focus-visible {
  border-color: var(--ink);
  background: var(--paper);
  outline: none;
  transform: translateY(-1px);
}

.quiet-image-mode-button[aria-pressed="true"] {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .quiet-image-mode-button {
  border-color: var(--active-line);
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .quiet-image-mode-button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--active-line-strong);
  background: var(--active-wash-strong);
}

body.is-right-panel-open .quiet-image-mode-button {
  right: calc(var(--detail-width) + var(--page-inline-gutter));
}

body.is-right-panel-open .quiet-image-mode-progress {
  right: calc(var(--detail-width) + var(--page-inline-gutter));
}

body.is-quiet-image-mode .style-grid .card-copy,
body.is-quiet-image-mode .style-grid .image-action-bar,
body.is-quiet-image-mode .style-grid .admin-card-actions,
body.is-quiet-image-mode .style-grid .admin-delete-card {
  display: none;
}

body.is-quiet-image-mode .style-grid .style-card-open {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body.is-quiet-image-mode .style-grid .thumb {
  border-bottom: 0;
  background: transparent;
}

body.is-quiet-image-mode .style-card:hover .style-card-open,
body.is-quiet-image-mode .style-card:focus-within .style-card-open {
  border-color: transparent;
  box-shadow: none;
}

body.is-quiet-image-mode .style-grid .style-card.is-detail-selected .style-card-open {
  border-color: var(--active-ink);
  box-shadow:
    inset 0 0 0 1px var(--active-ink),
    0 0 0 3px color-mix(in srgb, var(--active-ink) 12%, transparent);
}

@media (max-width: 720px) {
  .quiet-image-mode-button {
    right: var(--page-inline-gutter);
    /* Float clear ABOVE the 64px bottom tab bar (+ home-indicator inset) instead
       of overlapping its rightmost tab. */
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px);
  }

  body.is-right-panel-open .quiet-image-mode-button {
    right: var(--page-inline-gutter);
  }
}

/* View toggle (waterfall / list) */
.view-toggle {
  display: inline-flex;
  gap: 2px;
}

.view-toggle-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.view-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.view-toggle-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.view-toggle-btn[aria-pressed="true"] {
  color: var(--white);
  background: var(--black);
}

/* Detail gallery layout toggle bar */
.detail-gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 8px;
}

.detail-gallery-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-gallery-bar .view-toggle-btn {
  width: 30px;
  height: 30px;
}

.detail-gallery-bar .view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

.card-copy {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
}

.card-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  margin: 0 0 8px;
  gap: 10px;
}

.card-topic,
.card-meta,
.thumb-count {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.card-topic {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.thumb-count {
  flex: 0 0 auto;
  font-family: var(--font-rounded);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

.card-copy h3 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.32;
}

.card-meta {
  align-self: end;
  margin-bottom: 0;
}

.load-more {
  display: block;
  margin: 22px auto 0;
}

/* Docked, resizable detail panel — shares the screen, not an overlay */
.detail-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 25;
  width: var(--detail-width);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--edge-divider-line);
  box-shadow: none;
  color: var(--ink);
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Sticky action dock pinned to the bottom of the detail panel */
.detail-dock {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  gap: 10px;
  padding: 12px clamp(14px, 2.2vw, 24px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}

.dock-button {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  color: var(--white);
  background: var(--black);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 140ms ease;
}

.dock-button:hover {
  opacity: 0.9;
}

.dock-button svg {
  width: 18px;
  height: 18px;
}

.dock-icon-button {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--card);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.dock-icon-button:hover,
.dock-icon-button:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
}

.dock-icon-button svg {
  width: 18px;
  height: 18px;
}

.dock-download {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  height: 46px;
}

.dock-download .dock-icon-button {
  height: 46px;
}

.dock-download-main {
  width: 46px;
}

.dock-download-toggle {
  width: 26px;
  margin-left: -1px;
  border-left-color: color-mix(in srgb, var(--line) 72%, transparent);
}

.dock-download-toggle svg {
  width: 14px;
  height: 14px;
}

.dock-download-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  display: grid;
  min-width: 164px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

.dock-download-menu[hidden] {
  display: none;
}

.dock-download-menu button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 0 9px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.dock-download-menu button:hover,
.dock-download-menu button:focus-visible,
.dock-download-menu button[aria-checked="true"] {
  color: var(--white);
  background: var(--black);
  outline: none;
}

.dock-download-menu svg {
  width: 16px;
  height: 16px;
}

.detail-panel[hidden] {
  display: none;
}

body.is-detail-open .detail-panel {
  transform: translateX(0);
}

body.is-article-detail-open .article-detail {
  transform: translateX(0);
  opacity: 1;
}

body.is-image-create-open .image-create-panel {
  transform: translateX(0);
}

body.is-image-api-open .image-api-panel {
  transform: translateX(0);
}

body.is-profile-open .profile-panel {
  transform: translateX(0);
}

body.is-notification-center-open .notification-center-panel {
  transform: translateX(0);
}

body.is-topic-nav-settings-open .topic-nav-settings-panel {
  transform: translateX(0);
}

body.is-resizing .detail-panel {
  transition: none;
}

body.is-resizing .article-detail {
  transition: none;
}

body.is-resizing .image-create-panel {
  transition: none;
}

body.is-resizing .topic-nav-settings-panel {
  transition: none;
}

/* Fixed (not absolute) so it never scrolls out of reach; wide hit area. */
.detail-resizer {
  --detail-resizer-line: var(--edge-divider-line);
  --detail-resizer-line-active: var(--edge-divider-line-active);
  --detail-resizer-grip-surface: var(--edge-divider-surface);
  position: fixed;
  inset: 0 calc(var(--detail-width) - 17px) 0 auto;
  z-index: 31;
  display: none;
  width: 34px;
  cursor: col-resize;
  background: transparent;
  touch-action: none;
  outline: none;
}

body.is-right-panel-open .detail-resizer {
  display: block;
}

.detail-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
  background: var(--detail-resizer-line);
  opacity: 0.88;
  transition: background 180ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), width 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--detail-resizer-line);
  border-radius: 0;
  background: var(--detail-resizer-grip-surface);
  box-shadow: none;
  opacity: 0.72;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), border-color 180ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1), height 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-resizer:hover::before,
.detail-resizer:focus-visible::before,
body.is-resizing .detail-resizer::before {
  background: var(--detail-resizer-line-active);
  opacity: 1;
}

.detail-resizer:hover::after,
.detail-resizer:focus-visible::after,
body.is-resizing .detail-resizer::after {
  opacity: 1;
  border-color: var(--detail-resizer-line-active);
  background: var(--detail-resizer-grip-surface);
  box-shadow: none;
  height: 44px;
  transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
  .detail-resizer::before,
  .detail-resizer::after {
    animation: none;
    transition: none;
  }
}

@media (max-width: 700px) {
  body.is-right-panel-open {
    padding-right: 0;
  }

  .detail-panel,
  .image-create-panel,
  .article-detail,
  .profile-panel,
  .notification-center-panel,
  .topic-nav-settings-panel {
    width: 100vw;
    box-shadow: none;
  }

  body.is-right-panel-open .detail-resizer {
    display: none;
  }
}

.dialog-head,
.copy-head,
.prompt-head {
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.detail-panel > .dialog-head,
.detail-body {
  --detail-panel-gutter: clamp(16px, 3vw, 26px);
  --detail-panel-gutter-pair: clamp(32px, 6vw, 52px);
}

.detail-panel > .dialog-head {
  --detail-content-width: min(calc(100% - var(--detail-panel-gutter-pair)), 760px);
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-height: var(--topbar-height);
  margin-inline: 0;
  padding-inline: var(--detail-panel-gutter);
  padding-block: 8px;
}

.detail-panel > .dialog-head > div:first-child {
  min-width: 0;
}

.detail-panel > .dialog-head .eyebrow {
  overflow: hidden;
  margin: 0 0 1px;
  font-size: 11px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-panel-body {
  --detail-panel-gutter: clamp(16px, 3vw, 26px);
  display: grid;
  gap: 18px;
  padding: var(--detail-panel-gutter);
}

.profile-panel-body .avatar-block,
.profile-panel-body .member-field {
  margin-bottom: 0;
}

.notification-center-body {
  display: grid;
  gap: 14px;
  padding: clamp(14px, 2.4vw, 22px) clamp(14px, 2.4vw, 22px) calc(90px + env(safe-area-inset-bottom));
}

.notification-admin-dock,
.article-admin-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: var(--detail-width);
  box-sizing: border-box;
  padding: 12px clamp(14px, 2.2vw, 24px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}

.notification-admin-dock[hidden],
.article-admin-dock[hidden] {
  display: none;
}

.notification-admin-dock .dock-button,
.article-admin-dock .dock-button {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding-inline: 14px;
}

.notification-admin-icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--card);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.notification-admin-icon-button[hidden] {
  display: none;
}

.notification-admin-icon-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.notification-admin-icon-button:hover,
.notification-admin-icon-button:focus-visible {
  border-color: color-mix(in srgb, var(--active-ink) 46%, var(--line));
  color: var(--active-ink);
  background: var(--active-wash);
  outline: none;
  transform: translateY(-1px);
}

.notification-admin-icon-button:disabled {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 78%, var(--bg));
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.notification-admin-dock .dock-button[aria-pressed="true"],
.article-admin-dock .dock-button[aria-pressed="true"] {
  color: var(--white);
  background: var(--active-ink);
}

.notification-admin-save-button {
  flex: 1 1 100%;
  width: 100%;
  max-width: none;
}

@media (max-width: 700px) {
  .notification-admin-dock,
  .article-admin-dock {
    width: 100vw;
  }
}

.notification-history-view {
  width: min(1180px, calc(100vw - var(--rail-width) - 48px));
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px);
}

.notification-history-view.is-newsletter-view {
  width: 100%;
  max-width: none;
  padding: 18px 0 90px;
}

.notification-history-view.is-newsletter-view .notification-history-head {
  display: none;
}

.notification-history-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.notification-history-head h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(22px, 2.2vw, 32px);
}

.notification-new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--card);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.notification-new-button:hover,
.notification-new-button:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
  transform: translateY(-1px);
}

.notification-new-button svg {
  width: 16px;
  height: 16px;
}

.notification-records-panel,
.notification-newsletter-view {
  display: grid;
  gap: 16px;
}

.notification-records-panel[hidden],
.notification-newsletter-view[hidden] {
  display: none;
}

.notification-history-list {
  --article-cover-ratio: 5 / 2;
  --article-body-height: auto;
  display: grid;
  gap: 16px;
  width: 100%;
}

.notification-history-card {
  --article-cover-ratio: 5 / 2;
  --article-body-height: auto;
  display: grid;
  grid-template-columns: minmax(260px, 38.5%) minmax(0, 1fr);
  align-items: stretch;
  min-height: 172px;
  margin: 0;
}

.notification-history-cover {
  display: grid;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: var(--wash);
  color: var(--active-ink);
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 900;
}

.notification-history-cover img,
.notification-current-cover img,
.notification-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notification-history-cover span {
  padding: 7px 9px;
  background: transparent;
}

.notification-history-content {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
  height: auto;
  min-height: 100%;
  padding: 20px 22px;
}

.notification-history-card:hover,
.notification-history-card:focus-within {
  border-color: var(--active-line-strong);
  transform: translateY(-1px);
}

.notification-history-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notification-history-card h3 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 18px;
  line-height: 1.25;
}

.notification-history-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.notification-history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.notification-history-card:hover .notification-history-actions,
.notification-history-card:focus-within .notification-history-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.notification-history-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.notification-history-edit:hover,
.notification-history-edit:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
}

.notification-history-edit svg {
  width: 14px;
  height: 14px;
}

.notification-history-empty,
.notification-empty {
  display: grid;
  gap: 6px;
  min-height: 128px;
  place-content: center;
  padding: 22px;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--wash) 58%, transparent);
  color: var(--muted);
  text-align: center;
}

.notification-history-empty strong,
.notification-empty strong {
  color: var(--ink);
  font-family: var(--font-title);
  font-size: 18px;
  line-height: 1.25;
}

.notification-history-empty span,
.notification-empty span {
  font-size: 13px;
  line-height: 1.6;
}

.notification-current {
  display: grid;
  gap: 10px;
}

.notification-current-cover {
  aspect-ratio: 5 / 2;
  overflow: hidden;
  margin: 0;
  background: var(--wash);
}

.notification-meta {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notification-current h3 {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.2;
}

.notification-markdown {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.notification-markdown :is(p, ul, h3, h4, h5) {
  margin: 0;
}

.notification-markdown ul {
  padding-left: 1.2em;
}

.notification-markdown a {
  color: var(--active-ink);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notification-markdown code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  background: var(--wash);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.notification-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notification-current-edit,
.notification-article-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.notification-admin-editor {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.notification-admin-editor[hidden] {
  display: none;
}

.notification-admin-editor textarea {
  min-height: 220px;
  resize: vertical;
}

.notification-cover-editor {
  display: grid;
  gap: 10px;
}

.notification-cover-preview {
  display: grid;
  aspect-ratio: 5 / 2;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--wash) 56%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.notification-cover-preview.has-cover {
  border-style: solid;
  background: var(--paper);
}

.notification-cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notification-cover-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--card);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.notification-cover-upload:hover,
.notification-cover-upload:focus-within {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
}

.notification-cover-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.notification-cover-upload svg {
  width: 16px;
  height: 16px;
}

.newsletter-admin-panel {
  display: block;
}

.newsletter-admin-panel[hidden] {
  display: none;
}

.newsletter-workbench {
  display: block;
}

.newsletter-candidates-panel,
.newsletter-send-panel {
  min-width: 0;
}

.newsletter-send-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding-top: 4px;
  padding-bottom: 88px;
  background: transparent;
}

.newsletter-send-panel[hidden] {
  display: none;
}

.newsletter-preview-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding-top: 4px;
  padding-bottom: 88px;
}

.newsletter-preview-panel[hidden] {
  display: none;
}

.newsletter-preview-head {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.newsletter-preview-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.newsletter-preview-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-title);
  font-size: 20px;
  line-height: 1.24;
}

.newsletter-preview-head p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.newsletter-preview-styles {
  display: grid;
  gap: 12px;
}

.newsletter-preview-style {
  min-width: 0;
}

.newsletter-preview-style img {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--wash);
}

.newsletter-preview-style-copy {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.newsletter-preview-style-copy h4,
.newsletter-preview-style-copy p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newsletter-preview-style-copy h4 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.newsletter-preview-style-copy p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.newsletter-preview-style-copy a {
  justify-self: start;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.newsletter-preview-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  background: var(--wash);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

#newsletterIntroInput {
  min-height: 72px;
  max-height: 220px;
  overflow-y: hidden;
  resize: none;
}

.newsletter-admin-head {
  display: block;
  padding-bottom: 2px;
}

.newsletter-recipient-head button,
.newsletter-selection-dock button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  white-space: nowrap;
}

.newsletter-recipient-head button svg,
.newsletter-selection-dock button svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.newsletter-admin-head strong,
.newsletter-recipient-head span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.newsletter-admin-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.newsletter-candidate-list {
  columns: 280px;
  column-gap: 22px;
}

.newsletter-candidate-card {
  position: relative;
  display: inline-block;
  break-inside: avoid;
  width: 100%;
  margin: 0 0 20px;
  vertical-align: top;
}

.newsletter-candidate-card.is-selecting {
  cursor: pointer;
}

.newsletter-candidate-card.is-selected .style-card-open {
  border-color: var(--active-ink);
  box-shadow:
    inset 0 0 0 1px var(--active-ink),
    0 0 0 3px color-mix(in srgb, var(--active-ink) 12%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

.newsletter-candidate-check {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--ink) 72%, transparent);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
  backdrop-filter: blur(8px);
}

.newsletter-candidate-card:hover .newsletter-candidate-check,
.newsletter-candidate-card:focus-within .newsletter-candidate-check,
.newsletter-candidate-card.is-selected .newsletter-candidate-check {
  opacity: 1;
}

.newsletter-candidate-card.is-selected .newsletter-candidate-check {
  background: var(--black);
  border-color: var(--black);
  transform: scale(1.02);
}

.newsletter-candidate-card.is-selected .newsletter-candidate-check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 8px;
  height: 14px;
  border: solid var(--white);
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.newsletter-candidate-rating,
.newsletter-empty {
  color: var(--muted);
  font-size: 12px;
}

.newsletter-candidate-rating {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newsletter-recipient-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.newsletter-recipient-list {
  display: grid;
  gap: 0;
  max-height: min(46vh, 460px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.newsletter-recipient-row {
  position: relative;
  display: grid;
  grid-template-columns: 18px 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease;
}

.newsletter-recipient-row:last-child {
  border-bottom: 0;
}

.newsletter-recipient-row:hover,
.newsletter-recipient-row:focus-within {
  background: color-mix(in srgb, var(--panel) 97%, var(--ink) 3%);
}

.newsletter-recipient-row input {
  justify-self: center;
  align-self: center;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

.newsletter-recipient-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.newsletter-recipient-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.newsletter-recipient-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.newsletter-recipient-identity {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.newsletter-recipient-name,
.newsletter-recipient-email,
.newsletter-recipient-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newsletter-recipient-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.newsletter-recipient-email {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.newsletter-recipient-name {
  font-size: 13px;
  font-weight: 900;
}

.newsletter-selection-dock {
  position: fixed;
  z-index: 72;
  right: auto;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: calc(var(--rail-width) + ((100vw - var(--rail-width) - var(--detail-width)) / 2));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: min(760px, calc(100vw - var(--rail-width) - var(--detail-width) - 32px));
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  box-shadow: 0 18px 48px rgba(17, 17, 17, 0.18);
}

.newsletter-selection-dock[hidden] {
  display: none;
}

body:not(.is-right-panel-open) .newsletter-selection-dock {
  left: calc(var(--rail-width) + ((100vw - var(--rail-width)) / 2));
  max-width: min(760px, calc(100vw - var(--rail-width) - 32px));
}

.newsletter-selected-count {
  display: inline-grid;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
  font-family: var(--font-rounded);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.newsletter-selection-dock .ui-button-secondary {
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--paper);
  padding-inline: 11px;
  font-weight: 850;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.newsletter-selection-dock .ui-button-secondary:not(:disabled):hover,
.newsletter-selection-dock .ui-button-secondary:not(:disabled):focus-visible {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
  outline: none;
}

.newsletter-selection-dock #sendNewsletterButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.newsletter-selection-dock #sendNewsletterButton:not(:disabled):hover,
.newsletter-selection-dock #sendNewsletterButton:not(:disabled):focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
}

.newsletter-selection-dock #sendNewsletterButton:disabled,
.newsletter-selection-dock #testNewsletterButton:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
  cursor: not-allowed;
  opacity: 0.62;
}

.newsletter-issue-list {
  --article-cover-ratio: 5 / 3;
  --article-body-height: 172px;
  column-width: 360px;
  column-gap: 20px;
}

.newsletter-issue-card {
  --article-cover-ratio: 5 / 3;
  --article-body-height: 172px;
  margin-bottom: 20px;
}

.newsletter-issue-detail {
  display: grid;
  gap: 18px;
}

.newsletter-issue-detail-intro {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.newsletter-issue-style {
  display: grid;
  gap: 12px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
}

.newsletter-issue-style:first-of-type {
  border-top-color: var(--line-strong);
}

.newsletter-issue-style-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: start;
}

.newsletter-issue-style-meta {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newsletter-issue-style-head h3 {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-title);
  font-size: 18px;
  line-height: 1.28;
}

.newsletter-issue-style-head h3 a {
  color: inherit;
  text-decoration: none;
}

.newsletter-issue-style-head h3 a:hover,
.newsletter-issue-style-head h3 a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.newsletter-issue-style-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.newsletter-issue-style-link:hover,
.newsletter-issue-style-link:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
}

.newsletter-issue-style-images {
  display: grid;
  gap: 14px;
  overflow: visible;
  padding-bottom: 2px;
}

.newsletter-issue-style-image {
  display: block;
  margin: 0;
  overflow: hidden;
  background: var(--wash);
  transition: opacity 140ms ease, transform 140ms ease;
}

.newsletter-issue-style-image:hover,
.newsletter-issue-style-image:focus-visible {
  opacity: 0.9;
  outline: 2px solid var(--active-ink);
  outline-offset: -2px;
  transform: translateY(-1px);
}

.newsletter-issue-style-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.newsletter-issue-style-prompts {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-left: 2px solid var(--line-strong);
  background: color-mix(in srgb, var(--wash) 52%, transparent);
}

.newsletter-issue-style-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.newsletter-issue-style-prompts p {
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .newsletter-selection-dock {
    right: 16px;
    left: calc(var(--rail-width) + 16px);
  }
}

@media (max-width: 700px) {
  .notification-history-view.is-newsletter-view {
    width: 100%;
    padding: 14px 0 72px;
  }

  .newsletter-selection-dock {
    grid-template-columns: 1fr;
  }

  .newsletter-selection-dock {
    flex-wrap: wrap;
    right: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 14px;
    width: auto;
    max-width: none;
    transform: none;
  }

  .newsletter-selected-count,
  .newsletter-selection-dock #sendNewsletterButton {
    flex-basis: 100%;
  }

  .newsletter-issue-list,
  .newsletter-candidate-list {
    display: grid;
    grid-template-columns: 1fr;
    column-width: auto;
  }

  .newsletter-issue-style-head {
    grid-template-columns: 1fr;
  }

  .newsletter-issue-style-link {
    justify-self: start;
  }
}

.newsletter-subscription-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-top: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.newsletter-subscription-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--active-ink);
}

.hover-carousel-delay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin-top: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.hover-carousel-delay-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.hover-carousel-delay-control input {
  width: 58px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  text-align: center;
}

.hover-carousel-delay-control input:focus {
  border-color: var(--active-ink);
  outline: 2px solid color-mix(in srgb, var(--active-ink) 18%, transparent);
  outline-offset: -2px;
}

.detail-panel > .dialog-head h2 {
  overflow: hidden;
  margin-bottom: 0;
  font-family: var(--font-title);
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-center-panel:has(#newsletterSendPanel:not([hidden])) #notificationCenterTitle {
  font-size: 0;
  line-height: 0;
}

.notification-center-panel:has(#newsletterSendPanel:not([hidden])) #notificationCenterTitle::after {
  content: "邮件通知";
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.15;
}

.detail-panel.is-generated-detail > .dialog-head {
  align-items: flex-start;
}

.detail-panel.is-generated-detail > .dialog-head h2 {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.icon-button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--ui-radius-sm);
  font-size: 26px;
  line-height: 1;
}

.detail-body {
  --detail-content-width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 3vw, 26px);
  padding: var(--detail-panel-gutter);
}

.visual-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 0;
  background: transparent;
}

.featured-preview {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--paper);
}

.featured-preview img {
  width: 100%;
  height: auto;
  max-height: min(54vh, 560px);
  object-fit: contain;
  background: var(--wash);
}

.featured-preview figcaption {
  margin: 0;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  border-top: 1px solid var(--line);
}

/* Horizontal, clickable thumbnail strip */
.preview-rail {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 0;
  padding: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.preview-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--paper);
  scroll-snap-align: start;
  transition: border-color 140ms ease, transform 140ms ease;
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-thumb:hover {
  border-color: var(--muted);
}

.preview-thumb[aria-pressed="true"] {
  border-color: var(--black);
  box-shadow: inset 0 0 0 2px var(--black);
}

.preview-thumb:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 1px;
}

/* Full sample gallery (waterfall) below the prompt */
.detail-gallery {
  display: grid;
  gap: 12px;
  width: min(100%, 760px);
  max-width: 100%;
  margin-inline: auto;
  padding-top: clamp(20px, 2.4vw, 28px);
  border-top: 1px solid var(--line);
}

.style-rating {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: min(100%, 760px);
  max-width: 100%;
  min-height: 58px;
  margin-inline: auto;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 82%, var(--wash));
}

.style-rating[hidden] {
  display: none;
}

.style-rating-label,
.style-rating-status {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-rating-status {
  min-width: 38px;
  text-align: right;
}

.style-rating-stars {
  display: inline-grid;
  grid-template-columns: repeat(5, 42px);
  gap: 1px;
  align-items: center;
}

.style-rating-star {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
  background: transparent;
  cursor: pointer;
  transition: color 120ms ease, transform 120ms ease;
}

.style-rating-star svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.45;
  stroke-linejoin: miter;
  stroke-linecap: butt;
  stroke-miterlimit: 12;
  shape-rendering: geometricPrecision;
}

.style-rating-star:hover,
.style-rating-star:focus-visible {
  color: #d99a18;
  outline: none;
  transform: translateY(-1px);
}

.style-rating-star.is-on,
.style-rating-star.is-preview {
  color: #e3a11b;
}

.style-rating-star.is-on svg,
.style-rating-star.is-preview svg {
  fill: currentColor;
}

.detail-panel.is-short-gallery:not(.has-manual-sample-admin) #detailGallerySection {
  padding-bottom: max(clamp(220px, 42vh, 520px), env(safe-area-inset-bottom));
}

.detail-panel.is-short-gallery.has-manual-sample-admin #manualSampleSection {
  padding-bottom: max(clamp(220px, 42vh, 520px), env(safe-area-inset-bottom));
}

.manual-sample-admin {
  display: grid;
  gap: 10px;
  width: min(100%, 760px);
  max-width: 100%;
  margin-inline: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.manual-sample-admin[hidden] {
  display: none;
}

.manual-sample-editor {
  display: grid;
  gap: 10px;
}

#manualSamplePrompt {
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  line-height: 1.45;
}

#manualSamplePrompt:focus {
  outline: 2px solid var(--active-ink);
  outline-offset: -2px;
}

.manual-sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.manual-sample-upload,
.manual-sample-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--panel);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.manual-sample-save {
  color: var(--white);
  background: var(--ink);
  border-color: var(--ink);
}

.manual-sample-save:disabled {
  cursor: progress;
  opacity: 0.58;
}

.manual-sample-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.manual-sample-preview-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.manual-sample-preview {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  padding: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, var(--wash));
  scroll-snap-align: start;
}

.manual-sample-preview-open {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--wash);
  cursor: zoom-in;
}

.manual-sample-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--wash);
}

.manual-sample-preview-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  color: var(--white);
  background: rgba(0, 0, 0, 0.54);
  cursor: pointer;
}

.manual-sample-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manual-sample-status[data-tone="success"] {
  color: var(--notice-success-ink);
}

.manual-sample-status[data-tone="error"] {
  color: var(--notice-error-ink);
}

.detail-gallery-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.detail-gallery-head h3 {
  margin: 0;
  padding-top: 12px;
  font-size: 16px;
}

.detail-gallery-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-gallery-grid {
  columns: 180px 2;
  column-gap: 10px;
  padding-top: 4px;
}

/* Single-column vertical stack (逐行竖排) */
.detail-gallery-grid.is-rows {
  columns: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-gallery-grid.is-rows .gallery-tile {
  width: 100%;
  margin: 0;
}

.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid var(--line);
  background: var(--wash);
  break-inside: avoid;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.gallery-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 300ms ease;
}

.gallery-tile img.is-loaded {
  opacity: 1;
}

.gallery-tile:hover {
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.gallery-tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.gallery-preview-button {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gallery-preview-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

.gallery-prompt-tile {
  cursor: default;
  background:
    linear-gradient(135deg, transparent 0 86%, color-mix(in srgb, var(--ink) 10%, transparent) 86% 100%),
    color-mix(in srgb, var(--panel) 88%, var(--wash));
}

.gallery-prompt-tile:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.gallery-prompt-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 12px;
}

.gallery-prompt-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-prompt-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
}

.gallery-prompt-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.missing-sample-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  color: var(--white);
  background: var(--ink);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
}

.missing-sample-generate svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.missing-sample-generate:disabled {
  cursor: progress;
  opacity: 0.62;
}

.missing-sample-generate:focus-visible {
  outline: 2px solid var(--active-ink);
  outline-offset: 2px;
}

.gallery-copy-prompt,
.gallery-make-similar,
.gallery-copy-image {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  color: var(--white);
  background: rgba(5, 5, 5, 0.68);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.gallery-copy-image {
  left: 10px;
  top: 10px;
  width: 32px;
  min-height: 32px;
  padding: 0;
}

.gallery-copy-image svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.gallery-copy-prompt {
  right: 10px;
  top: 10px;
}

.gallery-make-similar {
  left: 10px;
  bottom: 10px;
  transform: translateY(4px);
}

.gallery-make-similar svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.gallery-copy-prompt:hover,
.gallery-copy-prompt:focus-visible,
.gallery-copy-image:hover,
.gallery-copy-image:focus-visible,
.gallery-make-similar:hover,
.gallery-make-similar:focus-visible {
  background: var(--black);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  outline: none;
}

.gallery-tile:hover .gallery-copy-prompt,
.gallery-tile:focus-within .gallery-copy-prompt,
.gallery-tile:hover .gallery-copy-image,
.gallery-tile:focus-within .gallery-copy-image,
.gallery-tile:hover .gallery-make-similar,
.gallery-tile:focus-within .gallery-make-similar {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  .prompt-code-action {
    opacity: 1;
    transform: none;
  }

  .gallery-copy-prompt,
  .gallery-make-similar,
  .gallery-copy-image,
  .image-action-bar,
  .thumb-copy-image,
  .thumb-make-similar {
    opacity: 1;
    transform: none;
  }
}

/* Fullscreen image viewer */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
}

body.is-lightbox-open {
  overflow: hidden;
}

.lightbox-stage {
  position: absolute;
  inset: 0 0 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}

.lightbox-stage img {
  max-width: 94vw;
  max-height: calc(94vh - 96px);
  object-fit: contain;
  will-change: transform;
  transition: transform 60ms linear;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 140ms ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.26);
}

.lightbox-close {
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  font-size: 30px;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 72px;
  font-size: 38px;
  line-height: 1;
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }

.lightbox-hint {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: var(--ui-radius-sm);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.lightbox-thumbs {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: min(760px, calc(100vw - 32px));
  padding: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: rgba(8, 8, 8, 0.42);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  transform: translateX(-50%);
  scrollbar-width: none;
}

.lightbox-thumbs:empty {
  display: none;
}

.lightbox-thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0.68;
  cursor: pointer;
  transition: border-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.lightbox-thumb:hover,
.lightbox-thumb:focus-visible,
.lightbox-thumb[aria-pressed="true"] {
  border-color: #fff;
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 700px) {
  .lightbox-nav { width: 40px; height: 56px; font-size: 30px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-stage { bottom: 86px; }
  .lightbox-stage img { max-height: calc(94vh - 86px); }
  .lightbox-hint { bottom: 66px; }
  .lightbox-thumbs {
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
  .lightbox-thumb {
    width: 44px;
    height: 44px;
  }
}

.prompt-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
}

.copy-panel,
.scene-panel,
.prompt-item,
.empty-note {
  margin: 0;
  padding: 18px;
  background: var(--paper);
}

.prompt-panel .copy-panel {
  position: relative;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 0;
  background: transparent;
}

.empty-note {
  color: var(--muted);
}

.prompt-head h4 {
  margin-bottom: 12px;
}

.prompt-head button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
}

.prompt-head button:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
  background: var(--wash);
}

.copy-head {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 2;
}

.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.prompt-code-action {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--black) 10%, transparent);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, border-color 140ms ease;
  backdrop-filter: blur(10px);
}

.prompt-code-action svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.prompt-code-action [data-copy-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.copy-panel:hover .prompt-code-action,
.copy-panel:focus-within .prompt-code-action {
  opacity: 1;
  transform: translateY(0);
}

.prompt-code-action:hover,
.prompt-code-action:focus-visible {
  border-color: var(--black);
  color: var(--white);
  background: var(--black);
  outline: none;
}

.prompt-code-action:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
  background: var(--wash);
  box-shadow: none;
}

.text-link-button {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
}

.text-link-button:hover,
.text-link-button:focus-visible {
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.72;
  outline: none;
}

#basePrompt {
  box-sizing: border-box;
  display: block;
  width: 100%;
  inline-size: 100%;
  max-width: none;
  min-width: 0;
  height: 150px;
  min-height: 150px;
  max-height: 150px;
  overflow: hidden;
  resize: none;
  padding: 14px;
  background: color-mix(in srgb, var(--paper) 82%, var(--wash));
  font-family: var(--font-rounded);
  transition:
    height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms ease,
    background 180ms ease,
    box-shadow 220ms ease;
  will-change: height;
}

#basePrompt.is-expanded {
  max-height: none;
  min-height: 320px;
  overflow: auto;
  resize: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--white) 28%, transparent);
}

textarea:focus {
  border-color: var(--black);
}

.prompt-list {
  display: grid;
  gap: 12px;
}

.prompt-item {
  border: 1px solid var(--line);
}

.prompt-item textarea {
  min-height: 180px;
}

.error-state {
  display: grid;
  min-height: 100vh;
  place-content: center;
  text-align: center;
}

@media (max-width: 1040px) {
  .site-header,
  .content-grid,
  .detail-body {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    grid-template-columns: 1fr;
  }

  .featured-preview {
    min-height: 0;
  }

  .login-gate {
    align-content: center;
  }

  .login-logo {
    margin-bottom: 48px;
  }

  .topic-panel {
    position: static;
  }

  .member-badge {
    justify-self: start;
  }
}

@media (max-width: 700px) {
  body {
    --rail-width: 0px;
    --page-inline-gutter: 12px;
    padding-left: 0;
    /* Clear the fixed bottom tab bar AND the home-indicator safe area below it,
       so the last row of content is never hidden behind the bar / indicator. */
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  body.is-auth-gate {
    padding-bottom: 0;
  }

  .app-rail {
    inset: auto 0 0 0;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 64px;
    width: auto;
    /* Grow the bar by the home-indicator inset and pad it down, so the tab
       icons sit above the indicator instead of being clipped by it. */
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    overflow: visible;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .rail-head {
    display: contents;
    min-width: 0;
    padding: 0;
  }

  .rail-toggle {
    display: none;
  }

  .rail-edge-toggle {
    display: none;
  }

  .rail-logo,
  .rail-nav a,
  .rail-account {
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    width: auto;
    min-width: 0;
    min-height: 64px;
    margin: 0;
    padding: 0;
  }

  /* The logo is not a navigation destination — dropping it from the bottom tab
     bar leaves exactly 6 items (5 nav + account) for the 6 columns, so the tabs
     stop overflowing onto a clipped second row. */
  .rail-logo {
    display: none;
  }

  .rail-logo span {
    width: var(--rail-mark-size);
    height: var(--rail-mark-size);
  }

  .rail-logo strong,
  .rail-account em {
    display: none;
  }

  .rail-nav {
    display: contents;
  }

  .rail-nav a::before {
    left: 50%;
    top: 0;
    bottom: auto;
    width: 22px;
    height: 2px;
    transform: translateX(-50%);
  }

  .rail-nav em {
    display: block;
    overflow: visible;
    font-size: 10px;
    opacity: 1;
    transform: none;
  }

  .rail-nav a > span,
  .rail-account > span,
  .rail-symbol,
  .account-avatar {
    width: 24px;
    height: 24px;
  }

  .account-menu {
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
  }

  main {
    width: 100%;
  }

  .articles-list {
    display: grid;
    grid-template-columns: 1fr;
    column-width: auto;
    max-width: none;
  }

  .login-gate {
    min-height: 100dvh;
    padding: 28px 0 40px;
  }

  .login-logo {
    margin-bottom: 40px;
  }

  .login-copy h1 {
    max-width: 7em;
    font-size: clamp(42px, 15vw, 68px);
  }

  .topic-nav {
    width: 100%;
  }

  .topic-nav button,
  .sort-segment-button,
  .header-icon-button,
  .ghost-button,
  .content-favorite-button,
  .article-back,
  .article-delete-detail,
  .content-favorite-detail,
  .icon-button,
  .view-toggle-btn,
  .image-api-trigger,
  .image-api-add-button,
  .image-api-inline-test,
  .image-api-card-action,
  .topic-nav-drag-handle,
  .topic-nav-order-actions .icon-button {
    min-width: 44px;
    min-height: 44px;
  }

  .image-size-field select,
  .image-quality-field select,
  .image-count-field select,
  .image-api-mode-field select,
  .image-api-form select {
    min-height: 44px;
  }

  .article-card > .content-favorite-card,
  .image-api-card-actions {
    opacity: 1;
    transform: none;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .color-filter {
    justify-self: start;
  }

  .color-filter-panel {
    left: 0;
    right: auto;
    width: min(calc(100vw - 32px), 204px);
  }

  .toolbar button {
    border-width: 1px 0 0;
  }

  .toolbar .color-filter-panel button {
    border-width: 1px;
  }

  .toolbar .sort-segment-button {
    border-width: 0;
    border-right: 1px solid var(--line);
  }

  .toolbar .sort-segment-button:last-child {
    border-right: 0;
  }

  .style-grid {
    grid-template-columns: 1fr;
  }

  .dialog-head,
  .copy-head,
  .prompt-head {
    align-items: start;
  }

  .copy-head,
  .prompt-head {
    display: grid;
  }

  .preview-rail {
    grid-auto-columns: minmax(160px, 78vw);
  }
}

/* ---------- Member center ---------- */
.member-center {
  width: 100%;
  padding: 16px 0 90px;
  max-width: none;
}

.member-center-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.ghost-button:hover {
  color: var(--white);
  border-color: var(--black);
  background: var(--black);
}

.member-grid {
  column-width: 330px;
  column-gap: clamp(18px, 3vw, 28px);
}

.member-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: clamp(16px, 2.4vw, 22px);
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
}

.member-card h3 {
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Member center read-only display */
.profile-display {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.profile-display-text {
  min-width: 0;
}

.profile-name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
}

/* Login methods (account linking) */
.login-methods-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.login-method:last-child {
  border-bottom: 1px solid var(--line);
}

.login-method-name {
  font-weight: 700;
}

.login-method-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-method-status.is-on {
  color: var(--notice-success-ink);
}

.login-method .ghost-button {
  min-height: 36px;
  padding: 0 16px;
}

.settings-more-actions {
  display: grid;
  gap: 8px;
}

.settings-more-button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.settings-more-button:hover,
.settings-more-button:focus-visible {
  border-color: color-mix(in srgb, var(--ink) 18%, var(--line));
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
  outline: none;
}

.settings-more-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line));
  background: color-mix(in srgb, var(--ink) 5%, var(--paper));
  box-shadow: inset 3px 0 0 var(--ink);
}

.settings-more-button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.settings-more-button[aria-pressed="true"] svg:last-of-type {
  color: var(--ink);
}

.settings-more-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-nav-settings-panel-body {
  display: grid;
  gap: 12px;
  padding: clamp(14px, 2.8vw, 24px) clamp(16px, 3vw, 26px) clamp(18px, 3vw, 28px);
}

.topic-interest-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--paper) 76%, var(--wash));
}

.topic-interest-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.topic-interest-head .eyebrow,
.topic-interest-head h3 {
  margin: 0;
}

.topic-interest-head h3 {
  font-size: 15px;
  line-height: 1.25;
}

.topic-interest-reset-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.topic-interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 172px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.topic-interest-chip {
  display: inline-grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  max-width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.topic-interest-chip:hover,
.topic-interest-chip:focus-within {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 16%, var(--line));
  background: color-mix(in srgb, var(--active-wash) 44%, var(--paper));
}

.topic-interest-chip:has(input:checked) {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
  background: color-mix(in srgb, var(--ink) 5%, var(--paper));
}

.topic-interest-chip input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--black);
}

.topic-interest-chip input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--active-ink) 45%, transparent);
  outline-offset: 2px;
}

.topic-interest-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-interest-chip-count {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}

.topic-nav-settings-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding-bottom: 2px;
}

.topic-nav-settings-panel-body .topic-nav-settings-head {
  margin-bottom: 0;
}

.topic-nav-settings-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.topic-nav-settings-copy .login-methods-hint {
  margin: 0;
  line-height: 1.45;
}

.topic-nav-settings-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.topic-nav-visible-only-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.topic-nav-visible-only-toggle.is-active {
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line));
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

.topic-nav-reset-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.topic-nav-admin-default-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 0;
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}

.topic-nav-admin-default-tools[hidden] {
  display: none;
}

.topic-nav-admin-default-tools > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.topic-nav-admin-default-tools strong {
  font-size: 13px;
  line-height: 1.2;
}

.topic-nav-admin-default-tools span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.topic-nav-admin-default-tools button {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.topic-nav-admin-default-tools button i {
  width: 14px;
  height: 14px;
}

.topic-nav-defaults-status {
  margin: -4px 0 0;
}

.topic-nav-search {
  position: relative;
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topic-nav-search > i,
.topic-nav-search > svg {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
  transform: translateY(-50%);
}

.topic-nav-search input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 86%, var(--wash));
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.topic-nav-search input:focus {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 12%, transparent);
}

.topic-nav-settings-list-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 78px minmax(104px, 124px) 68px;
  gap: 10px;
  padding: 0 8px 0 4px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.topic-nav-settings-list-head span:first-child {
  grid-column: 2;
}

.topic-nav-settings-list-head span:nth-child(2),
.topic-nav-settings-list-head span:nth-child(3),
.topic-nav-settings-list-head span:nth-child(4) {
  justify-self: center;
}

.topic-nav-settings-list {
  position: relative;
  display: grid;
  gap: 0;
  max-height: min(520px, calc(100dvh - 230px));
  padding: 4px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  background: color-mix(in srgb, var(--wash) 62%, var(--paper));
  scrollbar-gutter: stable;
}

.topic-nav-settings-list.is-sorting {
  cursor: grabbing;
  user-select: none;
}

.topic-nav-drag-status {
  position: sticky;
  top: 4px;
  z-index: 1001;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, var(--line));
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.topic-nav-drag-status[hidden] {
  display: none;
}

.topic-nav-settings-row {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 78px minmax(104px, 124px) 68px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 6px 8px 6px 4px;
  border: 1px solid transparent;
  border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent);
  background: transparent;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    background 160ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.topic-nav-settings-row:last-child {
  border-bottom-color: transparent;
}

.topic-nav-settings-row:hover,
.topic-nav-settings-row:focus-within {
  border-color: color-mix(in srgb, var(--ink) 10%, var(--line));
  background: color-mix(in srgb, var(--paper) 76%, var(--active-wash));
}

.topic-nav-settings-row.is-hidden {
  background: color-mix(in srgb, var(--paper) 46%, transparent);
}

.topic-nav-settings-row.is-hidden .topic-nav-settings-title strong {
  color: var(--muted);
}

.topic-nav-settings-row.is-hidden .topic-nav-settings-title span {
  color: var(--muted-2);
}

.topic-nav-settings-row.is-nested .topic-nav-settings-title span::after {
  content: " · 子栏目";
}

.topic-nav-settings-row.is-dragging {
  opacity: 0.42;
  transform: scale(0.992);
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}

.topic-nav-settings-row.is-just-moved {
  animation: topic-nav-row-settle 560ms cubic-bezier(0.22, 1, 0.36, 1);
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line));
  background: var(--paper);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 9%, transparent);
}

.topic-nav-settings-row.is-drop-before::before,
.topic-nav-settings-row.is-drop-after::after {
  position: absolute;
  right: 10px;
  left: 10px;
  z-index: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent);
  content: "";
}

.topic-nav-settings-row.is-drop-before::before {
  top: -6px;
}

.topic-nav-settings-row.is-drop-after::after {
  bottom: -6px;
}

.topic-nav-settings-row.is-drop-before,
.topic-nav-settings-row.is-drop-after {
  border-color: color-mix(in srgb, var(--ink) 18%, var(--line));
  background: color-mix(in srgb, var(--ink) 3%, var(--paper));
}

.topic-nav-drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  opacity: 0.94;
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line));
  background: var(--paper);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--ink) 18%, transparent);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.topic-nav-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: grab;
  outline: none;
  touch-action: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.topic-nav-drag-handle:hover,
.topic-nav-drag-handle:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.topic-nav-drag-handle:active {
  cursor: grabbing;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.topic-nav-drag-handle svg {
  width: 15px;
  height: 15px;
}

.topic-nav-toggle {
  display: inline-flex;
  justify-self: start;
  gap: 7px;
  align-items: center;
  min-width: 68px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 6px;
  color: var(--muted);
  background: color-mix(in srgb, var(--paper) 76%, transparent);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.topic-nav-toggle:hover,
.topic-nav-toggle:focus-within {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 14%, var(--line));
  background: var(--paper);
}

.topic-nav-settings-row.is-hidden .topic-nav-toggle {
  color: var(--muted-2);
  background: transparent;
}

.topic-nav-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--black);
}

.topic-nav-toggle input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--active-ink) 45%, transparent);
  outline-offset: 2px;
}

.topic-nav-parent-field {
  display: grid;
  gap: 4px;
  justify-self: stretch;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.topic-nav-parent-field span {
  display: none;
}

.topic-nav-parent-field select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 24px 0 9px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

.topic-nav-parent-field select:focus {
  border-color: color-mix(in srgb, var(--ink) 20%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 10%, transparent);
}

.topic-nav-settings-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.topic-nav-settings-title strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-nav-settings-title span,
.topic-nav-settings-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.topic-nav-order-actions {
  display: inline-flex;
  justify-self: end;
  gap: 4px;
  min-width: 64px;
}

.topic-nav-order-actions .icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0;
  line-height: 1;
}

.topic-nav-order-actions .icon-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.topic-nav-order-actions .icon-button:hover,
.topic-nav-order-actions .icon-button:focus-visible {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 16%, var(--line));
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.topic-nav-order-actions .icon-button:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
  border-color: color-mix(in srgb, var(--line) 64%, transparent);
  background: transparent;
  opacity: 0.48;
}

@keyframes topic-nav-row-settle {
  0% {
    transform: translateY(-4px);
  }
  52% {
    transform: translateY(1px);
  }
  100% {
    transform: translateY(0);
  }
}

.topic-nav-settings-empty {
  margin: 0;
  padding: 16px;
  border: 0;
  background: transparent;
}

@media (max-width: 700px) {
  .member-grid {
    column-width: auto;
    column-count: 1;
  }

  .member-center {
    padding-top: 12px;
  }

  .topic-nav-settings-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topic-nav-settings-head {
    display: grid;
  }

  .topic-nav-settings-actions {
    justify-self: start;
    flex-wrap: wrap;
  }

  .topic-interest-head {
    align-items: flex-start;
  }

  .topic-interest-list {
    max-height: 154px;
  }

  .topic-nav-reset-button {
    justify-self: start;
  }

  .topic-nav-settings-list-head {
    display: none;
  }

  .topic-nav-settings-list {
    max-height: min(520px, calc(100dvh - 202px));
    padding: 3px;
  }

  .topic-nav-settings-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
      "drag title actions"
      "drag toggle actions"
      "drag parent actions";
    gap: 4px 10px;
    min-height: 124px;
    padding: 10px;
  }

  .topic-nav-drag-handle {
    grid-area: drag;
    align-self: center;
  }

  .topic-nav-toggle {
    grid-area: toggle;
    align-self: start;
    min-width: 72px;
  }

  .topic-nav-parent-field {
    grid-area: parent;
    align-self: start;
    max-width: 190px;
  }

  .topic-nav-parent-field span {
    display: block;
  }

  .topic-nav-settings-title {
    grid-area: title;
  }

  .topic-nav-order-actions {
    grid-area: actions;
    align-self: center;
    justify-content: flex-end;
  }

  .topic-nav-drag-status {
    margin-right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-nav-settings-row,
  .topic-nav-drag-ghost,
  .topic-nav-drag-handle {
    transition: none;
  }

  .topic-nav-settings-row.is-just-moved {
    animation: none;
  }
}

/* Toast */
.app-toast {
  position: fixed;
  top: var(--notice-toast-top);
  right: var(--notice-toast-end);
  left: var(--notice-toast-start);
  transform: translate3d(0, -6px, 0);
  z-index: 90;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  max-width: none;
  min-height: 40px;
  max-height: min(144px, calc(100dvh - var(--notice-toast-top) - 12px));
  padding: 7px 8px 7px 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-top: 0;
  border-radius: 0 0 var(--ui-radius-sm) var(--ui-radius-sm);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--black) 10%, transparent);
  backdrop-filter: blur(18px);
  font-size: 13px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, right 220ms ease, left 220ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.app-toast[data-tone="info"],
.login-status[data-tone="info"],
.form-status[data-tone="info"],
.member-status-line[data-tone="info"] {
  --notice-tone-ink: var(--notice-info-ink);
  --notice-tone-bg: var(--notice-info-bg);
  --notice-tone-border: var(--notice-info-border);
}

.app-toast[data-tone="pending"],
.login-status[data-tone="pending"],
.form-status[data-tone="pending"],
.member-status-line[data-tone="pending"] {
  --notice-tone-ink: var(--notice-pending-ink);
  --notice-tone-bg: var(--notice-pending-bg);
  --notice-tone-border: var(--notice-pending-border);
}

.app-toast[data-tone="success"] {
  --notice-tone-ink: var(--notice-success-ink);
  --notice-tone-bg: var(--notice-success-bg);
  --notice-tone-border: var(--notice-success-border);
}

.login-status[data-tone="success"],
.form-status[data-tone="success"],
.member-status-line[data-tone="success"] {
  --notice-tone-ink: var(--notice-success-ink);
}

.app-toast[data-tone="warning"],
.login-status[data-tone="warning"],
.form-status[data-tone="warning"],
.member-status-line[data-tone="warning"] {
  --notice-tone-ink: var(--notice-warning-ink);
  --notice-tone-bg: var(--notice-warning-bg);
  --notice-tone-border: var(--notice-warning-border);
}

.app-toast[data-tone="error"] {
  --notice-tone-ink: var(--notice-error-ink);
  --notice-tone-bg: var(--notice-error-bg);
  --notice-tone-border: var(--notice-error-border);
}

.login-status[data-tone="error"],
.form-status[data-tone="error"],
.member-status-line[data-tone="error"] {
  --notice-tone-ink: var(--notice-error-ink);
}

.app-toast-icon {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--notice-tone-ink, var(--notice-info-ink));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--notice-tone-ink, var(--notice-info-ink)) 12%, transparent);
}

.app-toast-icon svg {
  display: none;
}

.app-toast-body {
  display: grid;
  align-content: center;
  gap: 1px;
  min-width: 0;
  max-height: 104px;
  overflow: auto;
  overscroll-behavior: contain;
}

.app-toast-title {
  color: var(--notice-tone-ink, var(--ink));
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.app-toast-message {
  color: color-mix(in srgb, var(--ink) 74%, var(--notice-tone-ink, var(--muted)));
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.app-toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  outline: none;
}

.app-toast-close svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 700px) {
  body {
    --notice-toast-top: var(--topbar-height);
    --notice-toast-start: max(12px, env(safe-area-inset-left));
    --notice-toast-end: max(12px, env(safe-area-inset-right));
  }

  body.is-right-panel-open {
    --notice-toast-end: max(12px, env(safe-area-inset-right));
  }

  .app-toast {
    grid-template-columns: 8px minmax(0, 1fr) 28px;
    min-height: 40px;
    max-height: min(132px, calc(100dvh - var(--notice-toast-top) - 72px - env(safe-area-inset-bottom)));
    padding: 7px 8px 7px 12px;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--black) 10%, transparent);
  }
}

[data-theme="dark"] .login-method-status.is-on { color: var(--notice-success-ink); }

/* Edit / redeem dialogs */
.member-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
}

.member-dialog::backdrop {
  background: var(--ui-backdrop);
  backdrop-filter: blur(5px);
}

.member-dialog-card {
}

.password-reset-dialog-card {
  gap: 14px;
}

.member-dialog-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.member-dialog-head h3 {
  margin: 0;
  font-size: 18px;
}

.password-reset-intro,
.password-reset-token-note {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  background: color-mix(in srgb, var(--wash) 72%, var(--paper));
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
}

.password-reset-token-note {
  border-color: var(--notice-info-border);
  background: var(--notice-info-bg);
  color: var(--notice-info-ink);
}

.delete-confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  border-radius: 0;
}

.delete-confirm-dialog .member-dialog-card,
.delete-confirm-dialog .icon-button,
.delete-confirm-dialog button {
  border-radius: 0;
}

.delete-confirm-body {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.delete-confirm-actions {
  justify-content: flex-end;
}

.delete-confirm-danger {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #9c2323;
  color: #fff;
  font-weight: 900;
}

.delete-confirm-danger:hover,
.delete-confirm-danger:focus-visible {
  background: #6f1616;
  outline: none;
}

.delete-confirm-danger svg {
  width: 16px;
  height: 16px;
}

.member-field textarea {
  width: 100%;
  min-height: 170px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  outline: none;
  font-size: 14px;
  line-height: 1.6;
}

.member-field textarea:focus {
  border-color: var(--ink);
}

/* Articles board */
.articles-view {
  padding: 18px 0 90px;
  overflow-anchor: none;
}

.articles-view.is-layout-settling {
  overflow: hidden;
}

.articles-list {
  --article-cover-ratio: 5 / 2;
  --article-body-height: 190px;
  column-width: 440px;
  column-gap: 22px;
}

.articles-list.is-loading {
  column-width: auto;
  column-count: auto;
}

.articles-view.is-layout-settling .articles-list {
  width: var(--article-list-freeze-width);
  max-width: none;
}

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms ease, border-color 180ms ease;
  break-inside: avoid;
}

.admin-delete-article {
  top: 10px;
  right: 10px;
  bottom: auto;
  z-index: 3;
}

.article-card:hover,
.article-card:focus-visible {
  transform: translateY(-2px);
  border-color: transparent;
  outline: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.article-card.is-article-selected,
.article-card.is-article-selected:hover,
.article-card.is-article-selected:focus-visible {
  border-color: var(--active-ink);
  box-shadow:
    inset 0 0 0 1px var(--active-ink),
    0 0 0 3px color-mix(in srgb, var(--active-ink) 12%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

body.is-article-detail-open .article-card:not(.is-article-selected) {
  opacity: 0.68;
}

.article-card:hover .admin-delete-article,
.article-card:focus-within .admin-delete-article,
.admin-delete-article:focus-visible {
  opacity: 1;
}

.content-favorite-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 140ms ease;
}

.content-favorite-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
}

.content-favorite-button.is-on {
  border-color: color-mix(in srgb, #ff5278 36%, var(--line));
  color: #df3264;
  background: color-mix(in srgb, #ff5278 9%, var(--panel));
}

.content-favorite-button.is-on svg {
  fill: currentColor;
}

.content-favorite-button:hover,
.content-favorite-button:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.content-favorite-button:active {
  transform: translateY(1px);
}

.favorite-content-card {
  margin-bottom: 0;
}

.favorite-content-card .article-body {
  height: auto;
}

.favorite-content-card .article-excerpt {
  -webkit-line-clamp: 4;
}

.article-card > .content-favorite-card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-height: 32px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(8px);
  opacity: 0;
}

.article-card:hover > .content-favorite-card,
.article-card:focus-within > .content-favorite-card,
.article-card > .content-favorite-card.is-on,
.article-card > .content-favorite-card:focus-visible {
  opacity: 1;
}

.article-cover {
  aspect-ratio: var(--article-cover-ratio);
  overflow: hidden;
  background: var(--wash);
}

.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-body {
  min-height: var(--article-body-height);
  display: flex;
  flex-direction: column;
  height: var(--article-body-height);
  padding: 16px 18px;
  overflow: hidden;
}

.article-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
  min-height: calc(17px * 1.35 * 2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-meta {
  min-height: 15px;
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-excerpt {
  flex: 0 0 auto;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.notification-history-card {
  display: grid;
  grid-template-columns: minmax(260px, 38.5%) minmax(0, 1fr);
  align-items: stretch;
  min-height: 172px;
  margin-bottom: 0;
}

.notification-history-card .article-cover {
  background: var(--wash);
}

.notification-history-content {
  position: relative;
}

.notification-default-cover {
  display: grid;
  gap: 8px;
  place-items: center;
  align-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.notification-default-cover strong {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.notification-default-cover time {
  color: color-mix(in srgb, var(--muted) 78%, var(--ink));
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.notification-history-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  margin-top: 0;
}

@media (max-width: 700px) {
  .notification-history-list {
    display: grid;
    gap: 14px;
  }

  .notification-history-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .notification-history-cover {
    height: auto;
    aspect-ratio: 5 / 2;
  }

  .notification-history-content {
    min-height: 154px;
    padding: 16px 18px;
  }
}

@media (max-width: 700px) {
  .articles-list {
    display: grid;
    grid-template-columns: 1fr;
    column-width: auto;
    max-width: none;
  }
}

.articles-empty {
  padding: 56px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.article-detail {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 25;
  width: var(--detail-width);
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 0 56px;
  border-left: 1px solid var(--edge-divider-line);
  background: var(--bg);
  box-shadow: none;
  color: var(--ink);
  opacity: 0;
  transform: translateX(100%);
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
  will-change: transform, opacity;
}

.article-detail.has-admin-dock {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.article-detail[hidden] {
  display: none;
}

.article-detail-actions {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  margin: 0;
  padding: 10px clamp(16px, 2.4vw, 26px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
}

.article-detail-actions-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.content-favorite-detail {
  min-height: 36px;
  padding-inline: 12px;
}

.article-back,
.article-delete-detail {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.article-delete-detail {
  border: 0;
  color: #fff;
  background: rgba(132, 24, 24, 0.82);
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}

.article-delete-detail svg {
  width: 16px;
  height: 16px;
}

.article-back:hover,
.article-back:focus-visible {
  border-color: var(--text);
  outline: none;
}

.article-detail:hover .article-delete-detail,
.article-detail:focus-within .article-delete-detail,
.article-delete-detail:focus-visible {
  opacity: 1;
}

.article-delete-detail:hover {
  background: rgba(172, 34, 34, 0.94);
}

.article-delete-detail:disabled {
  cursor: wait;
  opacity: 1;
}

.article-detail-head {
  margin-bottom: 24px;
  padding: clamp(18px, 3.2vw, 34px) clamp(16px, 2.8vw, 34px) 0;
}

.article-detail-head h1 {
  margin: 0;
  max-width: 100%;
  font-family: var(--font-title);
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.12;
}

.article-detail-excerpt {
  max-width: 100%;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.article-detail-cover {
  aspect-ratio: 5 / 2;
  margin: 0 clamp(16px, 2.8vw, 34px) 24px;
  overflow: hidden;
  background: var(--wash);
}

.article-detail-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-content {
  padding: 0 clamp(16px, 2.8vw, 34px);
  color: var(--text);
  font-size: 16px;
  line-height: 1.82;
}

.article-content a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-content a:hover,
.article-content a:focus-visible {
  color: var(--active-ink);
}

.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5 {
  margin: 2em 0 0.7em;
  line-height: 1.25;
}

.article-content h2 {
  font-size: 24px;
}

.article-content h3,
.article-content h4,
.article-content h5 {
  font-size: 20px;
}

.article-content p,
.article-content ul,
.article-content blockquote,
.article-content pre {
  margin: 0 0 1.1em;
}

.article-content ul {
  padding-left: 1.3em;
}

.article-content blockquote {
  border-left: 3px solid var(--line);
  color: var(--muted);
  padding-left: 14px;
}

.article-content code {
  background: var(--wash);
  padding: 2px 5px;
}

.code-block {
  position: relative;
  margin: 0 0 1.1em;
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font-size: 12px;
  font-weight: 900;
}

.code-copy:hover,
.code-copy:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.article-content pre {
  overflow: auto;
  margin: 0;
  background: var(--wash);
  padding: 42px 14px 14px;
}

.article-content pre code {
  background: transparent;
  padding: 0;
}

/* Image generation API manager */
.image-generator-view {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px 0 90px;
}

.image-generator-board {
  display: grid;
  justify-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
}

.image-api-manager {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px);
}

.image-api-form {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 0;
}

.image-api-editor-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  display: grid;
  align-content: start;
  width: var(--detail-width);
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.image-api-editor-dialog[hidden] {
  display: none !important;
}

.image-api-editor-dialog .image-api-form {
  animation: image-api-editor-enter 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes image-api-editor-enter {
  from {
    opacity: 0;
    transform: translateX(12px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.image-api-editor-card {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--paper);
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--active-ink) 82%, transparent);
}

.image-api-library {
  display: grid;
  gap: 12px;
}

.image-api-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.image-api-section-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.image-api-section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.image-api-editor-head {
  padding-top: 0;
  border-top: 0;
}

.image-api-fields {
  display: grid;
  gap: 12px;
}

.image-api-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
}

.image-api-add-button svg {
  width: 16px;
  height: 16px;
}

.image-api-grid {
  display: grid;
  gap: 8px;
}

.image-api-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 94px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: default;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.image-api-card:hover,
.image-api-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.image-api-card[aria-pressed="true"] {
  border-color: var(--active-ink);
  background: var(--active-wash);
  box-shadow: inset 2px 0 0 var(--active-ink);
}

.image-api-card[data-active="true"]::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--active-ink);
}

.image-api-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.image-api-card-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.image-api-card-radio input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--active-ink);
}

.image-api-card-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.image-api-card:hover .image-api-card-actions,
.image-api-card:focus-within .image-api-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.image-api-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-xs);
  color: var(--muted);
  background: transparent;
}

.image-api-card-action:hover,
.image-api-card-action:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  outline: none;
}

.image-api-card-action.is-danger:hover,
.image-api-card-action.is-danger:focus-visible {
  color: #9c2323;
  background: color-mix(in srgb, #9c2323 9%, transparent);
}

.image-api-card-action:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.image-api-card-action svg {
  width: 15px;
  height: 15px;
}

.image-api-card-kicker {
  width: fit-content;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.image-api-card strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-api-card span,
.image-api-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-api-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.image-api-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.image-api-form input:focus {
  border-color: var(--active-ink);
}

.image-api-secret-input {
  -webkit-text-security: disc;
  text-security: disc;
  letter-spacing: 0.04em;
}

.image-api-secret-input::placeholder {
  -webkit-text-security: none;
  text-security: none;
  letter-spacing: 0;
}

.image-api-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.image-api-inline-test {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.image-api-inline-test svg {
  width: 15px;
  height: 15px;
}

.image-api-inline-test:not(:disabled):hover,
.image-api-inline-test:not(:disabled):focus-visible {
  border-color: var(--notice-info-border);
  background: var(--notice-info-bg);
  color: var(--notice-info-ink);
  outline: none;
}

.image-api-inline-test:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 82%, var(--wash));
  color: var(--muted);
}

.image-api-actions {
  display: grid;
  gap: 10px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.image-api-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--white);
  font-weight: 900;
}

.image-api-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-api-primary-actions {
  gap: 10px;
}

.image-api-primary-actions button {
  min-height: 42px;
}

.image-api-actions button svg {
  width: 16px;
  height: 16px;
}

.image-api-actions .ghost-button {
  background: var(--panel);
  color: var(--ink);
}

.image-create-panel {
  container-type: inline-size;
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 24;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 0;
  width: var(--detail-width);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-left: 1px solid var(--edge-divider-line);
  background: var(--bg);
  box-shadow: none;
  padding: 0;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.image-create-panel[hidden] {
  display: none;
}

.image-create-panel > .dialog-head {
  --detail-panel-gutter: clamp(16px, 3vw, 26px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding-inline: var(--detail-panel-gutter);
  padding-block: 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.image-create-head > div:first-child {
  min-width: 0;
}

.image-create-head .eyebrow {
  overflow: hidden;
  margin: 0 0 1px;
  font-size: 11px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-create-head h2 {
  overflow: hidden;
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-create-panel-body {
  container-type: inline-size;
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: clamp(14px, 2.4vw, 24px);
}

.image-create-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.image-api-setup-notice {
  --notice-tone-ink: var(--notice-warning-ink);
  --notice-tone-bg: var(--notice-warning-bg);
  --notice-tone-border: var(--notice-warning-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--notice-tone-border);
  border-left: 2px solid var(--notice-tone-ink);
  background: color-mix(in srgb, var(--notice-tone-bg) 82%, var(--panel));
  color: var(--notice-tone-ink);
}

.image-api-setup-notice[hidden] {
  display: none;
}

.image-api-setup-notice strong {
  display: block;
  color: var(--notice-tone-ink);
  font-size: 14px;
}

.image-api-setup-notice p {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--ink) 74%, var(--notice-tone-ink));
  font-size: 13px;
  line-height: 1.55;
}

.image-api-setup-notice button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--notice-tone-ink);
  background: var(--notice-tone-ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 900;
}

.image-api-setup-notice button:hover,
.image-api-setup-notice button:focus-visible {
  filter: brightness(0.96);
}

.image-api-setup-notice button svg {
  width: 16px;
  height: 16px;
}

.image-prompt-field {
  display: block;
}

.image-prompt-field textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: clamp(132px, 18vh, 178px);
  min-height: clamp(132px, 18vh, 178px);
  max-height: clamp(132px, 18vh, 178px);
  overflow: hidden;
  resize: none;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  outline: none;
  transition:
    height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms ease,
    background 180ms ease,
    box-shadow 220ms ease;
  will-change: height;
}

.image-prompt-field textarea.is-expanded {
  max-height: none;
  min-height: 320px;
  overflow: auto;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--white) 24%, transparent);
}

.image-api-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.image-api-trigger:hover,
.image-api-trigger:focus-visible {
  border-color: var(--active-ink);
}

.image-api-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.image-api-quick-test {
  min-width: 112px;
  background: var(--panel);
}

.image-prompt-field textarea:focus,
.image-size-field select:focus,
.image-quality-field select:focus,
.image-count-field select:focus,
.image-api-mode-field select:focus,
.image-api-form select:focus {
  border-color: var(--active-ink);
}

.image-size-field select,
.image-quality-field select,
.image-count-field select,
.image-api-mode-field select,
.image-api-form select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background-color: var(--panel);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6b63' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  font-weight: 900;
  line-height: 1.2;
  outline: none;
}

.image-size-field select::-ms-expand,
.image-quality-field select::-ms-expand,
.image-count-field select::-ms-expand,
.image-api-mode-field select::-ms-expand,
.image-api-form select::-ms-expand {
  display: none;
}

[data-theme="dark"] .image-size-field select,
[data-theme="dark"] .image-quality-field select,
[data-theme="dark"] .image-count-field select,
[data-theme="dark"] .image-api-mode-field select,
[data-theme="dark"] .image-api-form select {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e7e0d3' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.image-create-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "primary output";
  align-items: end;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.generated-image-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.image-create-primary-actions {
  grid-area: primary;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.image-output-controls {
  grid-area: output;
  display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(110px, auto);
  justify-self: end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.image-size-field,
.image-quality-field,
.image-count-field,
.image-api-mode-field {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.image-size-field select {
  min-width: 132px;
  width: 100%;
}

.image-quality-field select {
  min-width: 110px;
  width: 100%;
}

.image-count-field select {
  min-width: 86px;
}

.image-api-mode-field select {
  min-width: min(260px, calc(100vw - 52px));
  max-width: 100%;
  width: 100%;
}

@media (max-width: 720px) {
  .image-create-toolbar {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "count settings"
      "mode mode";
  }

  .image-count-field {
    grid-area: count;
  }

  .image-api-mode-field {
    grid-area: mode;
  }

  .image-api-trigger {
    grid-area: settings;
    justify-self: end;
  }

  .image-api-picker-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-api-quick-test {
    width: 100%;
  }

  .image-create-actions {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "primary"
      "output";
  }

  .image-output-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 128px);
    justify-self: stretch;
  }

  .image-create-primary-actions {
    justify-content: space-between;
  }

  .image-create-primary-actions button {
    flex: 0 0 auto;
  }
}

@container (max-width: 420px) {
  .image-create-panel-body {
    gap: 10px;
    padding: 12px;
  }

  .image-create-toolbar {
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr) auto;
    grid-template-areas:
      "count mode settings"
      "test test test";
    align-items: stretch;
    gap: 8px;
  }

  .image-count-field {
    grid-area: count;
  }

  .image-api-mode-field {
    grid-area: mode;
    min-width: 0;
  }

  .image-api-picker-row {
    display: contents;
  }

  .image-api-mode-field select {
    min-width: 0;
  }

  .image-create-toolbar > .image-api-trigger {
    grid-area: settings;
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
  }

  .image-create-toolbar > .image-api-trigger span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .image-api-quick-test {
    grid-area: test;
    width: 100%;
    min-width: 0;
  }

  .image-prompt-field textarea {
    height: min(34dvh, 136px);
    min-height: 108px;
    max-height: 136px;
    padding: 12px;
    line-height: 1.58;
  }

  .image-prompt-field textarea.is-expanded {
    min-height: 168px;
  }

  .image-create-actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "primary"
      "output";
    gap: 8px;
  }

  .image-create-primary-actions,
  .image-create-primary-actions button,
  .image-output-controls {
    width: 100%;
  }

  .image-output-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    justify-self: stretch;
  }

  .image-size-field select,
  .image-quality-field select,
  .image-count-field select {
    min-width: 0;
    width: 100%;
  }
}

.image-create-primary-actions button,
.generated-image-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--white);
  font-weight: 900;
  text-decoration: none;
}

.image-create-primary-actions svg,
.image-api-trigger svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.image-create-primary-actions .ghost-button {
  background: var(--panel);
  color: var(--ink);
}

.generated-images-panel {
  container-type: inline-size;
  display: grid;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  gap: 18px;
  margin-top: 0;
}

.generated-image-result.generated-image-grid {
  display: block;
  column-count: 4;
  column-gap: 14px;
  width: 100%;
}

.generated-image-card {
  display: grid;
  break-inside: avoid;
  min-width: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.generated-image-card.is-detail-selected {
  border-color: var(--active-ink);
  box-shadow:
    inset 0 0 0 1px var(--active-ink),
    0 0 0 3px color-mix(in srgb, var(--active-ink) 12%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.14);
}

.generated-image-preview {
  position: relative;
  display: block;
  width: 100%;
  min-height: 160px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: var(--wash);
}

.generated-image-preview img {
  display: block;
  width: 100%;
  min-height: 160px;
  aspect-ratio: var(--generated-image-ratio, auto);
  object-fit: contain;
}

.generated-image-preview.has-generated-carousel img,
.generated-image-carousel-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 220ms ease;
}

.generated-image-preview.has-generated-carousel img.is-active,
.generated-image-carousel-image.is-active {
  opacity: 1;
}

.generated-image-add-card {
  min-height: 220px;
  border-style: dashed;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--active-wash) 60%, transparent), transparent 62%),
    var(--paper);
}

.generated-image-add-button {
  display: grid;
  min-height: 220px;
  place-items: center;
  gap: 10px;
  padding: 24px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.generated-image-add-button svg {
  width: 24px;
  height: 24px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-sizing: content-box;
}

.generated-image-add-card:hover,
.generated-image-add-card:focus-within {
  border-color: var(--ink);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--active-wash) 86%, transparent), transparent 62%),
    var(--paper);
}

.generated-image-add-card.is-panel-open {
  border-color: color-mix(in srgb, var(--active-ink) 56%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--active-wash) 92%, transparent), transparent 62%),
    var(--paper);
}

.generated-image-add-card.is-panel-open .generated-image-add-button svg {
  color: var(--paper);
  border-color: var(--ink);
  background: var(--ink);
}

.generated-image-placeholder-card {
  min-height: 0;
  aspect-ratio: var(--placeholder-ratio, 1 / 1);
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
  background:
    linear-gradient(110deg, transparent 0 28%, color-mix(in srgb, var(--ink) 7%, transparent) 38%, transparent 48%),
    color-mix(in srgb, var(--wash) 78%, transparent);
  background-size: 220% 100%;
  animation: generated-placeholder-sheen 1.8s ease-in-out infinite;
}

@keyframes generated-placeholder-sheen {
  0% { background-position: 130% 0; }
  100% { background-position: -90% 0; }
}

.generated-image-task-card {
  --notice-tone-ink: var(--notice-pending-ink);
  --notice-tone-bg: var(--notice-pending-bg);
  --notice-tone-border: var(--notice-pending-border);
  border-color: var(--notice-tone-border);
  background:
    linear-gradient(180deg, var(--notice-tone-bg), transparent 46%),
    var(--paper);
}

.generated-image-task-card[data-tone="success"] {
  --notice-tone-ink: var(--notice-success-ink);
  --notice-tone-bg: var(--notice-success-bg);
  --notice-tone-border: var(--notice-success-border);
}

.generated-image-task-card[data-tone="warning"] {
  --notice-tone-ink: var(--notice-warning-ink);
  --notice-tone-bg: var(--notice-warning-bg);
  --notice-tone-border: var(--notice-warning-border);
}

.generated-image-task-card[data-tone="error"] {
  --notice-tone-ink: var(--notice-error-ink);
  --notice-tone-bg: var(--notice-error-bg);
  --notice-tone-border: var(--notice-error-border);
}

.generated-image-task-preview {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  min-height: 180px;
  padding: 1px;
  color: var(--notice-tone-ink);
  background:
    linear-gradient(110deg, transparent 0 28%, color-mix(in srgb, var(--notice-tone-ink) 12%, transparent) 38%, transparent 48%),
    var(--wash);
  background-size: 220% 100%;
  animation: generated-placeholder-sheen 1.8s ease-in-out infinite;
}

.generated-image-task-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 88px;
  object-fit: contain;
  background: var(--paper);
}

.generated-image-task-preview svg {
  place-self: center;
  width: 28px;
  height: 28px;
  stroke-width: 2.2;
}

.generated-image-task-card[data-task-status="error"] .generated-image-task-preview,
.generated-image-task-card[data-task-status="warning"] .generated-image-task-preview,
.generated-image-task-card[data-task-status="success"] .generated-image-task-preview {
  animation: none;
}

.generated-image-task-card[data-task-status="queued"] .generated-image-task-preview svg,
.generated-image-task-card[data-task-status="running"] .generated-image-task-preview svg {
  animation: generated-task-spin 1.1s linear infinite;
}

@keyframes generated-task-spin {
  to { transform: rotate(360deg); }
}

.generated-image-meta {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.generated-image-meta strong {
  color: var(--ink);
  font-size: 14px;
}

.generated-image-name-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  line-height: 28px;
  outline: none;
}

.generated-image-name-input:hover,
.generated-image-name-input:focus {
  border-bottom-color: var(--ink);
}

.generated-image-name-input:disabled {
  cursor: progress;
  color: var(--muted);
}

.generated-image-meta span {
  color: var(--muted);
  font-size: 12px;
}

.generated-image-task-meta .generated-image-name-input,
.generated-image-task-progress {
  color: var(--notice-tone-ink);
}

.generated-image-task-progress {
  font-size: 12px;
  font-weight: 850;
}

.generated-image-task-prompt {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

@media (max-width: 1100px) {
  .generated-image-result.generated-image-grid {
    column-count: 3;
  }
}

@media (max-width: 760px) {
  .generated-image-result.generated-image-grid {
    column-count: 2;
  }
}

@media (max-width: 520px) {
  .generated-image-result.generated-image-grid {
    column-count: 1;
  }
}

.image-api-form select {
  width: 100%;
  min-height: 44px;
}

.avatar-block {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.avatar-frame {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--wash);
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  font-family: var(--font-title);
  font-size: 38px;
  font-weight: 900;
  color: var(--muted);
}

.avatar-actions {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.avatar-presets {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.avatar-presets-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.avatar-preset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}

.avatar-preset-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.avatar-preset-button:hover,
.avatar-preset-button:focus-visible {
  border-color: var(--ink);
  outline: none;
  transform: translateY(-1px);
}

.avatar-preset-button[aria-pressed="true"] {
  border-color: var(--active-ink);
  box-shadow: inset 0 0 0 2px var(--active-ink);
}

.avatar-preset-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--white);
  background: var(--black);
}

.upload-button:hover {
  opacity: 0.88;
}

.avatar-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.member-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.member-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  outline: none;
  font-size: 14px;
}

.member-field input:focus {
  border-color: var(--ink);
}

.member-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.member-actions button,
.redeem-block button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 0;
  cursor: pointer;
  color: var(--white);
  background: var(--black);
  line-height: 1;
  vertical-align: middle;
}

.member-actions button svg,
.redeem-block button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.member-actions button:hover,
.redeem-block button:hover {
  opacity: 0.88;
}

.member-actions button:disabled,
.redeem-block button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.member-status-line {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
}

.member-status-line[data-tone="muted"] { color: var(--muted); }

.member-expiry-line {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.redeem-block {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.member-account-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 16px;
}

.member-email-line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Dark mode ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141310;
  --paper: #1c1b17;
  --panel: #1c1b17;
  --ink: #f3f0ea;
  --muted: #a7a194;
  --muted-2: #837d72;
  --line: #34322b;
  --line-strong: #4c483f;
  --edge-divider-shadow: 2px 0 14px rgba(0, 0, 0, 0.18);
  --wash: #26241f;
  --active-wash: rgba(255, 255, 255, 0.08);
  --active-wash-strong: rgba(255, 255, 255, 0.12);
  --active-line: rgba(255, 255, 255, 0.18);
  --active-line-strong: rgba(255, 255, 255, 0.26);
  --active-shadow: inset 0 0 0 1px var(--active-line);
  --button-dark-bg: rgba(255, 255, 255, 0.085);
  --button-dark-bg-strong: rgba(255, 255, 255, 0.14);
  --button-dark-bg-soft: rgba(255, 255, 255, 0.045);
  --button-dark-border: rgba(255, 255, 255, 0.2);
  --button-dark-border-strong: rgba(255, 255, 255, 0.32);
  --black: #050505;
  --white: #f3f0ea;
  --brand-mark-dark-ink: var(--ink);
  --brand-mark-dark-bg: color-mix(in srgb, var(--paper) 76%, var(--black));
  --brand-mark-dark-border: color-mix(in srgb, var(--ink) 16%, transparent);
  --notice-info-ink: #8bd3ff;
  --notice-info-bg: rgba(56, 139, 253, 0.13);
  --notice-info-border: rgba(139, 211, 255, 0.34);
  --notice-pending-ink: #f6c765;
  --notice-pending-bg: rgba(245, 158, 11, 0.13);
  --notice-pending-border: rgba(246, 199, 101, 0.34);
  --notice-success-ink: #63d98b;
  --notice-success-bg: rgba(34, 197, 94, 0.13);
  --notice-success-border: rgba(99, 217, 139, 0.34);
  --notice-warning-ink: #f2b84b;
  --notice-warning-bg: rgba(245, 158, 11, 0.15);
  --notice-warning-border: rgba(242, 184, 75, 0.36);
  --notice-error-ink: #ff8a80;
  --notice-error-bg: rgba(239, 68, 68, 0.15);
  --notice-error-border: rgba(255, 138, 128, 0.38);
  --color-filter-swatch-core: #171613;
  --color-filter-swatch-core-glint: rgba(255, 255, 255, 0.34);
  --color-filter-swatch-core-glow: rgba(255, 255, 255, 0.12);
  --color-filter-swatch-core-border: rgba(255, 255, 255, 0.18);
  --color-filter-swatch-core-shadow: rgba(0, 0, 0, 0.42);
  --color-filter-trigger-bg: transparent;
  --color-filter-trigger-hover-bg: color-mix(in srgb, var(--ink) 9%, var(--paper));
  --color-filter-trigger-open-bg: color-mix(in srgb, var(--ink) 14%, var(--paper));
  --color-filter-trigger-active-bg: color-mix(in srgb, var(--color-filter-active-color, var(--ink)) 18%, var(--paper));
}

[data-theme="dark"] .app-rail {
  background: rgba(28, 27, 23, 0.94);
}

[data-theme="dark"] .rail-logo span,
[data-theme="dark"] .login-logo span {
  color: var(--brand-mark-dark-ink);
  background: var(--brand-mark-dark-bg);
  box-shadow: inset 0 0 0 1px var(--brand-mark-dark-border);
}

[data-theme="dark"] .site-header {
  background: rgba(20, 19, 16, 0.92);
}

[data-theme="dark"] .dialog-head {
  background: rgba(28, 27, 23, 0.94);
}

[data-theme="dark"] .style-card:hover .style-card-open,
[data-theme="dark"] .style-card:focus-within .style-card-open,
[data-theme="dark"] .gallery-tile:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .style-card.is-detail-selected .style-card-open,
[data-theme="dark"] .style-card.is-detail-selected:hover .style-card-open,
[data-theme="dark"] .style-card.is-detail-selected:focus-within .style-card-open {
  border-color: var(--active-line-strong);
  box-shadow:
    inset 0 0 0 1px var(--active-line-strong),
    0 0 0 3px var(--active-wash-strong),
    0 14px 34px rgba(0, 0, 0, 0.62);
}

[data-theme="dark"] .article-card.is-article-selected,
[data-theme="dark"] .article-card.is-article-selected:hover,
[data-theme="dark"] .article-card.is-article-selected:focus-visible {
  border-color: var(--active-line-strong);
  box-shadow:
    inset 0 0 0 1px var(--active-line-strong),
    0 0 0 3px var(--active-wash-strong),
    0 14px 34px rgba(0, 0, 0, 0.62);
}

[data-theme="dark"] .fav-button-card {
  color: var(--ink);
  background: rgba(20, 20, 20, 0.7);
}

[data-theme="dark"] .style-rating {
  border-color: var(--active-line);
  background: var(--button-dark-bg-soft);
}

[data-theme="dark"] .style-rating-star {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

[data-theme="dark"] .style-rating-star:hover,
[data-theme="dark"] .style-rating-star:focus-visible,
[data-theme="dark"] .style-rating-star.is-on,
[data-theme="dark"] .style-rating-star.is-preview {
  color: #f2b84b;
}

[data-theme="dark"] .visual-panel {
  background: var(--wash);
}

[data-theme="dark"] .rail-nav a:hover,
[data-theme="dark"] .rail-nav a:focus-visible,
[data-theme="dark"] .rail-account:hover,
[data-theme="dark"] .rail-account:focus-visible,
[data-theme="dark"] .header-icon-button:hover,
[data-theme="dark"] .header-icon-button:focus-visible,
[data-theme="dark"] .sort-segment-button:hover,
[data-theme="dark"] .sort-segment-button:focus-visible,
[data-theme="dark"] .toolbar .sort-segment-button:hover,
[data-theme="dark"] .toolbar .sort-segment-button:focus-visible,
[data-theme="dark"] .topic-nav button:hover,
[data-theme="dark"] .topic-list button:hover,
[data-theme="dark"] .view-toggle-btn:hover {
  color: var(--ink);
  background: var(--active-wash);
}

[data-theme="dark"] .sort-segment-button[aria-pressed="true"],
[data-theme="dark"] .sort-segment-button[aria-pressed="true"]:hover,
[data-theme="dark"] .sort-segment-button[aria-pressed="true"]:focus-visible {
  color: var(--ink);
  background: var(--active-wash-strong);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .toolbar .sort-segment-button[aria-pressed="true"],
[data-theme="dark"] .toolbar .sort-segment-button[aria-pressed="true"]:hover,
[data-theme="dark"] .toolbar .sort-segment-button[aria-pressed="true"]:focus-visible {
  color: var(--ink);
  background: var(--active-wash-strong);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .topic-nav button[aria-current="page"],
[data-theme="dark"] .topic-list button[aria-current="page"],
[data-theme="dark"] .view-toggle-btn[aria-pressed="true"] {
  color: var(--ink);
  background: var(--active-wash-strong);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .topic-nav button[aria-current="page"]::after,
[data-theme="dark"] .topic-list button[aria-current="page"]::after {
  display: none;
}

[data-theme="dark"] .rail-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--active-wash);
}

[data-theme="dark"] .rail-nav a[aria-current="page"]::before {
  display: none;
}

[data-theme="dark"] .rail-nav a[aria-current="page"] .rail-symbol {
  color: var(--ink);
  background: var(--active-wash-strong);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .header-icon-button[aria-pressed="true"],
[data-theme="dark"] .preview-thumb[aria-pressed="true"],
[data-theme="dark"] .lightbox-thumb[aria-pressed="true"] {
  border-color: var(--active-line-strong);
  box-shadow: inset 0 0 0 1px var(--active-line);
}

[data-theme="dark"] .lightbox-thumb:hover,
[data-theme="dark"] .lightbox-thumb:focus-visible {
  border-color: var(--active-line-strong);
}

[data-theme="dark"] .image-api-editor-card {
  box-shadow: inset 2px 0 0 var(--active-line);
}

[data-theme="dark"] .image-api-card[aria-pressed="true"] {
  border-color: var(--active-line);
  background: var(--active-wash);
  box-shadow: inset 2px 0 0 var(--active-line-strong);
}

[data-theme="dark"] .image-api-card[data-active="true"]::after {
  border-color: var(--active-line);
  color: var(--ink);
  background: var(--active-wash-strong);
}

[data-theme="dark"] .ui-button,
[data-theme="dark"] .open-auth-button:not(.open-auth-button-secondary),
[data-theme="dark"] .login-row button:first-child,
[data-theme="dark"] .admin-backfill-all,
[data-theme="dark"] .image-api-add-button,
[data-theme="dark"] .image-api-actions button:not(.ghost-button),
[data-theme="dark"] .image-create-primary-actions button:not(.ghost-button),
[data-theme="dark"] .generated-image-actions a,
[data-theme="dark"] .member-actions button:not(.ghost-button),
[data-theme="dark"] .redeem-block button,
[data-theme="dark"] .upload-button,
[data-theme="dark"] .manual-sample-save,
[data-theme="dark"] .dock-button {
  border-color: var(--button-dark-border);
  color: var(--ink);
  background: var(--button-dark-bg);
  box-shadow: none;
}

[data-theme="dark"] .ghost-button,
[data-theme="dark"] .open-auth-button-secondary,
[data-theme="dark"] .account-menu button,
[data-theme="dark"] .header-icon-button:not([aria-pressed="true"]),
[data-theme="dark"] .image-api-trigger,
[data-theme="dark"] .image-api-actions .ghost-button,
[data-theme="dark"] .image-create-primary-actions .ghost-button,
[data-theme="dark"] .prompt-code-action,
[data-theme="dark"] .dock-icon-button,
[data-theme="dark"] .manual-sample-upload {
  border-color: var(--active-line);
  color: var(--ink);
  background: var(--button-dark-bg-soft);
}

[data-theme="dark"] .dock-download-menu {
  border-color: var(--active-line);
  background: var(--button-dark-bg-soft);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .dock-download-menu button {
  color: var(--ink);
}

[data-theme="dark"] .rail-edge-toggle {
  border-color: var(--edge-divider-line);
  color: var(--muted);
  background: var(--edge-divider-surface);
}

[data-theme="dark"] .ui-button:hover,
[data-theme="dark"] .ui-button:focus-visible,
[data-theme="dark"] .open-auth-button:hover,
[data-theme="dark"] .open-auth-button:focus-visible,
[data-theme="dark"] .login-actions button:hover,
[data-theme="dark"] .login-actions button:focus-visible,
[data-theme="dark"] .admin-backfill-all:hover,
[data-theme="dark"] .admin-backfill-all:focus-visible,
[data-theme="dark"] .account-menu button:hover,
[data-theme="dark"] .account-menu button:focus-visible,
[data-theme="dark"] .rail-edge-toggle:hover,
[data-theme="dark"] .rail-edge-toggle:focus-visible,
[data-theme="dark"] .image-api-add-button:hover,
[data-theme="dark"] .image-api-add-button:focus-visible,
[data-theme="dark"] .image-api-trigger:hover,
[data-theme="dark"] .image-api-trigger:focus-visible,
[data-theme="dark"] .image-api-actions button:hover,
[data-theme="dark"] .image-api-actions button:focus-visible,
[data-theme="dark"] .image-create-primary-actions button:hover,
[data-theme="dark"] .image-create-primary-actions button:focus-visible,
[data-theme="dark"] .generated-image-actions a:hover,
[data-theme="dark"] .generated-image-actions a:focus-visible,
[data-theme="dark"] .member-actions button:hover,
[data-theme="dark"] .member-actions button:focus-visible,
[data-theme="dark"] .redeem-block button:hover,
[data-theme="dark"] .redeem-block button:focus-visible,
[data-theme="dark"] .upload-button:hover,
[data-theme="dark"] .upload-button:focus-visible,
[data-theme="dark"] .manual-sample-save:hover,
[data-theme="dark"] .manual-sample-save:focus-visible,
[data-theme="dark"] .manual-sample-upload:hover,
[data-theme="dark"] .manual-sample-upload:focus-within,
[data-theme="dark"] .dock-button:hover,
[data-theme="dark"] .dock-button:focus-visible,
[data-theme="dark"] .dock-icon-button:hover,
[data-theme="dark"] .dock-icon-button:focus-visible,
[data-theme="dark"] .prompt-code-action:hover,
[data-theme="dark"] .prompt-code-action:focus-visible {
  border-color: var(--button-dark-border-strong);
  color: var(--ink);
  background: var(--button-dark-bg-strong);
  box-shadow: var(--active-shadow);
  outline: none;
}

[data-theme="dark"] .delete-confirm-danger {
  border: 0;
  color: #fff;
  background: color-mix(in srgb, #9c2323 88%, var(--bg));
  box-shadow: none;
}

[data-theme="dark"] .delete-confirm-danger:hover,
[data-theme="dark"] .delete-confirm-danger:focus-visible {
  background: color-mix(in srgb, #6f1616 90%, var(--bg));
  box-shadow: none;
}

[data-theme="dark"] .image-api-panel .image-api-add-button,
[data-theme="dark"] .image-api-panel #saveImageApiButton {
  border-color: rgba(255, 255, 255, 0.36);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

[data-theme="dark"] .image-api-panel .image-api-add-button:hover,
[data-theme="dark"] .image-api-panel .image-api-add-button:focus-visible,
[data-theme="dark"] .image-api-panel #saveImageApiButton:hover,
[data-theme="dark"] .image-api-panel #saveImageApiButton:focus-visible {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: var(--active-shadow);
}

[data-theme="dark"] .notification-current {
  border-bottom-color: var(--line);
}

[data-theme="dark"] .notification-markdown code {
  border-color: var(--active-line);
  background: var(--button-dark-bg-soft);
}

[data-theme="dark"] .image-api-setup-notice {
  --notice-tone-ink: var(--notice-warning-ink);
  --notice-tone-bg: var(--notice-warning-bg);
  --notice-tone-border: var(--notice-warning-border);
  border-color: var(--notice-tone-border);
  border-left-color: var(--notice-tone-ink);
  background: color-mix(in srgb, var(--notice-tone-bg) 76%, var(--panel));
  color: var(--notice-tone-ink);
}

[data-theme="dark"] .image-api-setup-notice p {
  color: color-mix(in srgb, var(--ink) 72%, var(--notice-tone-ink));
}

[data-theme="dark"] .image-api-setup-notice button {
  border-color: var(--notice-tone-ink);
  color: var(--bg);
  background: var(--notice-tone-ink);
}

[data-theme="dark"] .image-api-setup-notice button:hover,
[data-theme="dark"] .image-api-setup-notice button:focus-visible {
  border-color: color-mix(in srgb, var(--notice-tone-ink) 78%, var(--ink));
  background: color-mix(in srgb, var(--notice-tone-ink) 78%, var(--ink));
  filter: none;
  outline: none;
}

[data-theme="dark"] button:disabled,
[data-theme="dark"] button[aria-disabled="true"],
[data-theme="dark"] .ui-button:disabled,
[data-theme="dark"] .manual-sample-save:disabled,
[data-theme="dark"] .ghost-button:disabled {
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
  opacity: 0.58;
}

[data-theme="dark"] button:disabled:hover,
[data-theme="dark"] button[aria-disabled="true"]:hover,
[data-theme="dark"] .ui-button:disabled:hover,
[data-theme="dark"] .ghost-button:disabled:hover {
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
}

[data-theme="dark"] .image-api-panel .image-api-actions button:disabled,
[data-theme="dark"] .image-api-panel .image-api-actions button:disabled:hover,
[data-theme="dark"] .image-api-panel .image-api-actions button:disabled:focus-visible {
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
  opacity: 0.58;
}

@media (max-width: 700px) {
  .rail-logo,
  .rail-nav a,
  .rail-account {
    justify-self: stretch;
    width: 100%;
    min-width: 44px;
  }

  .ghost-button,
  .login-method .ghost-button,
  .content-favorite-button,
  .article-card > .content-favorite-card,
  .image-api-trigger,
  .image-api-setup-notice button {
    min-height: 44px;
  }

  .fav-button-card,
  .image-action-button,
  .admin-delete-card,
  .admin-hide-card,
  .admin-restore-card,
  .admin-delete-article {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .fav-button-card svg,
  .image-action-button svg,
  .admin-delete-card svg,
  .admin-hide-card svg,
  .admin-restore-card svg,
  .admin-delete-article svg {
    width: 18px;
    height: 18px;
  }

  .image-action-bar {
    gap: 8px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .admin-card-actions {
    right: 10px;
    bottom: 10px;
    opacity: 1;
  }

  .admin-delete-card,
  .admin-delete-article {
    right: 10px;
    bottom: 10px;
    opacity: 1;
  }

  .article-card > .content-favorite-card {
    opacity: 1;
  }
}

/* ---------- Monochrome mode ---------- */
:root[data-mono="on"] main,
:root[data-mono="on"] dialog {
  filter: grayscale(1);
}
