:root {
  color-scheme: dark;
  --bg: #101214;
  --bg-raised: #171a1d;
  --panel: #1a1d20;
  --panel-soft: #202428;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #edf0f1;
  --muted: #8f979c;
  --dim: #626b71;
  --accent: #f49a38;
  --accent-soft: rgba(244, 154, 56, .12);
  --cyan: #6ed7d5;
  --danger: #e87570;
  --sans: "Roboto Condensed", "Segoe UI", sans-serif;
  --display: "Rajdhani", "Roboto Condensed", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 80% 0, rgba(51, 63, 69, .2), transparent 46%),
    linear-gradient(135deg, #111416, #0c0e10 72%);
  font: 15px/1.5 var(--sans);
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.app-frame { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 clamp(18px, 4vw, 60px);
  background: rgba(15, 17, 19, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 6px;
}
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font: 700 18px var(--display); letter-spacing: .1em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.brand-divider { padding: 0 4px; color: var(--accent); }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; letter-spacing: .15em; }
.status-dot { width: 7px; height: 7px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 9px rgba(110, 215, 213, .5); }

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
  width: min(1480px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 42px) 42px;
}
.sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100vh - 124px);
  min-height: 440px;
  padding: 20px 16px 14px;
  background: rgba(24, 27, 30, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .2);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .19em; }
