/* ============================================================
   AO3 STUDIO — style.css
   ============================================================ */

/* ── VARIABLES ──────────────────────────────────────────────── */
:root {
  --brand:           #900;
  --brand-hover:     #b30000;
  --brand-light:     #fff0f0;
  --brand-border:    #f5c0c0;

  --bg:              #f5f3f0;
  --surface:         #ffffff;
  --border:          #e4ddd6;
  --border-mid:      #cec7bf;
  --text:            #1a1512;
  --muted:           #7a6f68;
  --faint:           #b0a89f;

  --c-msg:           #2563a8;
  --c-msg-bg:        #eef4fd;
  --c-msg-border:    #b5d4f4;
  --c-social:        #7c3aad;
  --c-social-bg:     #f3f0fe;
  --c-social-border: #cec9f4;
  --c-docs:          #1a7a56;
  --c-docs-bg:       #edf7f3;
  --c-docs-border:   #9fe1cb;
  --c-format:        #b45309;
  --c-format-bg:     #fef6e9;
  --c-format-border: #fac775;

  /* Skin panel: scales with viewport; drag handle can override via --sidebar-w on :root */
  --sidebar-w:       clamp(320px, 36vw, 640px);
  /* Max column width for the editor card; widens on large screens (see breakpoints below). */
  --page-w:          720px;
}

