/* Homepage source styles. Shared by all six homepages and standalone generators. */
@font-face { font-family:'Libre Baskerville'; src:url('/fonts/libre-baskerville-400.woff2') format('woff2'), url('/fonts/libre-baskerville-400.ttf') format('truetype'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Libre Baskerville'; src:url('/fonts/libre-baskerville-400italic.woff2') format('woff2'), url('/fonts/libre-baskerville-400italic.ttf') format('truetype'); font-weight:400; font-style:italic; font-display:swap; }
@font-face { font-family:'Libre Baskerville'; src:url('/fonts/libre-baskerville-700.woff2') format('woff2'), url('/fonts/libre-baskerville-700.ttf') format('truetype'); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:'DM Mono'; src:url('/fonts/dm-mono-300.woff2') format('woff2'), url('/fonts/dm-mono-300.ttf') format('truetype'); font-weight:300; font-style:normal; font-display:swap; }
@font-face { font-family:'DM Mono'; src:url('/fonts/dm-mono-400.woff2') format('woff2'), url('/fonts/dm-mono-400.ttf') format('truetype'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'DM Mono'; src:url('/fonts/dm-mono-500.woff2') format('woff2'), url('/fonts/dm-mono-500.ttf') format('truetype'); font-weight:500; font-style:normal; font-display:swap; }

:root {
  --bg: #fafaf8;
  --surface: #f4f0ea;
  --border: #e8e4de;
  --border-strong: #ccc8c0;
  --text: #18160f;
  --text-2: #4a463e;
  --text-3: #706b64;
  --muted: #706b64;
  --accent: #8a6830;
  --accent2: #b89860;
  --red: #a83030;
  --green: #3a7030;
  --blue: #2e5878;
  --purple: #5a4878;
  --orange: #905820;
  --ff-serif: 'Libre Baskerville', Georgia, serif;
  --ff-ui: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  }

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--ff-ui); font-size: 18px; line-height: 1.72; min-height: 100vh; -webkit-font-smoothing: antialiased; }
.app { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }

/* ── Header ── */
header { border-bottom: 1px solid var(--border); padding-bottom: 1.25rem; margin-bottom: 2rem; }
header h1 { font-family: var(--ff-ui); font-size: 1.25rem; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
header p { color: var(--text-3); font-size: 16px; margin-top: 2px; letter-spacing: 0.02em; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.tab-btn { background: transparent; color: var(--text-3); border: none; border-bottom: 2px solid transparent; padding: 9px 22px; font-family: var(--ff-ui); font-size: 16px; font-weight: 500; cursor: pointer; margin-bottom: -1px; transition: color 0.15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-state { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; opacity: 0.5; }
.tab-state[hidden] { display: none; }
.next-step { margin-top: 2rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.next-step-copy { margin: 0; color: var(--text-2); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Controls ── */
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 2rem; padding: 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; align-items: flex-end; }
#tab-generator .controls { display: flex; flex-direction: column; gap: 20px; padding: 1.5rem; align-items: stretch; }
.quick-name > label, .quick-gender legend { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 7px; }
.quick-name-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.quick-name-input { width: 100%; min-width: 0; background: #fff; color: var(--text); border: 1px solid var(--border-strong); border-radius: 4px; padding: 11px 13px; font: inherit; font-size: 16px; outline: none; }
.quick-name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent); }
.quick-name-input::placeholder { color: var(--text-3); opacity: 0.72; }
.quick-name-btn { background: var(--surface); color: var(--accent); border: 1px solid var(--border-strong); border-radius: 4px; padding: 9px 16px; font-family: var(--ff-ui); font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.quick-name-btn:hover { border-color: var(--accent); background: #fff; }
.quick-gender { border: 0; min-width: 0; }
.quick-gender .gender-radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.quick-gender .gender-radios label { position: relative; justify-content: center; padding: 9px 12px; border: 1px solid var(--border-strong); background: #fff; margin-left: -1px; }
.quick-gender .gender-radios label:first-child { margin-left: 0; border-radius: 4px 0 0 4px; }
.quick-gender .gender-radios label:last-child { border-radius: 0 4px 4px 0; }
.quick-gender .gender-radios label:has(input:checked) { z-index: 1; color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.quick-gender .gender-radios input { position: absolute; opacity: 0; pointer-events: none; }
.quick-generate { margin-top: 0; }
.customize-panel { width: 100%; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.customize-panel summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; color: var(--text); }
.customize-panel summary::-webkit-details-marker { display: none; }
.customize-icon { color: var(--accent); font-size: 20px; line-height: 1; }
.customize-copy { min-width: 0; }
.customize-title { display: block; font-size: 16px; font-weight: 600; }
.customize-hint { display: block; color: var(--text-3); font-size: 13px; line-height: 1.4; }
.customize-chevron { margin-left: auto; color: var(--text-3); transition: transform 0.18s ease; }
.customize-panel[open] .customize-chevron { transform: rotate(180deg); }
.customize-body { border-top: 1px solid var(--border); padding: 16px; background: #fff; }
.name-actions { display: flex; gap: 8px; margin-top: 8px; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.checkbox-row .checkbox-item { flex-shrink: 0; }
.section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.section-picker-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--ff-ui);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.section-picker-btn:hover { border-color: var(--accent); background: #fff; color: var(--text); }
@media (max-width: 480px) {
  .tabs { flex-wrap: nowrap; }
  .tab-btn { flex: 1 1 0; padding: 9px 4px; font-size: 14px; white-space: nowrap; }
  .doc-actions { flex-wrap: wrap; }
}
/* ── Section lock buttons (in output) ── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 1.25rem; }
.section-head .section-label { margin-bottom: 0; }
.card-look .section-head { flex-wrap: wrap; }
.card-look .card-look-roll { margin-left: auto; white-space: nowrap; padding: 6px 12px; font-size: 15px; }
.lock-btn { background: transparent; border: 1px solid var(--border); border-radius: 4px; width: 28px; height: 28px; font-size: 14px; cursor: pointer; color: var(--text-3); transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
.lock-btn:hover { border-color: var(--accent); color: var(--accent); }
.lock-btn.locked { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctrl-group { display: flex; flex-direction: column; gap: 5px; }
.ctrl-group > label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.ctrl-sections > label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 8px; display: block; }
select { background: var(--bg); color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 3px; padding: 8px 30px 8px 12px; font-family: var(--ff-ui); font-size: 16px; cursor: pointer; outline: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8475' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
select:hover { border-color: var(--accent2); }
.name-input { background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 3px; padding: 8px 12px; font-family: var(--ff-ui); font-size: 17px; outline: none; width: 140px; }
.name-input:focus { border-color: var(--accent2); }
.name-input::placeholder { color: var(--text-3); }
.name-builder { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.name-part { display: flex; align-items: center; gap: 8px; }
.name-label { font-size: 13px; color: var(--text-muted); width: 55px; flex-shrink: 0; }
.name-part-input { flex: 1; min-width: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 3px; padding: 6px 10px; font-family: var(--ff-ui); font-size: 15px; }
.name-part-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.name-refresh-btn { background: var(--surface); color: var(--accent); border: 1px solid var(--border-strong); border-radius: 3px; width: 32px; height: 32px; font-size: 16px; cursor: pointer; transition: border-color 0.15s, color 0.15s; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.name-refresh-btn:hover { border-color: var(--accent); color: var(--text); }
.name-actions { display: flex; gap: 8px; margin-top: 10px; }
.name-action-btn { background: var(--surface); color: var(--accent); border: 1px solid var(--border-strong); border-radius: 3px; padding: 6px 12px; font-family: var(--ff-ui); font-size: 14px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.name-action-btn:hover { border-color: var(--accent); color: var(--text); }
.gender-radios { display: flex; flex-direction: column; gap: 7px; }
.gender-radios label { display: flex; align-items: center; gap: 7px; font-size: 16px; color: var(--text-2); cursor: pointer; }
.gender-radios label:has(input:checked) { font-weight: 600; }
.gender-radios input[type="radio"] { accent-color: var(--accent); cursor: pointer; }
.checkboxes { display: flex; flex-direction: column; gap: 5px; }
.checkbox-item { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 16px; color: var(--text-2); user-select: none; }
.checkbox-item:has(input:checked) { font-weight: 600; }
.checkbox-item input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }
.sections-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
.spec-traits-control { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); max-width: 290px; }
.spec-traits-control > label { display: block; margin-bottom: 6px; color: var(--text-3); font-size: 13px; letter-spacing: 0.1em; font-weight: 700; text-transform: uppercase; }
.spec-traits-control[hidden] { display: none; }
.gen-btn { background: var(--accent); color: #fff; border: none; outline: none; border-radius: 4px; padding: 16px 36px; font-family: var(--ff-ui); font-size: 19px; cursor: pointer; transition: filter 0.16s; margin-top: 10px; width: 100%; }
.gen-btn:hover { filter: brightness(1.08); }
.gen-btn:focus { outline: none; }
.gen-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Output panels ── */
/* Scope homepage state without raising specificity above the wide-screen layout. */
:where(#tab-generator) #output { display: none; }
:where(#tab-generator) #output.visible { display: block; }
#rel-output { display: none; }
#rel-output.visible { display: block; }

/* ── Doc bar ── */
.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2.25rem; padding-bottom: 1rem; border-bottom: 2px solid var(--border-strong); }
.doc-name-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-name { font-size: 1.2rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
/* Save is the main button of the bar. It absorbs the free space so the name stays left and Save sits next to Export. */
.save-trigger { margin-left: auto; white-space: nowrap; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 5px; padding: 7px 16px; font-size: 16px; font-family: inherit; cursor: pointer; transition: filter 0.15s; }
.save-trigger:hover { filter: brightness(1.08); }
.save-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.save-trigger.is-saved { cursor: default; filter: none; opacity: 0.85; }
/* Simple / Detailed switch (Tomas, 2026-10-15). It takes the free space so Save and Export stay beside it on the right.
   Simple, the default, hides the explanation lines and keeps every section and value. The Big Five line
   ("Curious, creative, drawn to new things") stays: the bar alone tells nothing (Tomas, 2026-10-15). So do the
   sentences under the defense mechanism, the cognitive bias and locus of control, whose names alone tell nothing,
   and the Personality Type's "How they think" line, since the nickname is all that's left above it. */
.detail-switch { position: relative; margin-left: auto; display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; font-size: 17px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; user-select: none; }
.detail-switch + .save-trigger { margin-left: 0; }
.detail-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.detail-switch-track { position: relative; width: 50px; height: 28px; border-radius: 14px; background: var(--border-strong); transition: background 0.15s; }
.detail-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.detail-switch input:checked + .detail-switch-track { background: var(--accent); }
.detail-switch input:checked + .detail-switch-track::after { transform: translateX(22px); }
.detail-switch input:focus-visible + .detail-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .hero-rule,
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .hero-list,
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .hero-card:not(.type-card) > .hero-body,
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .psych-item:not(.psych-defense):not(.psych-bias) .psych-desc,
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .psych-blind,
html:not([data-card-detail="detailed"]) :where(#tab-generator) #output .info-val .note:not(.locus-bar + .note) { display: none; }
.tab-count { margin-left: 6px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.tab-btn.active .tab-count { color: var(--accent); }
.back-to-library { display: block; margin: 0 0 0.9rem; padding: 0; background: transparent; border: 0; color: var(--text-3); font-family: var(--ff-ui); font-size: 14px; cursor: pointer; }
.back-to-library:hover, .back-to-library:focus-visible { color: var(--accent); }

/* ── Library ── */
.library { margin-top: 0; }
.library-title { font-family: var(--ff-ui); font-size: 1rem; font-weight: 600; color: var(--text-3); margin-bottom: 0.25rem; }
.library-action { background: transparent; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 5px; padding: 5px 11px; font-size: 14px; font-family: inherit; cursor: pointer; }
.library-action:hover, .library-action:focus-visible { color: var(--text); border-color: var(--text-3); }
.library-action-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.library-action-primary:hover, .library-action-primary:focus-visible { color: #fff; border-color: var(--accent); filter: brightness(1.08); }
.library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 0.9rem; }
.library-head .library-title { margin-bottom: 0; }
.library-counter { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.library-empty { padding: 2rem 1.25rem; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.library-empty-copy { max-width: 34em; margin: 0.4rem auto 1rem; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.library-card { position: relative; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 0.6rem 0.9rem 1rem; }
.library-card:hover { border-color: var(--border-strong); }
.library-card.menu-open { z-index: 5; }
.library-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.library-card-name { margin: 0; font-family: var(--ff-ui); font-size: 1.05rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
/* The name is the link that opens the card; its ::after stretches over the whole card so a tap anywhere opens it. */
.library-card-open { background: transparent; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.library-card-open::after { content: ''; position: absolute; inset: 0; border-radius: 8px; }
.library-card-open:focus-visible { outline: none; }
.library-card-open:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.library-note-icon { position: relative; z-index: 2; display: inline-flex; align-items: center; background: transparent; border: 0; padding: 2px; color: var(--text-3); cursor: pointer; }
.library-note-icon:hover, .library-note-icon:focus-visible { color: var(--accent); }
.library-card-look { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-sync-conflict { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--orange); border-radius: 6px; font-size: 13px; color: var(--text-2); }
.library-sync-conflict-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.library-card-menu { position: relative; z-index: 2; flex: 0 0 auto; }
.library-more { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: transparent; border: 0; border-radius: 6px; color: var(--text-3); cursor: pointer; }
.library-more:hover, .library-more:focus-visible, .library-more[aria-expanded="true"] { color: var(--text); background: rgba(0,0,0,0.05); }
.library-popover { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; min-width: 180px; padding: 6px; background: #fff; border: 1px solid var(--border-strong); border-radius: 7px; box-shadow: 0 14px 36px rgba(20,14,40,0.22); }
.library-popover[hidden], .library-export-list[hidden] { display: none; }
.library-popover button { display: block; width: 100%; text-align: left; padding: 9px 10px; background: transparent; border: 0; border-radius: 4px; color: var(--text); font-family: inherit; font-size: 15px; cursor: pointer; }
.library-popover button:hover, .library-popover button:focus-visible { background: var(--surface); outline: none; }
.library-export-list { margin: 0 0 4px 10px; padding-left: 6px; border-left: 2px solid var(--border); }
.library-export-list button { font-size: 14px; }
.library-popover .library-popover-danger { color: var(--red); }
.library-edit-input, .library-edit-note { position: relative; z-index: 2; width: 100%; padding: 7px 9px; font-size: 16px; font-family: var(--ff-ui); color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 5px; }
.library-edit-note { min-height: 84px; line-height: 1.5; resize: vertical; }
.library-edit-input:focus-visible, .library-edit-note:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.library-toasts { position: fixed; left: 50%; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); }
.library-toast { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: #2a2431; color: #fff; border-radius: 6px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,0.28); }
.library-toast-undo { background: transparent; border: 0; padding: 2px 4px; color: #d8c8ff; font: inherit; font-weight: 600; cursor: pointer; }
.library-toast-undo:hover, .library-toast-undo:focus-visible { color: #fff; }
/* Phone: the shelf is one column of rows. */
@media (max-width: 640px) {
  .library-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .library-card { padding: 0.7rem 0.4rem 0.7rem 0.85rem; }
  .doc-bar { flex-wrap: wrap; }
  .doc-name-group { flex: 1 1 100%; }
}
.contact-action-danger { background: #b3261e; color: #fff; border: none; }
.contact-action-danger:hover { filter: brightness(1.08); }
.export-menu { position: relative; flex: 0 0 auto; }
.export-trigger { display: flex; align-items: center; gap: 8px; background: #fff; }
.export-trigger::after { content: '⌄'; color: var(--text-3); font-size: 13px; transition: transform 0.15s ease; }
.export-menu.open .export-trigger::after { transform: rotate(180deg); }
.export-popover { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 240px; padding: 7px; background: #fff; border: 1px solid var(--border-strong); border-radius: 7px; box-shadow: 0 14px 36px rgba(20,14,40,0.22); }
.export-popover[hidden] { display: none; }
.export-popover-title { padding: 7px 9px 5px; color: var(--text-3); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.export-option { width: 100%; display: block; text-align: left; padding: 9px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-family: inherit; cursor: pointer; }
.export-option:hover, .export-option:focus-visible { background: var(--surface); outline: none; }
.export-option-name { display: block; font-size: 15px; font-weight: 600; }
.export-option-card { border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; margin-top: 4px; padding-top: 11px; }

/* ── Sections ── */
.section { padding: 2rem 0; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: none; }
.section-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-3); margin-bottom: 1.25rem; }

/* ── Hero cards (MBTI, Enneagram) ── */
.hero-card { background: var(--surface); border-radius: 6px; padding: 1.75rem 1.75rem 1.5rem; border: 1px solid var(--border); }
.hero-kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent2); margin-bottom: 4px; }
.hero-type { font-family: var(--ff-serif); font-size: 2.75rem; font-weight: 400; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.hero-name { font-family: var(--ff-serif); font-size: 1.5rem; color: var(--text); margin-bottom: 0.5rem; font-weight: 400; }
.hero-sub { font-size: 16px; color: var(--text-2); letter-spacing: 0.03em; margin-bottom: 1.25rem; }
.hero-rule { height: 1px; background: var(--border-strong); margin-bottom: 1.25rem; }
.hero-body { font-size: 17px; line-height: 1.75; color: var(--text-2); }
.hero-body strong { color: var(--text); font-weight: 600; }
.hero-list { list-style: none; margin-top: 0.75rem; display: flex; flex-direction: column; gap: 5px; }
.hero-list li { font-size: 17px; line-height: 1.65; color: var(--text-2); padding-left: 1rem; position: relative; }
.hero-list li::before { content: '•'; position: absolute; left: 0; font-size: 1.1em; color: var(--accent); }
.hero-facts { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; }

/* ── OCEAN rows ── */
.ocean-list { display: flex; flex-direction: column; }
.ocean-row { display: grid; grid-template-columns: 11rem 1fr; align-items: center; gap: 4px 14px; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.ocean-row:last-child { border-bottom: none; }
.ocean-name { font-size: 17px; font-weight: 500; color: var(--text); }
.ocean-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.ocean-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.ocean-lbl { font-size: 16px; color: var(--text); font-weight: 600; }
.ocean-tip { grid-column: 2 / -1; font-size: 15px; color: var(--text-2); line-height: 1.5; padding-bottom: 4px; padding-left: 0.9rem; position: relative; }
.ocean-tip::before { content: '•'; position: absolute; left: 0; color: var(--accent); }

/* ── Spectrums ── */
.spectrums { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem 3rem; }
.spectrum-group-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin-bottom: 0.4rem; }
.spectrum-row { display: flex; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--border); gap: 1rem; font-size: 17px; }
.spectrum-row:last-child { border-bottom: none; }
.spectrum-trait { color: var(--text-3); min-width: 9rem; flex-shrink: 0; }
.spectrum-value { color: var(--text); font-weight: 600; border-left: 1px solid var(--border-strong); padding-left: 1rem; }

/* ── Psychology ── */
.psych-grid { columns: 2; column-gap: 2.5rem; }
.psych-item { break-inside: avoid; margin-bottom: 1.5rem; }
.psych-lbl { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.psych-attach .psych-lbl { color: var(--blue); }
.psych-lie .psych-lbl { color: var(--red); }
.psych-defense .psych-lbl { color: var(--purple); }
.psych-bias .psych-lbl { color: var(--orange); }
.psych-val { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.psych-desc { font-size: 16px; color: var(--text-2); line-height: 1.6; padding-top: 0.4rem; margin-top: 0.4rem; padding-left: 0.9rem; position: relative; }
.psych-desc::before { content: '•'; position: absolute; left: 0; color: var(--accent); }
.psych-desc-split { margin-top: 6px; padding-top: 0; color: var(--text-2); font-size: 16px; line-height: 1.6; padding-left: 0.9rem; position: relative; }
.psych-desc-split::before { content: '•'; position: absolute; left: 0; color: var(--accent); }
.psych-blind { font-size: 15px; color: var(--accent); margin-top: 6px; }

/* ── Character info rows ── */
.info-rows { display: flex; flex-direction: column; }
.info-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.info-row:last-child { border-bottom: none; }
.info-key { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); padding-top: 2px; }
.info-val { font-size: 17px; color: var(--text); line-height: 1.65; }
.info-val strong { font-weight: 600; }
.info-val .note { display: block; font-size: 16px; color: var(--text-2); margin-top: 4px; line-height: 1.6; padding-left: 0.9rem; position: relative; }
.info-val .note::before { content: '•'; position: absolute; left: 0; color: var(--accent); }
.info-val .tell { display: block; font-size: 15px; color: var(--accent); margin-top: 4px; }

/* ── Locus of control ── */
.locus-bar { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.locus-track { flex: 1; min-width: 64px; height: 3px; background: var(--border); border-radius: 2px; position: relative; overflow: visible; }
.locus-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.locus-end { font-size: 14px; color: var(--text-3); white-space: normal; line-height: 1.3; flex: 0 1 auto; max-width: 38%; hyphens: auto; }
.character-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.character-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1.1rem 1.2rem; }
.character-card.wide { grid-column: 1 / -1; }
.character-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.11em; color: var(--accent); margin-bottom: 0.45rem; }
.character-name { font-family: var(--ff-serif); font-size: 1.3rem; line-height: 1.2; color: var(--text); margin-bottom: 0.55rem; }
.character-copy { font-size: 16px; color: var(--text-2); line-height: 1.68; }
.character-copy + .character-copy { margin-top: 0.55rem; }
.character-callout { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border); font-size: 15px; color: var(--accent); line-height: 1.6; }
.character-callout strong { color: var(--text); font-weight: 600; }
.character-mini { font-size: 22px; font-weight: 600; color: var(--text); line-height: 1.2; }
.character-axis { margin-top: 0.8rem; }
.value-stack { display: flex; flex-direction: column; gap: 0.95rem; }
.value-item + .value-item { padding-top: 0.95rem; border-top: 1px solid var(--border); }
.value-item .character-name { font-size: 1.15rem; margin-bottom: 0.35rem; }
.priorities-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.2rem; }
.priority-row { display: flex; gap: 0.75rem; align-items: baseline; }
.priority-num { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); min-width: 1.7rem; }
.priority-text { font-size: 17px; color: var(--text); line-height: 1.5; }

/* ── Actions ── */
.doc-actions { display: flex; gap: 8px; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 5px; padding: 7px 16px; font-size: 16px; cursor: pointer; font-family: inherit; }
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

/* ── Appearance tab ── */
.appearance-controls { display: flex; flex-direction: column; gap: 20px; padding: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.appearance-control-label { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 7px; }
.app-setting-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.app-setting-row button { min-width: 0; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 0; background: #fff; cursor: pointer; color: var(--text-3); font-family: var(--ff-ui); font-size: 15px; margin-left: -1px; }
.app-setting-row button:first-child { margin-left: 0; border-radius: 4px 0 0 4px; }
.app-setting-row button:last-child { border-radius: 0 4px 4px 0; }
.app-setting-row button.on { position: relative; z-index: 1; color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.appearance-name-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.appearance-name-row .quick-name-input { min-width: 0; }
.appearance-field-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr); gap: 14px; }
.appearance-field-grid select, .appearance-field-grid .name-input { width: 100%; min-height: 46px; background-color: #fff; }
.appearance-more { border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.appearance-more summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; color: var(--text-2); font-size: 15px; font-weight: 600; }
.appearance-more summary::-webkit-details-marker { display: none; }
.appearance-more summary::before { content: '☷'; color: var(--accent); font-size: 18px; }
.appearance-more summary::after { content: '⌄'; margin-left: auto; color: var(--text-3); transition: transform 0.18s; }
.appearance-more[open] summary::after { transform: rotate(180deg); }
.appearance-more-body { padding: 14px; border-top: 1px solid var(--border); background: #fff; }
.appearance-result { margin-top: 2rem; }
.appearance-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.appearance-result-grid .section { padding: 1.5rem 0; }
.appearance-result-grid .section-label { margin-bottom: 0.75rem; }
.appearance-result-grid .spectrum-row { border-bottom: 1px solid var(--border); padding: 5px 0; }
.appearance-result-grid .spectrum-row:last-child { border-bottom: 0; }
.app-rows .spectrum-row { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.app-rows .spectrum-trait { opacity: .7; white-space: nowrap; }
.app-rows .spectrum-value { text-align: right; }

/* ── Relationships tab ── */
.char-inputs { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.char-input { display: flex; flex-direction: column; gap: 5px; }
.char-input label { font-size: 16px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.char-input input { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 3px; padding: 8px 11px; font-family: var(--ff-ui); font-size: 17px; width: 100px; outline: none; }
.char-input input:focus { border-color: var(--accent2); }
.add-btn { background: transparent; color: var(--accent); border: 1px dashed var(--border-strong); border-radius: 3px; padding: 8px 16px; font-family: var(--ff-ui); font-size: 16px; cursor: pointer; }
.add-btn:hover { border-color: var(--accent); }
.remove-btn { background: transparent; color: var(--red); border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; opacity: 0.6; }
.remove-btn:hover { opacity: 1; }
.relation-card { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1.25rem; margin-bottom: 1rem; }
.relation-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.relation-pair { font-family: var(--ff-serif); font-size: 1.25rem; color: var(--text); }
.relation-type { font-size: 16px; padding: 5px 10px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.relation-type.good { background: rgba(58,112,48,0.15); color: var(--green); }
.relation-type.neutral { background: rgba(138,104,48,0.15); color: var(--accent); }
.relation-type.bad { background: rgba(168,48,48,0.15); color: var(--red); }
.direction-row { display: flex; align-items: center; gap: 8px; margin-bottom: 0.75rem; }
.direction-badge { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 3px; padding: 5px 10px; }
.direction-badge .d-name { font-size: 17px; color: var(--text); font-weight: 500; }
.direction-badge .d-role { font-size: 16px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.direction-arrow { color: var(--text-3); font-size: 18px; flex-shrink: 0; }
.relation-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1rem; }
.bar-label { font-size: 16px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: baseline; }
.bar-pct { color: var(--text); font-size: 16px; }
.bar-track { height: 4px; background: var(--border-strong); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; }
.bar-fill.comfort { background: var(--green); }
.bar-fill.friction { background: var(--red); }
.bar-fill.attraction { background: var(--purple); }
.bar-fill.growth { background: var(--blue); }
.relation-summary { font-family: var(--ff-serif); font-style: italic; color: var(--text); font-size: 19px; line-height: 1.78; margin-bottom: 1rem; }
.relation-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.detail-label { font-size: 16px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 4px; }
.detail-text { font-size: 17px; color: var(--text); line-height: 1.72; }
.detail-list { list-style: none; font-size: 17px; color: var(--text); }
.detail-list li { padding: 2px 0; }
.detail-list li::before { content: "\2022"; margin-right: 6px; color: var(--text-3); }

/* ── Matrix ── */
.matrix-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.matrix-table th, .matrix-table td { padding: 8px; text-align: center; border: 1px solid var(--border); }
.matrix-table th { background: var(--surface); color: var(--text-3); font-weight: normal; text-transform: uppercase; letter-spacing: 0.05em; }
.matrix-table td { background: #fff; }
.matrix-table .self { background: var(--surface); color: var(--text-3); }
.matrix-table .good { color: var(--green); }
.matrix-table .bad { color: var(--red); }

/* ── Footer ── */
.site-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.site-footer a { color: var(--text-3); text-decoration: none; font-size: 16px; letter-spacing: 0.05em; text-transform: uppercase; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.footer-btn { background: transparent; color: var(--text-3); border: none; padding: 0; font-family: inherit; font-size: 16px; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.footer-btn:hover { color: var(--text); text-decoration: underline; }

/* ── Generators footer ── */
.generators-footer { text-align: center; margin-top: 0.75rem; }
.generators-toggle { background: transparent; border: none; color: var(--text-3); font-family: var(--ff-ui); font-size: 14px; letter-spacing: 0.05em; cursor: pointer; padding: 4px 0; }
.generators-toggle:hover { color: var(--text); }
.generators-arrow { display: inline-block; transition: transform 0.2s; font-size: 11px; }
.generators-footer.open .generators-arrow { transform: rotate(90deg); }
.generators-grid { display: none; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 0.75rem; }
.generators-footer.open .generators-grid { display: grid; }
.generators-grid a { color: var(--accent); text-decoration: none; font-size: 14px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 3px; background: #fff; transition: border-color 0.15s; }
.generators-grid a:hover { border-color: var(--accent); }

/* ── Spectrum picker ── */
.spec-group { margin-bottom: 1rem; }
.spec-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.4rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.spec-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.spec-name { font-size: 13px; color: var(--text-2); min-width: 100px; flex-shrink: 0; }
.spec-select { flex: 1; font-size: 13px; padding: 5px 24px 5px 8px; }

/* ── Contact modal ── */
.contact-modal[hidden] { display: none; }
.contact-modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 1.2rem; background: rgba(8,7,6,0.72); backdrop-filter: blur(6px); }
.contact-dialog { width: min(100%, 460px); padding: 1.2rem; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,0.12); }
.contact-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 0.85rem; }
.contact-title { font-family: var(--ff-ui); font-size: 1.1rem; font-weight: 600; color: var(--text); }
.contact-sub { margin-top: 4px; color: var(--text-2); font-size: 16px; line-height: 1.7; }
.contact-close { background: transparent; border: 1px solid var(--border-strong); color: var(--text-3); width: 34px; height: 34px; border-radius: 5px; font-size: 20px; cursor: pointer; }
.contact-close:hover { color: var(--text); border-color: var(--text-3); }
.contact-address { margin: 0.95rem 0 1rem; padding: 0.8rem 0.95rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.contact-label { display: block; margin-bottom: 5px; color: var(--accent); font-size: 16px; letter-spacing: 0.11em; text-transform: uppercase; }
.contact-email { color: var(--text); font-size: 19px; word-break: break-word; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-action { display: inline-flex; align-items: center; justify-content: center; min-width: 142px; padding: 0.75rem 1rem; border-radius: 6px; text-decoration: none; font-family: var(--ff-ui); font-size: 18px; font-weight: 600; cursor: pointer; transition: filter 0.15s; }
.contact-action:hover { filter: brightness(1.05); }
.contact-action-primary { background: var(--accent); color: #fff; border: none; }
.contact-action-secondary { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

/* -- Picker modal -- */
.picker-dialog { width: min(100%, 680px); max-height: 80vh; display: flex; flex-direction: column; }
.picker-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.picker-choice {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.picker-choice:hover { border-color: var(--accent); background: #fff; transform: translateY(-1px); }
.picker-choice.active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(138,104,48,0.15);
}
.picker-choice-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.picker-choice-meta {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-actions[hidden] { display: none; }
.picker-note {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}
.picker-search { width: 100%; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--border-strong); border-radius: 3px; font-family: var(--ff-ui); font-size: 15px; background: var(--bg); color: var(--text); outline: none; }
.picker-search:focus { border-color: var(--accent2); }
.picker-search[hidden] { display: none; }
.ocean-editor { display: flex; flex-direction: column; gap: 10px; }
.ocean-slider-row {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.ocean-slider-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  align-items: baseline;
}
.ocean-slider-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ocean-slider-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}
.ocean-slider {
  width: 100%;
  accent-color: var(--accent);
}
.ocean-slider-help {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}

/* ── Supporting content ── */

/* ── Responsive ── */
@media (max-width: 620px) {
  #tab-generator .controls { gap: 16px; padding: 1rem; overflow: hidden; }
  .quick-name-row { grid-template-columns: 1fr; }
  .quick-name-btn { width: 100%; }
  .name-builder { max-width: 280px; }
  .type-selects-row { flex-direction: column; }
  .type-selects-row select { min-width: 100%; }
  .sections-grid { grid-template-columns: 1fr; }
  .checkbox-row { flex-wrap: wrap; gap: 4px; }
  .checkbox-row .section-actions { width: 100%; justify-content: flex-start; }
  .section-picker-btn { width: auto; }
  .relation-bars { grid-template-columns: repeat(2, 1fr); }
  .relation-details { grid-template-columns: 1fr; }
  .char-inputs { flex-direction: column; }
  .picker-grid { grid-template-columns: minmax(0, 1fr); }
  .char-input input { width: 80px; font-size: 15px; padding: 6px 8px; }
  .gen-btn { padding: 14px 28px; font-size: 17px; max-width: 100%; box-sizing: border-box; }
  .appearance-controls { padding: 1rem; gap: 16px; }
  .appearance-name-row, .appearance-field-grid { grid-template-columns: 1fr; }
  .appearance-name-row .quick-name-btn { width: 100%; }
  .appearance-result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .psych-grid { columns: 1; }
  .spectrums { grid-template-columns: 1fr; }
  .ocean-row { grid-template-columns: 1fr auto; gap: 2px 8px; }
  .ocean-name { font-size: 15px; }
  .ocean-lbl { font-size: 14px; }
  .ocean-track { grid-column: 1 / -1; }
  .ocean-tip { grid-column: 1 / -1; }
  .character-grid { grid-template-columns: 1fr; }
  .info-row { grid-template-columns: 1fr; gap: 4px; }
  .doc-bar { align-items: center; gap: 10px; }
  .doc-name { min-width: 0; font-size: 1rem; }
  /* Phone: the switch shares the name row; Save and Export get the row below, in every language. */
  .doc-bar::after { content: ''; order: 2; flex-basis: 100%; }
  .doc-name-group { flex: 1 1 0; }
  .detail-switch { order: 1; }
  .save-trigger, .export-menu { order: 3; }
  .detail-switch + .save-trigger { margin-left: auto; }
  .export-popover { width: min(310px, calc(100vw - 70px)); }
}


/* ── Language switch ── */
.lang-switch { display: flex; justify-content: flex-end; gap: 6px; font-size: 15px; font-weight: 600; letter-spacing: 0.05em; margin-bottom: 0.5rem; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif; } .lang-switch a, .lang-switch span { font-family: inherit; }
.translation-notice { max-width: 760px; margin: 0 auto 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 4px; background: rgba(255,255,255,0.72); color: var(--text-3); font-size: 13px; line-height: 1.5; text-align: center; }
.lang-switch a { color: var(--text-3); text-decoration: none; padding: 2px 6px; border-radius: 3px; }
.lang-switch a:hover { color: var(--accent); }
.lang-active { color: var(--accent); background: var(--surface); padding: 2px 6px; border-radius: 3px; }