.sidebar-heading h1 { margin: 2px 0 0; font: 700 25px/1.1 var(--display); letter-spacing: .02em; }
.count-badge { display: grid; width: 28px; height: 28px; place-items: center; color: var(--muted); background: rgba(255, 255, 255, .045); border: 1px solid var(--line); border-radius: 50%; font-size: 11px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(255, 255, 255, .045);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.button:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .26); }
.button:active { transform: translateY(1px); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.button-primary { color: #171411; background: var(--accent); border-color: var(--accent); }
.button-primary:hover { background: #ffad55; border-color: #ffad55; }
.button-wide { width: 100%; min-height: 42px; }
.button-quiet { color: var(--muted); background: transparent; }
.button-danger { color: var(--danger); border-color: rgba(232, 117, 112, .25); }
.button-danger:hover { background: rgba(232, 117, 112, .1); border-color: rgba(232, 117, 112, .45); }
.button-small { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.button-symbol { color: var(--accent); font-size: 17px; line-height: 1; }

.search-field { display: flex; align-items: center; gap: 8px; height: 37px; margin: 19px 0 12px; padding: 0 9px; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); border-radius: 4px; }
.search-icon { color: var(--dim); font-size: 19px; transform: rotate(-18deg); }
.search-field input { min-width: 0; flex: 1; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 12px; }
.search-field input::placeholder { color: var(--dim); }
.search-field kbd { padding: 1px 5px; color: var(--dim); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 3px; font-size: 10px; }
.profile-search-row { display: flex; align-items: center; gap: 12px; margin: 0 0 15px; }
.profile-search-field { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 0 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.profile-search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.profile-search-field > span { font-size: 19px; }
.profile-search-field input { width: 100%; min-width: 0; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 12px; }
.profile-search-field input::placeholder { color: var(--dim); }
.profile-search-count { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.profile-search-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.profile-search-results[hidden], #profile-content[hidden] { display: none; }
.profile-search-hit { display: grid; align-content: start; gap: 6px; min-width: 0; }
.profile-search-hit > .eyebrow { padding-left: 3px; }
.profile-search-hit > .section-card { height: 100%; }
.character-list { flex: 1; min-height: 0; margin: 0 -4px; padding: 0 4px; overflow-y: auto; list-style: none; }
.character-list li + li { margin-top: 5px; }
.character-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 9px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.character-item:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.character-item[aria-current="true"] { background: var(--accent-soft); border-color: rgba(244,154,56,.34); }
.character-avatar {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  color: var(--accent);
  background: #24292d;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 700 15px var(--display);
}
.character-avatar img { width: 100%; height: 100%; object-fit: cover; }
.character-summary { display: grid; min-width: 0; }
.character-summary strong { overflow: hidden; color: #e6e9ea; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.character-summary small { overflow: hidden; margin-top: 1px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.character-summary .roster-faction, .faction-inline { color: var(--faction-color); }
.identity-copy .faction-inline { font-weight: 700; }
.affiliation-name { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; vertical-align: middle; }
.affiliation-logo { flex: 0 0 auto; width: 24px; height: 24px; max-width: 24px; max-height: 24px; object-fit: contain; vertical-align: middle; }
.affiliation-separator { flex: 0 0 auto; margin: 0 5px; color: var(--dim); }
.affiliation-summary { display: inline-flex; max-width: 100%; flex-wrap: wrap; align-items: center; gap: 3px 0; }
.info-cell .affiliation-name { display: inline-flex; }
.info-cell .affiliation-name > span { display: inline; }
.empty-roster { margin: 17px 4px; color: var(--dim); font-size: 12px; line-height: 1.7; }
.sidebar-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-footer .button { padding-right: 5px; padding-left: 5px; font-size: 11px; }
.sidebar-footer > span { grid-column: 1 / -1; padding-top: 4px; color: var(--dim); font-size: 10px; text-align: center; }

.profile-view { min-width: 0; }
.welcome-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 560px;
  margin-top: 4px;
  padding: clamp(28px, 6vw, 76px);
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(24, 28, 31, .96), rgba(21, 24, 27, .78)),
    radial-gradient(circle at 85% 38%, rgba(244,154,56,.14), transparent 28%);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.welcome-panel::after {
  position: absolute;
  right: -48px;
  bottom: -140px;
  width: 410px;
  height: 410px;
  border: 1px solid rgba(244,154,56,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(244,154,56,.025), 0 0 0 72px rgba(244,154,56,.018);
  content: "";
  pointer-events: none;
}
.welcome-symbol { display: grid; width: 46px; height: 46px; margin-bottom: 28px; place-items: center; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(244,154,56,.22); border-radius: 50%; font-size: 21px; }
.welcome-panel h2 { max-width: 620px; margin: 8px 0 10px; font: 700 clamp(42px, 7vw, 74px)/.95 var(--display); letter-spacing: -.025em; }
.welcome-panel p { max-width: 425px; margin: 0 0 24px; color: var(--muted); font-size: 15px; }
.welcome-meta { display: flex; align-items: center; gap: 10px; margin-top: 58px; color: var(--dim); font-size: 9px; letter-spacing: .16em; }
.welcome-meta span:first-child { color: var(--accent); }
.welcome-meta i { width: 35px; height: 1px; background: var(--line-strong); }

.profile-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 208px;
  margin: 4px 0 16px;
  padding: 25px 28px;
  overflow: hidden;
  background: linear-gradient(110deg, #22272a, #181b1e 72%);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.profile-header::after { position: absolute; top: -90px; right: 21%; width: 230px; height: 380px; border: 1px solid rgba(255,255,255,.035); transform: rotate(34deg); content: ""; pointer-events: none; }
.identity { display: flex; align-items: center; min-width: 0; gap: 20px; }
.avatar-frame { position: relative; flex: 0 0 112px; width: 112px; height: 112px; overflow: hidden; background: #111416; border: 1px solid var(--line-strong); border-radius: 5px; }
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: var(--accent); background: linear-gradient(145deg, #292e32, #171a1d); font: 700 41px var(--display); }
.identity-copy { min-width: 0; }
.identity-copy h2 { margin: 2px 0 1px; overflow-wrap: anywhere; font: 700 clamp(32px, 4vw, 49px)/1 var(--display); letter-spacing: .015em; }
.identity-copy .occupation-line { display: grid; gap: 2px; margin: 4px 0 9px; color: var(--accent); font-size: 13px; }
.identity-copy .identity-meta { display: flex; flex-wrap: wrap; gap: 5px 16px; color: var(--muted); font-size: 11px; }
.identity-meta span { white-space: nowrap; }
.profile-actions { z-index: 1; display: flex; align-self: start; gap: 7px; }
.profile-index { position: absolute; right: 28px; bottom: 17px; color: rgba(255,255,255,.13); font: 700 49px/.8 var(--display); letter-spacing: .08em; pointer-events: none; }
.section-nav { display: flex; gap: 6px; margin-bottom: 16px; padding: 0 1px 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.section-nav a { flex: 0 0 auto; padding: 6px 9px; color: var(--muted); border-radius: 3px; font-size: 11px; text-decoration: none; white-space: nowrap; }
.section-nav a:hover { color: var(--text); background: rgba(255,255,255,.06); }

.profile-top-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 14px; margin-bottom: 14px; }
.profile-affiliation-column { display: grid; min-width: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-affiliation-column .section-card { height: 100%; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; }
.section-card { min-width: 0; padding: 17px; background: rgba(25,28,31,.91); border: 1px solid var(--line); border-radius: 6px; }
.section-card.span-two { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h3 { margin: 0; font: 700 21px/1 var(--display); letter-spacing: .045em; text-transform: uppercase; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-heading .eyebrow { display: block; margin-bottom: 5px; }
.section-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.section-count { display: inline-flex; min-width: 23px; height: 23px; align-items: center; justify-content: center; padding: 0 6px; color: var(--muted); background: rgba(255,255,255,.05); border-radius: 12px; font-size: 10px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.info-cell { min-width: 0; min-height: 52px; padding: 9px 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.045); border-radius: 4px; }
.info-cell small { display: block; margin-bottom: 3px; color: var(--dim); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.info-cell span { display: block; overflow-wrap: anywhere; color: #e1e5e6; font-size: 12px; }
.faction-display { display: flex !important; align-items: center; gap: 7px; }
.info-cell .faction-name { color: var(--faction-color); font-weight: 700; }
.relationship-subsection { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.relationship-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.relationship-heading h4 { margin: 0; color: var(--muted); font: 700 15px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.relationship-list { display: grid; gap: 6px; }
.relationship-entry { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 5px 8px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.045); border-radius: 4px; font-size: 12px; }
.relationship-entry > span:first-child { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.relationship-entry strong { color: var(--muted); font-weight: 600; }
.relationship-name { color: #e1e5e6; }
.relationship-romantic strong, .relationship-romantic .relationship-name { color: #f08ab5; }
.relationship-empty { margin: 0; }
.prose-block { color: #d1d6d8; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.prose-block.is-empty { color: var(--dim); font-style: italic; }
.record-list, .milestone-list, .outfit-list { display: grid; gap: 8px; }
.tattoo-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.tattoo-card { display: flex; flex-direction: column; }
.tattoo-card .record-content { display: flex; flex-direction: column; height: 100%; }
.tattoo-card .record-image { width: 100%; max-width: 380px; max-height: 240px; margin-top: auto; padding-top: 8px; object-fit: cover; border-radius: 4px; }
.data-card { position: relative; min-width: 0; padding: 11px 12px; background: rgba(255,255,255,.026); border: 1px solid rgba(255,255,255,.055); border-radius: 4px; }
.data-card h4 { margin: 0 0 4px; overflow-wrap: anywhere; color: #e7eaeb; font-size: 13px; font-weight: 600; }
.data-card p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-image { display: block; width: 100%; max-height: 150px; margin-top: 9px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
[data-image-preview] { cursor: zoom-in; }
[data-image-preview]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.image-preview { position: fixed; z-index: 8; top: 50%; left: 50%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; width: min(560px, 84vw); height: min(620px, 76vh); margin: 0; padding: 12px; overflow: hidden; color: var(--text); background: rgba(20, 23, 25, .98); border: 1px solid var(--line-strong); border-radius: 5px; box-shadow: 0 18px 60px rgba(0,0,0,.65); opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, -47%) scale(.97); transition: opacity .14s ease, transform .14s ease, visibility .14s ease; }
.image-preview.visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.image-preview img { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: rgba(0,0,0,.22); }
.image-preview figcaption { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.data-card .data-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: var(--dim); font-size: 10px; }
.card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: .72; }
.card-actions .icon-button { width: 25px; height: 25px; }
.record-content { padding-right: 54px; }
.empty-section { padding: 17px 12px; color: var(--dim); border: 1px dashed rgba(255,255,255,.09); border-radius: 4px; font-size: 11px; text-align: center; }
.pill { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; color: var(--cyan); background: rgba(110,215,213,.08); border: 1px solid rgba(110,215,213,.15); border-radius: 12px; font-size: 9px; }
.subsection + .subsection { margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--line); }
.subsection-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.subsection-title h4 { margin: 0; color: #cbd0d2; font: 700 16px var(--display); letter-spacing: .06em; text-transform: uppercase; }
.outfit-area { padding: 10px; background: rgba(0,0,0,.13); border: 1px solid rgba(255,255,255,.045); border-radius: 4px; }
.outfit-area + .outfit-area { margin-top: 7px; }
.outfit-area-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.outfit-area-header strong { color: #e0e4e5; font-size: 12px; }
.outfit-area-header small { margin-left: 6px; color: var(--dim); font-size: 10px; }
.outfit-slot { display: grid; grid-template-columns: minmax(70px, .35fr) minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.055); }
.outfit-slot:first-child { border-top: 0; }
.outfit-slot .slot-name { color: var(--accent); font-size: 10px; font-weight: 700; }
.outfit-slot .slot-description { color: #bdc4c6; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.milestone-item { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 10px; background: rgba(255,255,255,.026); border-left: 2px solid var(--accent); }
.milestone-date { color: var(--accent); font-size: 10px; font-weight: 700; }
.milestone-description { color: #d3d8d9; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.animation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.animation-card { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 70px; padding: 9px 10px; background: rgba(255,255,255,.026); border: 1px solid rgba(255,255,255,.055); border-radius: 4px; }
.animation-card .animation-copy { flex: 1; min-width: 0; }
.animation-image { flex: 0 0 66px; width: 66px; max-height: 62px; padding: 3px; object-fit: contain; background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: 3px; }
.animation-card h4 { margin: 0; overflow-wrap: anywhere; color: #e7eaeb; font-size: 13px; }
.animation-card p { margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.animation-favorite { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 21px; line-height: 1; }
.animation-favorite:hover, .animation-favorite.is-favorite { color: var(--accent); }
.animation-category { display: inline-flex; margin-top: 3px; padding: 1px 6px; color: var(--cyan); background: rgba(110,215,213,.07); border: 1px solid rgba(110,215,213,.13); border-radius: 10px; font-size: 9px; }
.empty-copy { color: var(--dim); font-size: 12px; font-style: italic; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 17px; padding: 13px 2px; color: var(--dim); border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .06em; }
.site-footer strong { color: var(--muted); font-weight: 500; }
.site-footer a { color: var(--accent); text-decoration-color: rgba(244,154,56,.45); text-underline-offset: 2px; }
.site-footer a:hover { color: #ffb35f; text-decoration-color: currentColor; }

.icon-button { display: inline-grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 17px; line-height: 1; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.06); border-color: var(--line); }
.icon-button.danger:hover { color: var(--danger); background: rgba(232,117,112,.08); border-color: rgba(232,117,112,.2); }
.editor-dialog { width: min(530px, calc(100% - 28px)); max-height: min(88vh, 780px); padding: 0; color: var(--text); background: #1b1f22; border: 1px solid var(--line-strong); border-radius: 7px; box-shadow: 0 28px 100px rgba(0,0,0,.72); }
.editor-dialog::backdrop { background: rgba(4,6,7,.78); backdrop-filter: blur(3px); }
.editor-form { padding: 23px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 3px 0 0; font: 700 27px var(--display); }
.dialog-fields { display: grid; gap: 12px; max-height: calc(88vh - 160px); padding: 17px 2px 6px; overflow-y: auto; }
.form-field { display: grid; gap: 5px; }
.form-field label { color: #c5cbcd; font-size: 11px; font-weight: 600; }
.form-field input, .form-field textarea, .form-field select { width: 100%; min-height: 39px; padding: 9px 10px; color: var(--text); background: #111416; border: 1px solid var(--line-strong); border-radius: 4px; }
.form-field input[type="color"] { width: 54px; min-height: 38px; padding: 4px; cursor: pointer; }
.form-field input[type="file"] { min-height: 38px; padding: 6px; cursor: pointer; }
.file-input-label { margin-top: 7px; }
.current-image-preview { margin-top: 7px; }
.form-image-preview { display: block; width: min(180px, 100%); height: 100px; object-fit: contain; background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: 3px; }
.remove-image-option { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; }
.remove-image-option input { width: auto; min-height: 0; margin: 0; }
.form-field textarea { min-height: 82px; resize: vertical; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--dim); }
.field-hint { color: var(--dim); font-size: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 36px)); padding: 11px 15px; color: var(--text); background: #252b2e; border: 1px solid var(--line-strong); border-left: 3px solid var(--cyan); border-radius: 4px; box-shadow: 0 10px 36px rgba(0,0,0,.35); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(9px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-left-color: var(--danger); }
.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; }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 225px minmax(0, 1fr); gap: 14px; padding-right: 14px; padding-left: 14px; }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .profile-header { grid-template-columns: minmax(0,1fr); }
  .profile-actions { position: absolute; top: 15px; right: 14px; }
  .avatar-frame { flex-basis: 94px; width: 94px; height: 94px; }
  .identity { padding-right: 62px; }
}
@media (max-width: 680px) {
  .topbar { min-height: 64px; padding: 0 15px; }
  .topbar-status { font-size: 0; }
  .workspace { display: flex; flex-direction: column; min-height: calc(100vh - 64px); padding: 12px 12px 28px; }
  .sidebar { position: static; width: 100%; height: auto; min-height: 0; padding: 13px; }
  .sidebar-heading { margin-bottom: 11px; }
  .search-field { margin: 11px 0 9px; }
  .character-list { display: flex; gap: 6px; max-height: 100px; margin: 0; padding: 0 0 4px; overflow-x: auto; overflow-y: hidden; }
  .character-list li { flex: 0 0 160px; margin: 0 !important; }
  .empty-roster { margin: 8px 2px; }
  .sidebar-footer { grid-template-columns: 1fr 1fr; margin-top: 9px; padding-top: 8px; }
  .sidebar-footer > span { display: none; }
  .welcome-panel { min-height: 400px; padding: 28px; }
  .welcome-meta { margin-top: 38px; }
  .profile-header { min-height: 0; margin-top: 0; padding: 18px 15px; }
  .identity { align-items: flex-start; gap: 12px; padding-right: 0; padding-top: 38px; }
  .avatar-frame { flex-basis: 72px; width: 72px; height: 72px; }
  .avatar-placeholder { font-size: 30px; }
  .identity-copy h2 { font-size: clamp(27px, 8vw, 40px); }
  .identity-copy .identity-meta { gap: 3px 10px; font-size: 10px; }
  .profile-actions { top: 10px; right: 8px; }
  .profile-top-grid, .section-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-search-results, .animation-list { grid-template-columns: minmax(0, 1fr); }
  .profile-affiliation-column { grid-template-rows: auto; }
  .profile-affiliation-column .section-card { height: auto; }
  .section-card.span-two { grid-column: auto; }
  .section-grid { grid-template-columns: minmax(0, 1fr); }
  .section-nav { gap: 2px; }
  .section-nav a { padding: 6px 7px; font-size: 10px; }
  .section-card { padding: 14px; }
  .milestone-item { grid-template-columns: 72px minmax(0,1fr) auto; gap: 7px; }
  .outfit-slot { grid-template-columns: 66px minmax(0,1fr) auto; gap: 6px; }
  .site-footer { flex-direction: column; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