@media (min-width: 1180px) {
  :root { --page-w: 840px; }
}
@media (min-width: 1440px) {
  :root { --page-w: 960px; }
}
@media (min-width: 1680px) {
  :root { --page-w: 1040px; }
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── WARNING BANNER ─────────────────────────────────────────── */
.top-banner { background: #fee2e2; color: #991b1b; padding: 10px 20px; text-align: center; font-size: 0.875rem; border-bottom: 1px solid #f87171; z-index: 1000; }
.top-banner.hidden { display: none; }
.top-banner--testing {
  background: #fef3c7;
  color: #78350f;
  border-bottom-color: #f59e0b;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  row-gap: 12px;
  padding: 10px 20px;
  min-height: 56px;
  height: auto;
  flex-shrink: 0;
  z-index: 11;
  background: linear-gradient(180deg, #ffffff 0%, #f9f7f4 55%, #f2efe9 100%);
  border-bottom: 1px solid var(--border-mid);
  box-shadow:
    0 4px 16px rgba(26, 21, 18, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
  padding: 6px 12px 6px 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 244, 239, 0.92) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 10px rgba(26, 21, 18, 0.05);
}

.header-left h1 {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left h1::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex-shrink: 0;
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Crect x='1' y='1' width='3.5' height='3.5' rx='0.5' fill='white' opacity='0.9'/%3E%3Crect x='5.5' y='1' width='3.5' height='3.5' rx='0.5' fill='white' opacity='0.9'/%3E%3Crect x='1' y='5.5' width='3.5' height='3.5' rx='0.5' fill='white' opacity='0.9'/%3E%3Crect x='5.5' y='5.5' width='3.5' height='3.5' rx='0.5' fill='white' opacity='0.9'/%3E%3C/svg%3E"),
    linear-gradient(145deg, rgba(255, 255, 255, 0.2) 0%, transparent 45%, rgba(0, 0, 0, 0.15) 100%);
  background-size: 12px 12px, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 2px 6px rgba(153, 0, 0, 0.35);
}

.beta-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--c-format);
  background: linear-gradient(180deg, #fffefb 0%, var(--c-format-bg) 100%);
  border: 1px solid var(--c-format-border);
  border-radius: 999px;
  padding: 4px 9px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 1px 4px rgba(180, 83, 9, 0.12);
}

#header-autosave {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--brand);
  background: linear-gradient(180deg, #fff8f8 0%, var(--brand-light) 100%);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  padding: 4px 9px;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.3s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(153, 0, 0, 0.08);
}

#header-autosave.visible { opacity: 1; }

.header-center {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.app-header .word-count {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  padding: 6px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f1ed 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 4px rgba(26, 21, 18, 0.05);
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 5px 8px 5px 10px;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.55) 0%, rgba(245, 242, 237, 0.92) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 2px 8px rgba(26, 21, 18, 0.04);
}

.app-header .btn-ghost-sm {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid rgba(228, 221, 214, 0.95);
  border-radius: 8px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #faf7f4 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 3px rgba(26, 21, 18, 0.06);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-header .btn-ghost-sm:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f0ebe6 100%);
  color: var(--text);
  border-color: var(--border-mid);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 3px 8px rgba(26, 21, 18, 0.08);
}

.app-header .btn-primary,
.app-header .btn-export {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  padding: 7px 16px;
  border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: linear-gradient(180deg, #d11a1a 0%, var(--brand) 42%, #6b0000 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 8px rgba(153, 0, 0, 0.32);
  transition: background 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.app-header .btn-primary:hover,
.app-header .btn-export:hover {
  background: linear-gradient(180deg, #e02020 0%, var(--brand-hover) 42%, #7a0000 100%);
  filter: brightness(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 14px rgba(153, 0, 0, 0.38);
}

.app-header .btn-secondary.header-file-btn {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(228, 221, 214, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #faf7f4 100%);
  color: var(--text);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 3px rgba(26, 21, 18, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-header .btn-secondary.header-file-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #f0ebe6 100%);
  border-color: var(--border-mid);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 3px 8px rgba(26, 21, 18, 0.08);
}

.app-header .btn-secondary.header-file-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.app-header .btn-ghost-sm:focus-visible,
.app-header .btn-primary:focus-visible,
.app-header .btn-export:focus-visible,
.app-header .btn-secondary.header-file-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Modals & rest of app — flat ghost / primary */
.btn-ghost-sm { font-size: 0.78rem; color: var(--muted); border: 0.5px solid var(--border); border-radius: 6px; padding: 5px 10px; background: transparent; transition: background 0.15s, color 0.15s; }
.btn-ghost-sm:hover { background: var(--bg); color: var(--text); }
.btn-primary, .btn-export { font-size: 0.82rem; font-weight: 600; background: var(--brand); color: #fff; border: none; border-radius: 6px; padding: 6px 14px; transition: background 0.15s; }
.btn-primary:hover, .btn-export:hover { background: var(--brand-hover); }
.btn-secondary { font-size: 0.82rem; font-weight: 600; background: #f0ebe6; color: var(--text); border: 0.5px solid var(--border); border-radius: 6px; padding: 6px 14px; }
.btn-secondary:hover { background: var(--border); }

/* ── TOOLBAR ─────────────────────────────────────────────────── */
.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 10px 14px;
  padding: 12px 20px;
  min-height: 52px;
  height: auto;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f5 45%, #f3f0eb 100%);
  border-bottom: 1px solid var(--border-mid);
  box-shadow:
    0 6px 20px rgba(26, 21, 18, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.app-toolbar > .toolbar-group:first-of-type {
  padding: 6px 10px;
  gap: 5px 7px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 244, 239, 0.92) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 10px rgba(26, 21, 18, 0.05);
}

.toolbar-group.toolbar-group-insert {
  padding: 7px 12px 7px 14px;
  gap: 8px 10px;
  background: linear-gradient(
    115deg,
    rgba(238, 244, 253, 0.55) 0%,
    rgba(243, 240, 254, 0.45) 38%,
    rgba(237, 247, 243, 0.4) 72%,
    rgba(254, 246, 233, 0.55) 100%
  );
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 3px 12px rgba(26, 21, 18, 0.05);
}

.toolbar-divider {
  width: 2px;
  height: 28px;
  align-self: center;
  margin: 0 6px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent 0%, var(--border-mid) 35%, var(--border-mid) 65%, transparent 100%);
  opacity: 0.85;
}

.toolbar-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 4px;
  flex-shrink: 0;
  opacity: 0.92;
}

.toolbar-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  background: linear-gradient(180deg, #ffffff 0%, #faf7f4 100%);
  border: 1px solid rgba(228, 221, 214, 0.95);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 3px rgba(26, 21, 18, 0.06);
}

.toolbar-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f0ebe6 100%);
  border-color: var(--border-mid);
  color: var(--text);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 3px 8px rgba(26, 21, 18, 0.08);
}

.toolbar-btn.active {
  background: linear-gradient(180deg, #fff8f8 0%, var(--brand-light) 100%);
  color: var(--brand);
  border-color: var(--brand-border);
  box-shadow:
    inset 0 0 0 1px rgba(245, 192, 192, 0.5),
    0 1px 3px rgba(153, 0, 0, 0.08);
}

.toolbar-btn.toolbar-format-atomic-context:not(.active) {
  opacity: 0.72;
}

.toolbar-btn.toolbar-undo-redo-btn {
  max-width: 4.25rem;
}

.toolbar-btn.toolbar-align-btn,
.toolbar-btn.toolbar-link-btn,
.toolbar-btn.toolbar-blockquote-btn,
.toolbar-btn.clear-format-btn,
.toolbar-btn.toolbar-list-btn {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  text-align: center;
}

.toolbar-btn.toolbar-align-btn,
.toolbar-btn.toolbar-link-btn { max-width: 4.25rem; }
.toolbar-btn.toolbar-list-btn {
  max-width: 2.85rem;
  min-width: 2.5rem;
  padding: 5px 7px;
  overflow: visible;
}
.toolbar-btn.toolbar-blockquote-btn { max-width: 5.5rem; }
.toolbar-btn.clear-format-btn { max-width: 7.5rem; }

.toolbar-btn.toolbar-undo-redo-btn:hover,
.toolbar-btn.toolbar-align-btn:hover,
.toolbar-btn.toolbar-link-btn:hover,
.toolbar-btn.toolbar-blockquote-btn:hover,
.toolbar-btn.clear-format-btn:hover,
.toolbar-btn.toolbar-list-btn:hover { color: var(--text); }

.toolbar-strike-btn .toolbar-strike-label {
  text-decoration: line-through;
  font-weight: 600;
}

.toolbar-code-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  font-weight: 600;
}

.toolbar-subsup-btn {
  padding: 6px 9px;
  font-weight: 600;
  line-height: 1;
}

.toolbar-subsup-example {
  font-size: 0.8rem;
  letter-spacing: -0.02em;
}

.toolbar-subsup-btn sub,
.toolbar-subsup-btn sup {
  font-size: 0.65em;
  font-weight: 700;
  line-height: 0;
}

.toolbar-subsup-btn sub {
  vertical-align: sub;
}

.toolbar-subsup-btn sup {
  vertical-align: super;
}

.toolbar-hr-btn {
  min-width: 2.35rem;
  padding: 7px 10px;
}

.toolbar-hr-icon {
  display: block;
  width: 1.4rem;
  height: 3px;
  margin: 0 auto;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.5;
}

.toolbar-hr-btn:hover .toolbar-hr-icon,
.toolbar-hr-btn.active .toolbar-hr-icon {
  opacity: 0.85;
}

.toolbar-list-icon {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 1.4rem;
  margin: 0 auto;
}

.toolbar-list-icon__row {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 0;
}

.toolbar-list-icon__bullet {
  flex-shrink: 0;
  width: 0.5rem;
  text-align: center;
  font-size: 0.52rem;
  line-height: 1;
  opacity: 0.9;
}

.toolbar-list-icon__num {
  flex-shrink: 0;
  width: 0.78rem;
  text-align: right;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.toolbar-list-icon__rule {
  flex: 1;
  height: 2px;
  min-width: 0.2rem;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.42;
}

.app-toolbar .toolbar-dropdown {
  position: relative;
  display: inline-block;
}

.app-toolbar .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.app-toolbar .dropdown-toggle:hover {
  background: var(--bg);
  border-color: var(--border-mid);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.04);
}

.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(1) .dropdown-toggle {
  color: var(--c-msg);
  background: linear-gradient(180deg, #fbfdff 0%, var(--c-msg-bg) 100%);
  border-color: var(--c-msg-border);
  box-shadow: 0 1px 4px rgba(37, 99, 168, 0.12);
}
.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(1) .dropdown-toggle:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e2edf9 100%);
  border-color: var(--c-msg);
  box-shadow: 0 3px 10px rgba(37, 99, 168, 0.15);
}

.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(2) .dropdown-toggle {
  color: var(--c-social);
  background: linear-gradient(180deg, #fdfcff 0%, var(--c-social-bg) 100%);
  border-color: var(--c-social-border);
  box-shadow: 0 1px 4px rgba(124, 58, 173, 0.1);
}
.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(2) .dropdown-toggle:hover {
  background: linear-gradient(180deg, #ffffff 0%, #ebe4fb 100%);
  border-color: var(--c-social);
  box-shadow: 0 3px 10px rgba(124, 58, 173, 0.14);
}

.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(3) .dropdown-toggle {
  color: var(--c-docs);
  background: linear-gradient(180deg, #fbfffd 0%, var(--c-docs-bg) 100%);
  border-color: var(--c-docs-border);
  box-shadow: 0 1px 4px rgba(26, 122, 86, 0.1);
}
.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(3) .dropdown-toggle:hover {
  background: linear-gradient(180deg, #ffffff 0%, #dceee6 100%);
  border-color: var(--c-docs);
  box-shadow: 0 3px 10px rgba(26, 122, 86, 0.14);
}

.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(4) .dropdown-toggle {
  color: var(--c-format);
  background: linear-gradient(180deg, #fffefb 0%, var(--c-format-bg) 100%);
  border-color: var(--c-format-border);
  box-shadow: 0 1px 4px rgba(180, 83, 9, 0.1);
}
.app-toolbar .toolbar-group-insert .toolbar-dropdown:nth-of-type(4) .dropdown-toggle:hover {
  background: linear-gradient(180deg, #ffffff 0%, #fcecd4 100%);
  border-color: var(--c-format);
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.14);
}

.text-type-dropdown .dropdown-toggle.text-type-toggle {
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #f2eeea 100%);
  border-color: var(--border-mid);
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(26, 21, 18, 0.06);
}

.text-type-dropdown .dropdown-toggle.text-type-toggle:hover {
  filter: none;
  background: linear-gradient(180deg, #ffffff 0%, #e8e4df 100%);
  border-color: var(--border-mid);
  box-shadow: 0 2px 8px rgba(26, 21, 18, 0.08);
}

.app-toolbar .dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  min-width: 200px;
  z-index: 200;
  padding: 8px 0;
}

.app-toolbar .toolbar-dropdown.open .dropdown-menu {
  display: block;
}

.app-toolbar .dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.app-toolbar .dropdown-item:hover {
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  .toolbar-btn:hover {
    transform: translateY(-1px);
  }

  .app-toolbar .toolbar-dropdown.open .dropdown-menu {
    animation: dropdownFadeIn 0.15s ease-out forwards;
  }

  .app-toolbar .dropdown-item {
    transition: background 0.15s ease, padding-left 0.2s ease, color 0.15s ease;
  }

  .app-toolbar .dropdown-item:hover {
    padding-left: 20px;
    color: var(--brand);
  }
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-toolbar .toolbar-btn:focus-visible,
.app-toolbar .dropdown-toggle:focus-visible,
.app-toolbar .dropdown-item:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── WORKSPACE ───────────────────────────────────────────────── */
/* Hide editor column on first paint until stylesheets + restore run (script.js finishAo3WorksBoot). */
html.ao3works-boot #editor-surface {
  visibility: hidden;
}

.app-workspace { display: flex; flex-grow: 1; overflow: hidden; position: relative; min-width: 0; }
.editor-surface {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 36px 24px;
  display: flex;
  justify-content: center;
  background: var(--bg);
  transition: padding-right 0.3s ease;
}
.editor-surface.panel-open { padding-right: calc(var(--sidebar-w) + 24px); }
.editor-wrap {
  width: 100%;
  max-width: min(var(--page-w), 100%);
  background: var(--surface);
  min-height: 700px;
  padding: 56px 64px;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  align-self: flex-start;
  position: relative;
}

/* Hover chip: edit link / image in prose (not skin previews) */
.editor-hover-edit {
  position: fixed;
  z-index: 400;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}
.editor-hover-edit.hidden { display: none !important; }
.editor-hover-edit-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  border: 0.5px solid var(--brand-border);
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.editor-hover-edit-btn:hover {
  filter: brightness(0.97);
}
.editor-hover-edit-btn.hidden {
  display: none !important;
}

/* ── AO3-ACCURATE PROSEMIRROR STYLES ────────────────────────── */
.ProseMirror { outline: none; min-height: 500px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'GNU Unifont', Verdana, Helvetica, sans-serif; font-size: 1em; line-height: 1.5; color: #2a2a2a; }
.ProseMirror p { margin-top: 0; margin-bottom: 1em; }
.ProseMirror h1 { font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'GNU Unifont', Verdana, Helvetica, sans-serif; font-size: 2em; font-weight: normal; text-align: center; margin: 0.67em 0; color: #2a2a2a; }
.ProseMirror h2 { font-size: 1.5em; font-weight: normal; margin: 0.83em 0; color: #2a2a2a; }
.ProseMirror h3 { font-size: 1.17em; font-weight: normal; margin: 1em 0; padding-bottom: 0.2em; border-bottom: 3px double #2a2a2a; color: #2a2a2a; }
.ProseMirror h4 { font-size: 1em; font-weight: bold; margin: 1.33em 0; color: #2a2a2a; }
.ProseMirror h5 { font-size: 0.875em; font-weight: bold; margin: 1.67em 0; color: #2a2a2a; }
.ProseMirror h6 { font-size: 0.85em; font-weight: bold; margin: 2.33em 0 1em; padding-bottom: 0.2em; border-bottom: 1px solid #2a2a2a; color: #2a2a2a; }
.ProseMirror blockquote { border-inline-start: 2px solid #999; margin-inline-start: 1.5em; margin-inline-end: 0; padding-inline-start: 1em; color: inherit; }
/* Divider: large vertical hit target so it’s easy to click/select/delete; line stays thin */
.ProseMirror hr {
  display: block;
  border: none;
  margin: 1.25em auto;
  width: 50%;
  max-width: 100%;
  box-sizing: border-box;
  height: 32px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.ProseMirror hr::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1px;
  background: #aaa;
  pointer-events: none;
}
.ProseMirror hr:hover {
  background: rgba(42, 42, 42, 0.06);
}
.ProseMirror hr.ProseMirror-selectednode {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
  background: rgba(153, 0, 0, 0.07);
}
.ProseMirror hr.ProseMirror-selectednode::after {
  background: var(--brand);
}
.ProseMirror a { color: #900; text-decoration: underline; }
.ProseMirror img { max-width: 100%; height: auto; vertical-align: middle; }
.ProseMirror s, .ProseMirror del { text-decoration: line-through; }
.ProseMirror code { font-family: 'Monaco', 'Consolas', Courier, monospace; font-size: 0.857em; background: #f4f4f4; padding: 0 3px; border-radius: 2px; }
.ProseMirror pre { font-family: 'Monaco', 'Consolas', Courier, monospace; font-size: 0.857em; background: #f4f4f4; padding: 0.75em 1em; overflow-x: auto; border-radius: 2px; }
.ProseMirror ul, .ProseMirror ol { margin: 0.5em 0 1em 2em; padding: 0; }
.ProseMirror li { margin-bottom: 0.25em; }
.ProseMirror img { max-width: 100%; height: auto; }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #aaa; pointer-events: none; float: left; height: 0; }

/* ── SKIN BLOCK NODEVIEW ─────────────────────────────────────── */
.skin-block { position: relative; margin: 1.5rem 0; border: 1px solid transparent; border-radius: 8px; transition: border-color 0.15s; }
.skin-block:hover { border-color: var(--border); }
.skin-block.selected { border-color: var(--brand); }
.skin-block-actions { position: absolute; top: -28px; right: 0; display: none; background: var(--surface); border: 0.5px solid var(--border); border-radius: 4px; padding: 2px; z-index: 10; }
.skin-block:hover .skin-block-actions, .skin-block.selected .skin-block-actions { display: flex; }
.skin-block-action, .skin-block-drag { padding: 3px 8px; font-size: 0.72rem; cursor: pointer; color: var(--muted); border-radius: 3px; }
.skin-block-action:hover { background: var(--bg); color: var(--text); }
.skin-block-drag { cursor: grab; color: var(--faint); }
.skin-block-action--delete { color: #c00; }
.skin-block::after { content: 'Preview — this is how readers will see this on AO3'; display: block; text-align: center; font-size: 0.68rem; color: var(--faint); letter-spacing: 0.04em; padding: 4px 0 6px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* ── SIDE PANEL ──────────────────────────────────────────────── */
.side-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border-left: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 100;
}
.side-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  margin-left: -5px;
  z-index: 3;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  border: none;
  padding: 0;
}
.side-panel-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: var(--border);
  opacity: 0.65;
  border-radius: 2px;
  transition: opacity 0.15s, background 0.15s;
}
.side-panel-resize-handle:hover::after,
.side-panel-resize-handle:focus-visible::after {
  opacity: 1;
  background: var(--brand);
}
body.side-panel-resizing {
  cursor: col-resize !important;
  user-select: none;
}
body.side-panel-resizing iframe,
body.side-panel-resizing .ProseMirror {
  pointer-events: none;
}
.side-panel.hidden { transform: translateX(100%); }
.side-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 0.5px solid var(--border); }
.side-panel-header h2 { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.side-panel-body { padding: 18px 20px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 14px; }
.close-btn { font-size: 1.4rem; color: var(--muted); line-height: 1; padding: 0 4px; }
.close-btn:hover { color: var(--text); }

/* Panel form elements */
.panel-helper { font-size: 0.78rem; line-height: 1.55; color: #1a4a7a; background: #eef4fd; border-radius: 6px; padding: 10px 12px; border-left: 2px solid #85b7eb; }
.panel-field { display: flex; flex-direction: column; }
.panel-label { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.panel-input, .panel-textarea, .panel-select, .convo-side-select, .convo-turn-speaker, .convo-turn-text { width: 100%; padding: 7px 10px; border: 0.5px solid var(--border); border-radius: 6px; font-size: 0.82rem; color: var(--text); background: var(--surface); transition: border-color 0.15s; }
.panel-input:focus, .panel-textarea:focus, .panel-select:focus, .convo-side-select:focus, .convo-turn-speaker:focus, .convo-turn-text:focus { outline: none; border-color: var(--brand); }
.panel-textarea, .convo-turn-text { resize: vertical; }
.panel-section { border-top: 0.5px solid var(--border); padding-top: 14px; margin-top: 4px; }
.convo-participant-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.convo-participant-row .convo-participant-label { flex: 1; min-width: 0; }
.convo-participants-section #convo-participants { margin-bottom: 8px; }
.convo-turn { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); padding: 10px; border-radius: 8px; margin-bottom: 8px; border: 0.5px solid var(--border); }
.convo-turn-left { flex-grow: 1; display: flex; flex-direction: column; gap: 6px; }
.convo-turn-remove { color: var(--faint); font-size: 1.1rem; padding: 0 3px; }
.convo-turn-remove:hover { color: #c00; }
.add-turn-btn { width: 100%; padding: 7px; margin-top: 4px; border: 0.5px dashed var(--c-docs-border); background: var(--c-docs-bg); color: var(--c-docs); border-radius: 6px; font-size: 0.78rem; font-weight: 500; transition: filter 0.15s; }
.add-turn-btn:hover { filter: brightness(0.95); }
.panel-actions { margin-top: 4px; display: flex; gap: 8px; }
.panel-btn-primary { background: var(--brand); color: #fff; border-radius: 6px; font-size: 0.82rem; font-weight: 600; width: 100%; padding: 9px; transition: background 0.15s; }
.panel-btn-primary:hover { background: var(--brand-hover); }
.panel-btn-ghost { background: transparent; color: var(--muted); border: 0.5px solid var(--border); border-radius: 6px; font-size: 0.82rem; padding: 9px 14px; transition: background 0.15s; }
.panel-btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── LIVE PREVIEW ────────────────────────────────────────────── */
.panel-preview-section { border-top: 0.5px solid var(--border); margin-top: 6px; padding-top: 14px; }
.panel-preview-label { font-size: 0.68rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }
.panel-preview-scroll {
  max-height: 300px;
  overflow-x: auto;
  overflow-y: auto;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
#panel-preview { padding: 8px; min-height: 60px; font-size: 13px; min-width: 0; }
/* Panel column < .ios-phone min-width in master-skin; was clipped by overflow:hidden on #workskin */
#panel-preview #workskin {
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
  overflow-y: visible;
}
#panel-preview #workskin .ios-phone {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  max-height: min(70vh, 440px);
  min-height: 0;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}
#panel-preview #workskin .ios-phone .ios-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#panel-preview #workskin .whatsapp-chat {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  max-height: min(70vh, 440px);
  min-height: 0;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}
#panel-preview #workskin .whatsapp-chat .wa-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.panel-preview-empty { padding: 20px; text-align: center; color: var(--faint); font-size: 0.8rem; font-style: italic; }

/* ── DRAG & TURN COUNT ───────────────────────────────────────── */
.drag-handle { cursor: grab; color: var(--faint); font-size: 1rem; padding: 4px 5px; user-select: none; float: right; margin-top: -1px; opacity: 0.5; transition: opacity 0.15s; }
.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.convo-turn.dragging { opacity: 0.35; outline: 2px dashed var(--brand); border-radius: 6px; }
.turn-count-badge { font-size: 0.7rem; color: var(--faint); margin-left: 6px; font-weight: 400; text-transform: none; letter-spacing: 0; vertical-align: middle; }
.char-counter { font-size: 0.7rem; color: var(--faint); text-align: right; padding: 2px 0; }
.char-counter.char-warn { color: #b45309; font-weight: 600; }

/* ── MODAL BASE ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26,21,18,0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.ao3-insert-modal { max-width: 420px; }
.ao3-insert-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 18px;
}
.ao3-insert-modal-actions .btn-secondary { margin-right: auto; }
.modal-overlay.hidden { display: none; }
.modal-content { background: var(--surface); width: 90%; max-width: 820px; max-height: 90vh; border-radius: 10px; display: flex; flex-direction: column; border: 0.5px solid var(--border); }
.modal-header { padding: 20px 24px; border-bottom: 0.5px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header h2 { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.modal-subtitle { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* ── EXPORT MODAL ────────────────────────────────────────────── */
.export-modal { max-width: 820px; }

.import-html-modal { max-width: 520px; }
.import-html-modal-help p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 12px;
}
.import-html-modal-help p:last-of-type { margin-bottom: 0; }
.import-html-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border);
}
.import-modal-primary-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.import-modal-status {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.import-modal-status.hidden {
  display: none;
}
.export-step { border: 0.5px solid var(--border); border-radius: 8px; padding: 18px; background: var(--bg); }
.export-step.hidden { display: none; }
.export-step-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.export-step-number { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.export-step-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin: 0 0 2px; border: none; padding: 0; }
.export-step-meta { font-size: 0.75rem; color: var(--muted); margin: 0; }
.export-step-header .step-badge { margin-left: auto; flex-shrink: 0; }
.step-badge { font-size: 0.65rem; font-weight: 700; background: var(--brand); color: #fff; padding: 2px 7px; border-radius: 10px; vertical-align: middle; margin-left: 8px; letter-spacing: 0.04em; text-transform: uppercase; display: inline-block; }
.export-instructions { margin-bottom: 12px; }
.export-steps-list { margin: 0 0 6px 1.3em; padding: 0; font-size: 0.82rem; line-height: 1.8; color: var(--text); }
.export-note { font-size: 0.75rem; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.export-note.skin-version-notice { color: #92400e; background: #fffbeb; border: 0.5px solid #fcd34d; border-radius: 5px; padding: 8px 12px; margin-bottom: 10px; }
.code-box-wrap { position: relative; }
.code-box-wrap pre { background: #1a1512; color: #f0ebe5; padding: 14px; border-radius: 6px; overflow-x: auto; max-height: 240px; font-size: 0.78rem; }
.code-box-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.copy-status { font-size: 0.78rem; color: #166534; font-weight: 600; }
.skin-version-notice { background: #fffbeb; border: 0.5px solid #fcd34d; color: #92400e; padding: 10px 14px; border-radius: 5px; font-size: 0.82rem; line-height: 1.5; margin-bottom: 12px; }
.export-image-warning { margin-bottom: 0; border-radius: 5px; }

/* ── HELP MODAL ──────────────────────────────────────────────── */
.help-modal { max-width: 520px; }
.help-step-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.help-icon { font-size: 1.4rem; flex-shrink: 0; width: 36px; text-align: center; margin-top: 1px; }
.help-step-row strong { display: block; font-size: 0.88rem; margin-bottom: 4px; color: var(--text); }
.help-step-row p { font-size: 0.8rem; color: var(--muted); line-height: 1.55; margin: 0; }
.help-divider { border: none; border-top: 0.5px solid var(--border); margin: 4px 0 18px; }
.help-notes p { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.help-notes a { color: var(--brand); }
.help-data-link { font-size: 0.75rem; color: var(--muted); background: none; border: 0.5px solid var(--border); border-radius: 20px; padding: 6px 14px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.help-data-link:hover { background: var(--bg); color: var(--text); }

/* ── DATA MODAL ──────────────────────────────────────────────── */
.data-modal { max-width: 560px; }
.data-section { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 8px; margin-bottom: 10px; }
.data-section-icon { font-size: 1.3rem; flex-shrink: 0; width: 34px; text-align: center; margin-top: 1px; }
/* Only the section title is block-level; inline <strong> in body copy must stay inline */
.data-section > div:not(.data-section-icon) > strong { display: block; font-size: 0.85rem; margin-bottom: 5px; }
.data-section p { font-size: 0.78rem; line-height: 1.6; margin: 0; color: var(--muted); }
.data-good   { background: #f0fdf4; border: 0.5px solid #bbf7d0; }
.data-good   strong { color: #166534; }
.data-warn   { background: #fffbeb; border: 0.5px solid #fde68a; }
.data-warn   strong { color: #92400e; }
.data-tip    { background: #eff6ff; border: 0.5px solid #bfdbfe; }
.data-tip    strong { color: #1e40af; }
.data-future { background: #f5f3ff; border: 0.5px solid #ddd6fe; }
.data-future strong { color: #5b21b6; }
.data-future code { font-family: 'Monaco','Consolas',Courier,monospace; font-size: 0.78rem; background: #ede9fe; color: #5b21b6; padding: 1px 5px; border-radius: 3px; }
.data-list { margin: 8px 0 0 1.2em; padding: 0; font-size: 0.78rem; line-height: 1.8; color: var(--muted); }
.data-list strong { display: inline; font-size: inherit; color: #92400e; }

/* ── TOAST ───────────────────────────────────────────────────── */
.app-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px); background: #1a1512; color: #f0ebe5; padding: 10px 20px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 9999; white-space: nowrap; }
.app-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MISC ────────────────────────────────────────────────────── */
.helper-text { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }

/* Narrow / tablet */
@media (max-width: 1100px) {
  .editor-wrap { padding: 40px 32px; }
  .editor-surface { padding: 24px 16px; }
  .app-toolbar { padding: 6px 12px; }
}

@media (max-width: 900px) {
  .app-header { padding: 8px 12px; gap: 8px 12px; }
  .header-right {
    flex-basis: 100%;
    justify-content: center;
    align-content: center;
  }
  .toolbar-group-insert .toolbar-dropdown:nth-of-type(3) .dropdown-menu,
  .toolbar-group-insert .toolbar-dropdown:nth-of-type(4) .dropdown-menu {
    left: auto;
    right: 0;
  }
}

/* Mobile */
@media (max-width: 800px) {
  .toolbar-divider { display: none; }
  .app-toolbar {
    justify-content: center;
    align-items: center;
  }
  .app-toolbar > .toolbar-group {
    justify-content: center;
    align-items: center;
  }
  .editor-surface { padding: 14px; }
  .editor-wrap { padding: 28px 20px; min-height: 500px; }
  .editor-surface.panel-open { padding-right: 0; }
  .side-panel {
    width: 100%;
    max-width: none;
    z-index: 500;
    border-left: none;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  }
  .side-panel-resize-handle {
    display: none;
  }
  .modal-content { width: 95%; max-height: 95vh; }
  .text-type-dropdown .dropdown-toggle.text-type-toggle { max-width: 100%; }
}

/* ── EDITOR INTERACTIVITY AFFORDANCES ───────────────────────── */

/* Make the whole card feel clickable */
.editor-wrap { cursor: text; }

/* ProseMirror needs a text cursor too */
.ProseMirror { cursor: text; }

/* Placeholder — shown when editor is empty (TipTap adds .is-editor-empty automatically) */
.ProseMirror.is-editor-empty > p:first-child::before {
  content: 'Start writing your chapter here…';
  color: var(--faint);
  font-style: italic;
  font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'GNU Unifont', Verdana, Helvetica, sans-serif;
  pointer-events: none;
  float: left;
  height: 0;
}

/* Subtle focus ring on the page card when the editor is active */
.editor-wrap:focus-within {
  border-color: var(--border-mid);
  outline: none;
}

/* The ProseMirror div itself — make sure it fills the wrapper */
.ProseMirror {
  min-height: 600px;
  width: 100%;
}

/* ── AO3 WYSIWYG preview (export modal) ──────────────────────────── */
.ao3-preview-wrap {
  border: 1px solid var(--border-mid, #d4d4d4);
  border-radius: 6px;
  margin: 0 0 16px 0;
  background: #fff;
  overflow: hidden;
}
.ao3-preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #f6f6f6;
  border-bottom: 1px solid var(--border-mid, #d4d4d4);
}
.ao3-preview-label-note {
  color: #666;
  font-weight: normal;
  font-size: 0.85em;
}
.ao3-warning-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ao3-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #fff4e0;
  border: 1px solid #f0a000;
  border-radius: 12px;
  color: #8a4a00;
  font-size: 0.85em;
  cursor: pointer;
  font-family: inherit;
}
.ao3-warning-badge::before {
  content: "⚠";
  font-size: 1em;
}
.ao3-warning-badge:hover { background: #ffe7b8; }
.ao3-warning-badge[aria-expanded="true"] { background: #ffe7b8; }
.ao3-warning-clean {
  color: #2a7a2a;
  font-size: 0.85em;
}
.ao3-warning-detail {
  padding: 10px 14px;
  background: #fffbf0;
  border-bottom: 1px solid #f0d8a0;
  font-size: 0.85em;
  max-height: 240px;
  overflow-y: auto;
}
.ao3-warning-detail h4 {
  margin: 6px 0 4px 0;
  font-size: 0.95em;
  color: #8a4a00;
}
.ao3-warning-detail ul {
  margin: 0 0 6px 1.2em;
  padding: 0;
}
.ao3-warning-detail li {
  margin: 2px 0;
  font-family: ui-monospace, Menlo, Monaco, monospace;
  color: #333;
}
.ao3-warning-detail .ao3-warning-empty {
  color: #666;
  font-style: italic;
  font-family: inherit;
}
.ao3-preview-iframe {
  width: 100%;
  min-height: 320px;
  height: 460px;
  border: 0;
  background: #fff;
  display: block;
}
.hidden { display: none !important; }
