@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0c0b09;
  --bg-elevated: #14130f;
  --bg-card: #17160f;
  --paper: #f4efe6;
  --ink: #1c1916;
  --border: rgba(243, 236, 220, 0.1);
  --text: #f4efe6;
  --text-muted: #b7b1a4;
  --accent: #e0b85c;
  --accent-dim: rgba(224, 184, 92, 0.16);
  --accent-glow: rgba(224, 184, 92, 0.28);
  --danger: #e28b7c;
  --ok: #b7c7a4;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "Noto Serif SC", serif;
  --sans: Outfit, "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --paper-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --radius: 18px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  --header: 4.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text);
  background:
    radial-gradient(1100px 640px at 70% -12%, rgba(224, 184, 92, 0.09), transparent 58%),
    var(--bg);
  line-height: 1.5;
}

::selection {
  background: rgba(224, 184, 92, 0.35);
  color: inherit;
}

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

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

.app-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header);
  padding: 0.85rem 2rem;
  background: rgba(12, 11, 9, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text);
}

.app-logo__mark {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.2rem;
  background: var(--accent);
  color: #231c0c;
}

.app-logo__text {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}

.app-nav__link {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

.app-nav__link:hover {
  color: var(--text);
}

.app-nav__link.is-active {
  color: var(--text);
  background: rgba(244, 239, 230, 0.06);
}

.app-nav__link--cta {
  margin-left: 0.35rem;
  color: #231c0c;
  background: var(--accent);
  font-weight: 500;
}

.app-nav__link--cta:hover {
  color: #231c0c;
  background: #ebc56e;
}

.app-header__meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.88rem;
}

.app-user {
  color: var(--text-muted);
  text-decoration: none;
}

.app-user:hover,
.app-user.is-active {
  color: var(--text);
}

.app-logout-form {
  margin: 0;
}

.app-logout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.app-logout:hover {
  color: var(--accent);
}

.app-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.25rem 2rem 5rem;
}

.app-main--editor {
  max-width: 1440px;
  padding-top: 1.25rem;
}

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.75rem;
}

.page-hero--compact {
  margin-bottom: 2rem;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-kicker::after {
  content: "";
  width: 2.4rem;
  height: 1px;
  background: var(--accent);
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5.15rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.page-sub {
  margin: 1rem 0 0;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), background 0.25s, color 0.25s, border-color 0.25s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.btn--primary {
  background: var(--accent);
  color: #231c0c;
}

.btn--primary:hover {
  background: #ebc56e;
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(226, 139, 124, 0.45);
}

.btn--danger:hover {
  background: rgba(226, 139, 124, 0.12);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: rgba(244, 239, 230, 0.28);
  background: rgba(244, 239, 230, 0.04);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span,
.field__label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field__label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.field__label em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.field__label em.is-warn {
  color: var(--accent);
}

.field__label em.is-limit {
  color: var(--danger);
}

.field input,
.field textarea,
.search input,
.tool-size select {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
.search input:focus,
.tool-size select:focus {
  outline: none;
  border-color: rgba(224, 184, 92, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field--compact {
  margin-bottom: 0.85rem;
}

.field-hint,
.editor-copy-note {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search {
  flex: 1;
  max-width: 28rem;
}

.library-count {
  margin: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.article-grid,
.template-grid {
  display: grid;
  gap: 1.25rem;
}

.article-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.5rem;
}

.template-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card,
.template-card,
.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), border-color 0.45s;
}

.article-card:hover,
.article-card:focus-within {
  border-color: rgba(224, 184, 92, 0.32);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .article-card:hover { transform: translateY(-4px); }
}

.article-card__link:focus-visible {
  outline-offset: -3px;
  border-radius: inherit;
}

.article-card__link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.article-card__band {
  position: relative;
  flex: none;
  aspect-ratio: 2.35 / 1;
  background:
    linear-gradient(160deg, rgba(224, 184, 92, 0.16), transparent 55%),
    #221f18;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.article-card__band img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.article-card__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.article-card__placeholder > span {
  color: var(--accent);
  font: italic 2.6rem/1 var(--serif);
  letter-spacing: -0.06em;
}

.article-card__eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.article-card__index {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
}

.article-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.2rem 1.25rem 1.1rem;
}

.article-card__status,
.sheet__top span:last-child {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status--draft {
  background: rgba(244, 239, 230, 0.06);
  color: var(--text-muted);
}

.status--published {
  background: var(--accent-dim);
  color: var(--accent);
}

.article-card__title,
.template-card__name,
.account-card__title,
.editor-dialog h2 {
  font-weight: 400;
}

.article-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-height: 2.9em;
  margin: 0.85rem 0 0.55rem;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.article-card__summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  margin: 0 0 1.2rem;
  min-height: 3.2em;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.article-card__summary.is-muted,
.article-card__meta,
.template-card__desc,
.account-mail {
  color: var(--text-muted);
}

.article-card__meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3.5rem;
  margin: auto 0 0;
  padding: 0.85rem 3.5rem 0 0;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.article-card__delete {
  position: absolute;
  bottom: 0.95rem;
  right: 0.85rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.article-card__delete:hover,
.article-card__delete:focus-visible {
  background: rgba(226, 139, 124, 0.2);
  color: var(--danger);
}

.article-card--new {
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 250px;
  padding: 1.3rem;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(180deg, rgba(244, 239, 230, 0.03), transparent 40%),
    var(--bg-card);
  border-style: dashed;
}

.article-card__plus {
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: auto;
  position: relative;
}

.article-card__plus::before,
.article-card__plus::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--accent);
}

.article-card__plus::before {
  width: 1.3rem;
  height: 1px;
  transform: translate(-50%, -50%);
}

.article-card__plus::after {
  width: 1px;
  height: 1.3rem;
  transform: translate(-50%, -50%);
}

.article-card__new-title {
  font-family: var(--serif);
  font-size: 1.8rem;
}

.article-card__new-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 660px) {
  .article-card--new {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.2rem 1rem;
    min-height: 0;
    padding: 1.15rem 1.25rem;
  }

  .article-card__plus {
    grid-row: 1 / 3;
    margin: 0;
  }

  .article-card__new-title { font-size: 1.35rem; }
  .article-card__new-text { grid-column: 2; font-size: 0.8rem; }
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: -0.75rem 0 1.5rem;
}

.filter-pill,
.template-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.filter-pill:hover,
.template-chip:hover,
.filter-pill.is-active,
.template-chip.is-active {
  color: var(--text);
  border-color: rgba(224, 184, 92, 0.45);
}

.filter-pill.is-active,
.template-chip.is-active {
  background: var(--accent-dim);
  color: var(--accent);
}

.template-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), border-color 0.45s;
}

.template-card:hover {
  transform: translateY(-6px);
  border-color: rgba(224, 184, 92, 0.28);
}

.template-card__preview {
  position: relative;
  height: 250px;
  overflow: hidden;
  background: var(--paper);
}

.template-card__preview iframe {
  position: absolute;
  left: 50%;
  top: 0;
  width: 390px;
  height: 760px;
  border: 0;
  background: #fff;
  pointer-events: none;
  transform: translateX(-50%) scale(0.64);
  transform-origin: top center;
  transition: transform 0.6s var(--ease-out);
}

.template-card:hover .template-card__preview iframe {
  transform: translateX(-50%) scale(0.7);
}

.template-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.2rem 1.3rem 1.35rem;
}

.template-card__cat {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.template-card__name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1;
}

.template-card__desc {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.template-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.empty-state {
  text-align: left;
  max-width: 36rem;
  padding: 2.5rem 0 1rem;
}

.empty-state__index {
  margin: 0 0 0.8rem;
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--accent);
}

.empty-state__title {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 400;
}

.empty-state__text {
  margin: 0 0 1.4rem;
  color: var(--text-muted);
}

.empty-state__actions,
.editor-dialog__actions,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.search-empty,
.dash-toast {
  color: var(--text-muted);
}

.dash-toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  z-index: 50;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}

[data-reveal] {
  animation: reveal 0.8s var(--ease-out) both;
}

.article-grid .article-card,
.template-grid .template-card {
  animation: reveal 0.7s var(--ease-out) both;
}

.article-grid .article-card {
  animation-fill-mode: backwards;
}

.article-grid .article-card:nth-child(2),
.template-grid .template-card:nth-child(2) { animation-delay: 0.05s; }
.article-grid .article-card:nth-child(3),
.template-grid .template-card:nth-child(3) { animation-delay: 0.1s; }
.article-grid .article-card:nth-child(4),
.template-grid .template-card:nth-child(4) { animation-delay: 0.15s; }
.article-grid .article-card:nth-child(5),
.template-grid .template-card:nth-child(5) { animation-delay: 0.2s; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-note.is-error { margin: 0 0 1rem; padding: .7rem .85rem; border-radius: var(--radius-sm); background: rgba(226,139,124,.12); color: #f0b2a8; font-size: .9rem; }
.form-note.is-ok { margin: 0 0 1rem; color: var(--ok); }

.account-layout {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1.25rem;
  align-items: start;
}

.account-card {
  padding: 1.5rem 1.4rem 1.3rem;
}

.account-name {
  margin: 0.4rem 0 0.3rem;
  font-family: var(--serif);
  font-size: 2.4rem;
}

.account-mail {
  margin: 0;
}

.account-card__title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 2rem;
}

.is-editor {
  background:
    radial-gradient(900px 520px at 42% 18%, rgba(224, 184, 92, 0.07), transparent 60%),
    var(--bg);
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem;
  background: rgba(23, 22, 15, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: calc(var(--header) + 0.8rem);
}

.editor-back {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.editor-back:hover {
  color: var(--accent);
}

.sidebar-label {
  margin: 0 0 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.template-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cover-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.editor-sidebar__actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.save-status {
  min-height: 1.2rem;
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

.save-status.is-dirty { color: var(--accent); }
.save-status.is-saving { color: var(--text); }
.save-status.is-ok { color: var(--ok); }
.save-status.is-error { color: var(--danger); }

.editor-stage {
  min-width: 0;
}

.editor-toolbar {
  position: sticky;
  top: calc(var(--header) + 0.45rem);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem;
  margin-bottom: 1.4rem;
  background: rgba(20, 19, 15, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
}

.editor-toolbar::-webkit-scrollbar {
  display: none;
}

.tool-btn,
.tool-color,
.tool-size select {
  flex: 0 0 auto;
}

.tool-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.tool-btn--serif {
  font-family: var(--serif);
  font-size: 1rem;
}

.tool-btn:hover,
.tool-btn.is-on {
  background: rgba(244, 239, 230, 0.08);
  color: var(--text);
}

.tool-btn.is-on {
  background: var(--accent);
  color: #231c0c;
}

.tool-btn--text {
  padding-inline: 0.8rem;
}

.editor-toolbar__sep {
  flex: 0 0 auto;
  width: 1px;
  height: 1.1rem;
  margin-inline: 0.2rem;
  background: var(--border);
}

.editor-toolbar__spacer {
  flex: 1 0 0.5rem;
}

.editor-count {
  flex: 0 0 auto;
  padding-inline: 0.45rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.align-ico {
  display: block;
  width: 14px;
  height: 10px;
  background:
    linear-gradient(currentColor, currentColor) left 0 / 100% 1.5px,
    linear-gradient(currentColor, currentColor) left 4px / 72% 1.5px,
    linear-gradient(currentColor, currentColor) left 8px / 100% 1.5px;
  background-repeat: no-repeat;
}

.align-ico--center {
  background-position: center 0, center 4px, center 8px;
}

.align-ico--right {
  background-position: right 0, right 4px, right 8px;
}

.tool-color {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
}

.tool-color input {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.tool-color input::-webkit-color-swatch-wrapper { padding: 0; }
.tool-color input::-webkit-color-swatch {
  border: 1px solid rgba(244, 239, 230, 0.3);
  border-radius: 50%;
}

.tool-size select {
  width: auto;
  height: 36px;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: transparent;
}

.editor-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 3rem;
}

.editor-canvas-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 30px;
  width: min(560px, 90%);
  height: 520px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(224, 184, 92, 0.16), transparent 68%);
  pointer-events: none;
}

.sheet {
  position: relative;
  z-index: 1;
  width: min(392px, 100%);
  min-height: 680px;
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: width 0.45s var(--ease-out), border-radius 0.45s var(--ease-out);
}

.sheet.is-wide {
  width: min(720px, 100%);
  border-radius: 16px;
}

.sheet:focus-within {
  box-shadow: var(--shadow), 0 0 0 1px rgba(224, 184, 92, 0.55);
}

.sheet__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  color: #5c574e;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid #ece6dc;
}

.sheet__top span:last-child {
  letter-spacing: 0.08em;
  background: #efeae1;
  color: #6f675c;
}

.sheet__cover img {
  display: block;
  width: 100%;
  max-height: 230px;
  object-fit: cover;
}

.sheet__head {
  padding: 1.15rem 1.15rem 0.35rem;
}

.sheet__head h1 {
  margin: 0;
  font-family: var(--paper-sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  color: #171717;
  cursor: text;
  overflow-wrap: anywhere;
}

.sheet__head h1.is-empty::before {
  content: "无标题";
  color: #8a8176;
}

.sheet__head h1:focus,
.sheet__head h1:focus-visible {
  outline: none;
  box-shadow: inset 0 -1px 0 #1c1916;
}

.sheet__meta {
  display: flex;
  gap: 0.7rem;
  margin: 0.55rem 0 0;
  color: #5c574e;
  font-size: 13px;
}

.sheet__meta span:first-child {
  color: #576b95;
}

.sheet__body {
  position: relative;
}

.sheet__placeholder {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 16px;
  right: 16px;
  margin: 0;
  color: #b3ab9f;
  font-family: var(--paper-sans);
  font-size: 17px;
  line-height: 1.75;
  pointer-events: none;
}

.editor-surface {
  position: relative;
  z-index: 1;
  min-height: 520px;
  padding: 0 16px 48px;
  outline: none;
  caret-color: #1c1916;
  color: #222;
  font-family: var(--paper-sans);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.editor-surface:focus {
  outline: none;
}

.sheet ::selection {
  background: #1c1916;
  color: #f4efe6;
}

.editor-dialog {
  width: min(460px, calc(100vw - 1.5rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
}

.editor-dialog::backdrop {
  background: rgba(8, 7, 5, 0.72);
}

.editor-dialog[open] {
  animation: dialog-in 0.35s var(--ease-out);
}

.editor-dialog form {
  padding: 1.4rem 1.35rem 1.2rem;
}

.editor-dialog h2 {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: 2rem;
}

.editor-dialog p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.editor-dialog__actions {
  justify-content: flex-end;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .account-layout,
  .editor-shell {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
  }

  .page-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .app-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
  }

  .app-nav,
  .app-header__meta {
    flex: 0 1 auto;
    min-width: 0;
  }

  .app-nav {
    overflow-x: auto;
  }

  .app-main,
  .app-main--editor {
    padding: 1.6rem 1rem 6.5rem;
  }

  .page-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-title {
    font-size: clamp(2.6rem, 12vw, 3.6rem);
  }

  .template-chip,
  .filter-pill {
    min-height: 44px;
  }

  .editor-toolbar {
    border-radius: 16px;
    top: calc(var(--header) + 0.35rem);
    max-width: 100%;
  }

  .sheet {
    min-height: 0;
  }

  .editor-canvas-wrap {
    padding-bottom: 1.5rem;
  }

  .tool-btn,
  .tool-color,
  .tool-size select {
    min-width: 44px;
    height: 44px;
  }

  .editor-sidebar__actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    padding: 0.7rem 0.8rem calc(0.7rem + env(safe-area-inset-bottom));
    background: rgba(12, 11, 9, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(16px);
  }

  .save-status {
    grid-column: 1 / -1;
  }

  #btn-copy-html {
    grid-column: 1 / -1;
  }

  .editor-copy-note {
    margin-bottom: 0.4rem;
  }
}

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

/* The editing room: a quiet paper canvas between a visual library and inspector. */
.is-editor { background: #10120f; }
.is-editor .app-grain { opacity: .025; }
.is-editor .app-main--editor { max-width: 1920px; padding: 24px 28px 48px; }
.editor-shell { grid-template-columns: 284px minmax(0, 1fr) 272px; gap: 24px; }
.editor-library, .editor-sidebar { border: 1px solid #30342c; background: #191c17; border-radius: 14px; }
.editor-library { position: sticky; top: calc(var(--header) + 18px); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100dvh - var(--header) - 36px); }
.library-heading { display: flex; gap: 12px; align-items: center; padding: 22px 18px; }
.library-monogram { font-family: var(--serif); font-size: 42px; line-height: 1; color: #eee9d9; }
.library-monogram > span { color: #b8c89b; }
.library-eyebrow { display: block; font-size: 9px; letter-spacing: .16em; color: #a4b394; margin: 0 0 7px; }
.library-heading h2 { font-size: 13px; font-weight: 500; margin: 0; letter-spacing: .02em; }
.library-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 0 16px; border-bottom: 1px solid #34382f; gap: 16px; }
.library-tabs button { padding: 10px 0 13px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: 12px; color: #a8ad9f; cursor: pointer; }
.library-tabs button[aria-selected="true"] { color: #e5ebd9; border-color: #b8c89b; }
.library-tabs button span { margin-left: 3px; font-size: 10px; opacity: .6; }
.library-search { display: flex; align-items: center; gap: 8px; margin: 16px 16px 10px; padding: 0 10px; border: 1px solid #3a4033; background: #12150f; border-radius: 7px; color: #a8ad9f; }
.library-search:focus-within { border-color: #a4b394; }
.library-search > span { font-size: 24px; line-height: 1; }
.library-search input { width: 100%; min-width: 0; background: transparent; border: 0; padding: 10px 0; font-size: 12px; border-radius: 0; box-shadow: none; outline: none; }
.library-filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 14px; }
.library-filters button { font: inherit; font-size: 10px; border: 0; background: transparent; color: #abb2a1; padding: 5px 9px; border-radius: 4px; cursor: pointer; transition: background .18s, color .18s; }
.library-filters button:hover { color: #e7ecd9; background: #30362a; }
.library-filters button[aria-pressed="true"] { background: #c3cfac; color: #252c1f; }
.library-results { overflow-y: auto; min-height: 0; padding: 0 16px 16px; scrollbar-width: thin; scrollbar-color: #48513e transparent; }
.layout-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 10px; }
.layout-option { min-width: 0; padding: 0; background: none; border: 0; color: #e5e7df; text-align: left; cursor: pointer; font: inherit; }
.layout-option__paper { position: relative; display: block; height: 151px; border-radius: 5px; background: #fffdf9; border: 2px solid transparent; overflow: hidden; transition: border-color .2s, transform .25s var(--ease-out), box-shadow .2s; }
.layout-option iframe { width: 360px; height: 490px; border: 0; pointer-events: none; transform: scale(.31); transform-origin: top left; display: block; color-scheme: light; }
.layout-option:hover .layout-option__paper { transform: translateY(-3px); box-shadow: 0 7px 16px #0004; border-color: #aab897; }
.layout-option.is-active .layout-option__paper { border-color: #c6d6aa; }
.layout-option.is-active .layout-option__info strong::before { content: ''; display: inline-block; width: 6px; height: 10px; margin: 0 9px 0 3px; border: solid #c6d6aa; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.layout-option__peek { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; padding: 8px 2px; background: #25301eea; color: #eff5df; font-size: 10px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.layout-option:hover .layout-option__peek, .layout-option:focus-visible .layout-option__peek { opacity: 1; transform: none; }
.layout-option__info { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 8px; }
.layout-option__info strong { font-size: 11px; font-weight: 400; }
.layout-option__info small { font-size: 9px; color: #9da591; }
.library-footnote { margin: 0; padding: 12px 16px; border-top: 1px solid #30342c; font-size: 10px; color: #a2ab94; line-height: 1.7; }
.library-empty { font-size: 12px; color: #a8ad9f; line-height: 1.8; padding: 20px 4px; }
.component-gallery { display: grid; gap: 12px; }
.component-option { display: block; width: 100%; border: 1px solid #3a4033; border-radius: 6px; padding: 0; overflow: hidden; background: transparent; font: inherit; cursor: pointer; text-align: left; transition: border-color .2s; }
.component-option:hover, .component-option.is-inserted { border-color: #c3cfac; }
.component-option__sample { display: block; pointer-events: none; background: #fffdf9; color: #30342c; padding: 10px 14px; max-height: 145px; overflow: hidden; font-family: var(--paper-sans); }
.component-option__sample > * { zoom: .7; }
.component-option__info { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; color: #dce3cf; font-size: 11px; }
.component-option__info strong { font-weight: 400; }
.component-option__info > span { color: #a4b394; font-size: 10px; }
.component-option.is-inserted .component-option__info { background: #37482b; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px 23px; }
.workspace-heading h2 { font-family: var(--serif); font-size: clamp(20px, 1.8vw, 28px); font-weight: 400; letter-spacing: .04em; margin: 0; color: #e9e5d9; }
.workspace-mode { font-size: 10px; color: #a4b394; white-space: nowrap; }
.editor-toolbar { flex-wrap: wrap; border-radius: 10px; top: calc(var(--header) + 12px); gap: 1px; padding: 6px; background: #1d2119f5; border-color: #353b2e; margin-bottom: 24px; }
.tool-btn { min-width: 30px; height: 32px; padding: 0 7px; border-radius: 5px; color: #bec4b3; font-size: 11px; }
.tool-btn.is-on { background: #c3cfac; color: #252c1f; }
.tool-color { width: 28px; height: 32px; }
.tool-size select { height: 32px; font-size: 11px; border-radius: 5px; }
.editor-toolbar__sep { margin-inline: 2px; }
.editor-count { font-size: 10px; color: #a4ad97; }
.editor-canvas-wrap { padding-top: 12px; }
.editor-canvas-wrap::before { background: radial-gradient(circle, #9db47b0a, transparent 70%); }
.sheet { width: min(392px, 100%); background: #ffffff; border-radius: 5px; box-shadow: 0 24px 70px #0005, 0 0 0 1px #ffffff0a; }
.sheet.is-wide { border-radius: 5px; }
.sheet__top { font-size: 9px; letter-spacing: .08em; padding: 12px 20px; border-color: #eeeae1; }
.sheet__top span:last-child { padding: 3px 8px; border-radius: 3px; background: #eaf0e2; color: #59664d; }
.sheet__head { padding: 28px 16px 20px; }
.sheet__head h1 { font-size: 24px; line-height: 1.5; }
.sheet__meta { margin-top: 12px; font-size: 11px; }
.sheet__placeholder { top: 12px; left: 16px; right: 16px; color: #938d80; font-size: 14px; line-height: 2; }
.editor-surface { padding: 8px 16px 48px; font-size: 16px; }
.editor-surface img { max-width: 100%; height: auto; }
.editor-sidebar { top: calc(var(--header) + 18px); padding: 20px; gap: 20px; }
.editor-back { font-size: 11px; color: #adb69e; }
.inspector-heading h2 { margin: 0 0 6px; font-size: 20px; font-weight: 500; letter-spacing: .05em; }
.inspector-heading p { margin: 0; font-size: 11px; color: #a4ad97; }
.editor-sidebar .field__label { font-size: 11px; }
.editor-sidebar input, .editor-sidebar textarea { font-size: 12px; background: #12150f; border-color: #363d2e; border-radius: 6px; }
.editor-sidebar .field-hint, .editor-copy-note { font-size: 10px; line-height: 1.8; color: #a4ad97; }
.editor-sidebar .btn { border-radius: 6px; font-size: 12px; }
.editor-sidebar .btn--primary { background: #c3cfac; color: #20291b; box-shadow: none; }
.editor-sidebar .btn--primary:hover { background: #d6e3bd; transform: translateY(-1px); }
.editor-sidebar__actions { padding-top: 16px; border-top: 1px solid #343b2e; }
.save-status { font-size: 11px; text-align: left; margin-bottom: 6px; overflow-wrap: anywhere; }
.save-status::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }
.editor-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; background: #191c17; }
.editor-dialog--preview { width: min(510px, calc(100vw - 24px)); }
.editor-dialog--preview h2 { font-family: var(--sans); font-size: 22px; }
.editor-dialog--preview .editor-dialog__actions { position: sticky; bottom: -20px; background: #191c17; padding: 14px 0 4px; margin-top: 0; }
.layout-full-preview { display: block; width: min(100%, 392px); height: min(56dvh, 600px); border: 0; margin: 20px auto 8px; background: #fff; border-radius: 4px; color-scheme: light; }
[hidden] { display: none !important; }
@media (min-width: 1600px) {
  .editor-shell { grid-template-columns: 312px minmax(0, 1fr) 292px; gap: 36px; }
  .layout-option__paper { height: 172px; }
  .layout-option iframe { transform: scale(.35); }
}
@media (max-width: 1040px) and (min-width: 761px) {
  .editor-shell { grid-template-columns: 248px minmax(0, 1fr); gap: 20px; }
  .editor-sidebar { grid-column: 2; position: static; }
  .editor-library { grid-row: 1 / span 2; position: sticky; }
  .layout-option iframe { transform: scale(.26); }
  .layout-option__paper { height: 128px; }
  .workspace-mode { display: none; }
}
@media (max-width: 760px) {
  .is-editor .app-main--editor { padding: 16px 12px calc(220px + env(safe-area-inset-bottom)); }
  .editor-shell { display: flex; flex-direction: column; gap: 24px; }
  .editor-stage { width: 100%; order: 0; }
  .editor-library { position: static; width: 100%; order: 1; max-height: 620px; }
  .editor-sidebar { position: static; width: 100%; order: 2; }
  .workspace-heading { padding: 0 4px 18px; }
  .workspace-heading h2 { font-size: 22px; }
  .workspace-mode { font-size: 9px; }
  .editor-toolbar { flex-wrap: nowrap; top: calc(var(--header) + 4px); padding: 5px; margin-bottom: 16px; }
  .tool-btn, .tool-color, .tool-size select { min-width: 40px; height: 40px; }
  .layout-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-option iframe { transform: scale(.28); }
  .layout-option__paper { height: 140px; }
  .layout-option__info { flex-wrap: wrap; }
  .editor-sidebar__actions { background: #171c14f5; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .editor-sidebar__actions .save-status { margin: 0; text-align: center; }
  .library-filters button { padding: 9px 12px; font-size: 11px; }
  .library-tabs button { min-height: 44px; }
}
@media (max-width: 370px) {
  .layout-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-mode { display: none; }
}
.is-editor { --accent: #c3cfac; --accent-dim: #c3cfac20; --accent-glow: #c3cfac35; }
.mobile-library-shortcuts, .library-return { display: none; }
@media (max-width: 760px) {
  .mobile-library-shortcuts { display: flex; gap: 8px; margin: -2px 0 16px; }
  .mobile-library-shortcuts button, .library-return { font: inherit; font-size: 11px; color: #d5dec6; border: 1px solid #465039; border-radius: 5px; padding: 10px 14px; background: #252d1e; cursor: pointer; }
  .library-return { display: block; margin: 0 16px 12px; }
  .editor-library, .editor-stage { scroll-margin-top: calc(var(--header) + 12px); }
}
/* Match every miniature to the card width, including intermediate viewports. */
.layout-option iframe { width: 322.580645%; height: 560px; transform: scale(.31); }

@media (min-width: 1041px) and (max-width: 1299px) {
  .is-editor .app-main--editor { padding-inline: 20px; }
  .editor-shell { grid-template-columns: 248px minmax(0, 1fr) 240px; gap: 16px; }
  .editor-sidebar { padding: 16px; }
  .workspace-mode { display: none; }
}
.is-editor .tool-btn:disabled { opacity: .35; cursor: not-allowed; }

.component-library-link { display: block; padding: 0 16px 12px; font-size: 10px; color: #c5d6ae; text-decoration: none; }
.component-library-link:hover { color: #edf5e2; }

/* Shared creation chooser, available from every authenticated page. */
#app-create-trigger { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; min-height: 40px; white-space: nowrap; flex-shrink: 0; }
.app-create-dialog { position: fixed; width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 32px; overflow-y: auto; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow); }
.app-create-dialog::backdrop { background: #070906b3; backdrop-filter: blur(6px); }
.app-create-dialog .page-kicker { font-size: 10px; padding-right: 32px; }
.app-create-dialog h2 { margin: 0 0 10px; font-size: 25px; line-height: 1.5; font-weight: 500; }
#app-create-description { margin: 0 0 24px; font-size: 13px; line-height: 1.8; color: var(--text-muted); }
.app-create-close { position: absolute; right: 16px; top: 16px; margin: 0; }
.app-create-close button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text-muted); font: inherit; font-size: 24px; cursor: pointer; }
.app-create-close button:hover { color: var(--text); background: var(--accent-dim); }
.app-create-options { display: grid; gap: 12px; }
.app-create-options a { display: flex; align-items: center; gap: 16px; padding: 18px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; transition: border-color .2s, background .2s; }
.app-create-options a:hover, .app-create-options a:focus-visible { border-color: var(--accent); background: var(--accent-dim); }
.app-create-symbol { display: grid; place-items: center; flex: 0 0 44px; height: 50px; border: 1px solid var(--border); border-radius: 5px; font-family: var(--serif); font-size: 26px; color: var(--accent); background: var(--accent-dim); }
.app-create-options a > span:nth-child(2) { flex: 1; min-width: 0; }
.app-create-options strong { display: block; font-size: 16px; font-weight: 500; }
.app-create-options small { display: block; margin-top: 5px; font-size: 11px; line-height: 1.8; color: var(--text-muted); }
.app-create-options a > span:last-child { color: var(--accent); }
@media (max-width: 540px) { .app-create-dialog { padding: 26px 20px 22px; } .app-create-dialog h2 { font-size: 22px; } .app-create-options a { gap: 12px; padding: 16px 12px; } }
@media (prefers-reduced-motion: reduce) { .app-create-options a { transition: none; } }

/* A visible typography contract between the library and the paper. */
.template-context { margin: 0 0 16px; padding: 18px 20px 14px; border: 1px solid #414a35; border-radius: 12px; background: linear-gradient(115deg, #252c1e, #191e16 75%); box-shadow: inset 0 1px #ffffff06; }
.template-context__top { display: flex; align-items: center; gap: 12px; }
.template-context__icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #59664a; border-radius: 8px; color: #dce7c8; font: 28px var(--serif); }
.template-context .library-eyebrow { margin-bottom: 4px; font-size: 8px; }
.template-context strong { color: #ececdf; font-size: 15px; font-weight: 500; letter-spacing: .04em; }
.template-context__badge { margin-left: auto; padding: 5px 9px; border: 1px solid #556344; border-radius: 20px; color: #c6d6ac; font-size: 10px; white-space: nowrap; }
.template-context__bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid #ffffff12; }
.template-context__bottom p { margin: 0; color: #bcc5ae; font-size: 11px; line-height: 1.8; font-variant-numeric: tabular-nums; }
.paste-mode { display: flex; align-items: center; gap: 8px; color: #a7b299; font-size: 10px; }
.paste-mode select { max-width: 150px; padding: 7px 26px 7px 9px; border: 1px solid #4b573e; border-radius: 6px; color: #e0e8d3; background-color: #151b11; font: inherit; font-size: 11px; cursor: pointer; transition: border-color .18s; }
.paste-mode select:hover, .paste-mode select:focus-visible { border-color: #c3cfac; }
.template-context__hint { margin: 10px 0 0; color: #a8b49a; font-size: 10px; line-height: 1.8; }
@media (max-width: 700px) {
  .template-context { padding: 14px; margin-bottom: 12px; }
  .template-context__badge { font-size: 9px; padding: 5px 7px; }
  .template-context__bottom { align-items: flex-start; gap: 8px; }
  .paste-mode { justify-content: space-between; width: 100%; }
  .paste-mode select { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .paste-mode select { transition: none; } }
@media (max-width: 700px) {
  .app-header { gap: 10px; padding-inline: 14px; }
  .app-logo { flex-shrink: 0; }
  .app-nav { gap: 14px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .app-nav__link { flex-shrink: 0; white-space: nowrap; }
  .app-header__meta { display: none; }
}

/* A colophon for the workspace: generous on library pages, quiet while editing. */
.app-body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.app-header { flex-shrink: 0; }
.app-main { width: 100%; flex: 1 0 auto; }
.app-footer { flex-shrink: 0; width: 100%; border-top: 1px solid var(--border); background: #08090624; }
.app-footer a { color: inherit; text-decoration: none; }
.app-footer a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.app-footer__inner { max-width: 1440px; margin: 0 auto; padding: 52px 32px 22px; }
.app-footer__main { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 80px; align-items: start; padding-bottom: 44px; }
.app-footer__eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; color: var(--text-muted); font-size: 10px; letter-spacing: .16em; }
.app-footer__eyebrow > span { display: inline-block; color: var(--accent); font-size: 22px; line-height: 1; }
.app-footer__wordmark { margin: 0; color: var(--text); font: 400 clamp(64px, 7vw, 100px)/.95 var(--serif); letter-spacing: -.045em; overflow-wrap: anywhere; }
.app-footer__wordmark > span { color: var(--accent); }
.app-footer__note { margin: 20px 0 0; color: var(--text-muted); font-size: 13px; letter-spacing: .13em; line-height: 1.8; overflow-wrap: anywhere; }
.app-footer__contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-bottom: 20px; color: var(--text-muted); font-size: 12px; line-height: 1.8; }
.app-footer__email { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0; max-width: 100%; padding: 4px 0; letter-spacing: 0; }
.app-footer a.app-footer__email { color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: color .18s, text-decoration-color .18s; }
.app-footer__email > span { min-width: 0; overflow-wrap: anywhere; }
.app-footer a.app-footer__email:hover, .app-footer a.app-footer__email:focus-visible { color: var(--text); text-decoration-color: currentColor; }
.app-footer__legal { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.app-footer--compact .app-footer__contact { padding-bottom: 14px; font-size: 11px; }
.app-footer--guest .app-footer__contact { padding-top: 8px; padding-bottom: 14px; font-size: 11px; }
.app-footer__nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px; padding-top: 4px; }
.app-footer__group > p { margin: 0 0 17px; color: var(--text-muted); font-size: 11px; letter-spacing: .1em; }
.app-footer__group a { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; width: fit-content; min-width: 115px; padding: 7px 0; color: var(--text); font-size: 13px; text-decoration: none; transition: color .2s ease; }
.app-footer__group a > span { color: var(--accent); opacity: 0; transform: translate(-4px, 4px); transition: opacity .2s ease, transform .2s var(--ease-out); }
.app-footer__group a:hover, .app-footer__group a:focus-visible { color: var(--accent); }
.app-footer__group a:hover > span, .app-footer__group a:focus-visible > span { opacity: 1; transform: none; }
.app-footer__group a[aria-current="page"] { color: var(--accent); }
.app-footer__base { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 11px; }
.app-footer__base > p { min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 0; line-height: 1.9; }
.app-footer__divider { padding: 0 8px; color: var(--accent); }
.app-footer__top { display: inline-flex; flex-shrink: 0; align-items: center; gap: 14px; min-height: 44px; color: var(--text-muted); text-decoration: none; }
.app-footer__top > span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); font-size: 18px; transition: background .2s ease, color .2s ease, transform .25s var(--ease-out); }
.app-footer__top:hover, .app-footer__top:focus-visible { color: var(--text); }
.app-footer__top:hover > span, .app-footer__top:focus-visible > span { color: var(--bg); background: var(--accent); transform: translateY(-3px); }
.app-footer__colophon { font-size: 9px; letter-spacing: .14em; }
.app-footer--compact .app-footer__inner { max-width: 1760px; padding: 24px 28px 18px; }
.app-footer--compact .app-footer__main { display: block; padding-bottom: 20px; }
.app-footer--compact .app-footer__identity { display: flex; align-items: baseline; gap: 20px; }
.app-footer--compact .app-footer__eyebrow { display: none; }
.app-footer--compact .app-footer__wordmark { font-size: 36px; }
.app-footer--compact .app-footer__note { margin: 0; font-size: 12px; }
.app-footer--guest .app-footer__inner { max-width: 1120px; padding-top: 0; }
.app-footer--guest { border: 0; background: none; }
@media (max-width: 700px) {
  .app-footer__inner { padding: 36px 20px 18px; }
  .app-footer__main { grid-template-columns: 1fr; gap: 36px; padding-bottom: 28px; }
  .app-footer__eyebrow { font-size: 9px; margin-bottom: 16px; }
  .app-footer__wordmark { font-size: clamp(60px, 18vw, 86px); }
  .app-footer__note { margin-top: 14px; font-size: 12px; }
  .app-footer__nav { gap: 28px; padding: 24px 0 0; border-top: 1px solid var(--border); }
  .app-footer__group > p { margin-bottom: 10px; }
  .app-footer__group a { min-height: 44px; }
  .app-footer__contact { gap: 4px 20px; padding-bottom: 16px; font-size: 11px; }
  .app-footer__email { min-height: 44px; }
  .app-footer__base { align-items: flex-start; gap: 14px; }
  .app-footer__base > p { display: block; padding-top: 5px; font-size: 10px; }
  .app-footer__base > p > span:last-child { display: block; margin-top: 3px; }
  .app-footer__divider { display: none; }
  .app-footer__top { gap: 8px; font-size: 10px; }
  .app-footer--compact .app-footer__inner { padding-inline: 16px; }
  .app-footer--compact .app-footer__identity { flex-wrap: wrap; gap: 10px 18px; }
  .app-footer--guest .app-footer__base { flex-wrap: wrap; }
  .app-footer__colophon { font-size: 8px; }
}
@media (max-width: 760px) {
  /* Move the existing fixed-action clearance below the footer on mobile. */
  .is-editor .app-main--editor { padding-bottom: 40px; }
  .is-editor .app-footer { padding-bottom: calc(220px + env(safe-area-inset-bottom)); }
}
@media (hover: none) { .app-footer__group a > span { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .app-footer a, .app-footer a > span { transition: none; } }
@media print { .app-footer { display: none; } }

/* Fixed vector geometry keeps all interface icons monochrome on mobile systems. */
.ui-icon { display: inline-block; width: 1em; height: 1em; flex-shrink: 0; vertical-align: -.125em; color: inherit; }

.workspace-mode::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: middle; }

/* Account addresses follow the same long-content handling as footer contacts. */
.account-card { min-width: 0; }
.account-name, .account-mail { overflow-wrap: anywhere; }
