:root {
  color-scheme: light;
  --paper: #fbf9f4;
  --surface: #fffdf9;
  --ink: #35263f;
  --muted: #6d6172;
  --plum: #533765;
  --plum-dark: #40264f;
  --lavender: #f0e9f4;
  --line: #e7dfe7;
  --gold: #926122;
  --side: 232px;
  --sans: "Dalbit Sans", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --serif: "Dalbit Serif", "Maru Buri", "Songti SC", "Batang", serif;
  font-family: var(--sans);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  font-weight: 450;
  letter-spacing: -.012em;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
body, button, input, textarea, select { font-family: var(--sans); }
body, p, h1, h2, h3, h4 { word-break: keep-all; overflow-wrap: break-word; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { text-wrap: balance; }
p { line-height: 1.65; }
button, input, textarea, select { font-size: inherit; letter-spacing: inherit; }
button { color: inherit; }
button:not(:disabled), a[href], summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid #8959a2; outline-offset: 3px; }
[hidden] { display: none !important; }
::selection { background: #e1d0eb; color: var(--plum-dark); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus-visible {
  z-index: 20;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 14px;
  clip-path: none;
  border-radius: 8px;
  background: var(--surface);
}
.icon, .button svg, .nav-item svg, .icon-button svg {
  display: inline-block;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  vertical-align: middle;
}
.muted { color: var(--muted); }

.sidebar {
  position: fixed;
  z-index: 5;
  inset: 0 auto 0 0;
  width: var(--side);
  display: flex;
  flex-direction: column;
  padding: 35px 21px 24px;
  border-right: 1px solid #eee8ec;
  background: #fefcf9;
}
.brand {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 0;
  text-align: left;
  padding: 0 5px;
  background: transparent;
  text-decoration: none;
  color: var(--plum-dark);
}
.brand > :last-child { min-width: 0; }
.brand strong, .brand-title {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.055em;
  line-height: 1.22;
  white-space: nowrap;
}
.brand small, .brand-text > span, .brand-sub, .brand-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}
.brand-mark, .brand-icon, .brand > svg, .brand > span:first-child:not(:last-child) {
  display: grid;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 14px;
  background: #5d3e6a;
  color: #fff2cd;
  box-shadow: 0 3px 9px #5d3e6a29;
}
.brand-mark svg, .brand-icon svg { width: 23px; height: 23px; }
.brand > svg { padding: 10px; }
.nav { display: grid; align-content: start; gap: 7px; margin-top: 52px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 47px;
  padding: 8px 13px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
}
.nav-item:hover { background: #f5f0f5; color: var(--plum); }
.nav-item.active, .nav-item[aria-current="page"] { background: #eee5f2; color: #513762; font-weight: 720; }
.sidebar-footer {
  margin-top: auto;
  padding: 18px 5px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.sidebar-footer p { margin: 4px 0; }
.family-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 7px;
  border-radius: 5px;
  text-decoration: none;
}
.family-link:hover strong { color: var(--plum); }
.family-detail { min-width: 0; flex: 1; }
.family-detail > * { display: block; overflow-wrap: anywhere; }
.family-detail strong { color: var(--ink); font-size: 12px; font-weight: 720; }
.family-detail > span { font-size: 11px; }
.family-link > svg { width: 13px; height: 13px; margin-left: auto; }
.avatars { display: flex; align-items: center; }
.avatars > .portrait, .avatars .avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #fffdf9;
  border-radius: 50%;
  background: #eaddf0;
  color: var(--plum);
  object-fit: cover;
}
.avatars > .portrait svg { width: 15px; height: 15px; }
.avatars > * + * { margin-left: -7px; }
.local-indicator { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 11px; color: #5d6960; }
.local-indicator svg { width: 13px; height: 13px; }
.local-indicator i, .local-indicator .dot { width: 6px; height: 6px; background: #678a69; border-radius: 50%; }

.workspace {
  width: calc(100% - var(--side));
  max-width: 1270px;
  min-height: 100vh;
  margin-inline-start: max(var(--side), calc((100% + var(--side) - 1270px) / 2));
  padding: 46px clamp(26px, 4.1vw, 64px) 60px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-bottom: 25px;
}
.page-head p:not(.eyebrow) { margin-top: 8px; color: var(--muted); }
.eyebrow {
  margin-block-end: 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .055em;
  line-height: 1.35;
}
.page-title {
  font-family: var(--serif);
  font-size: clamp(37px, 4.15vw, 58px);
  font-weight: 700;
  letter-spacing: -.065em;
  line-height: 1.2;
}
.page-date {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid #e9e1e9;
  border-radius: 999px;
  background: #fffcfa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 570;
  font-variant-numeric: lining-nums tabular-nums;
}
.page-date svg { width: 15px; height: 15px; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(315px, 27vw, 380px);
  padding: clamp(28px, 4vw, 54px);
  overflow: hidden;
  border-radius: 22px;
  background: #231c33;
  color: #fffaf2;
  box-shadow: 0 14px 30px #3d264318;
}
.hero-art, .hero-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% 54%;
  background-size: cover;
  background-position: center;
}
.hero-art { z-index: -2; }
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, #21182deb 0%, #21182db8 29%, #1e16274f 58%, #1e162702 85%), linear-gradient(0deg, #120d1a73, transparent 40%);
  pointer-events: none;
}
.hero-content { width: min(52%, 490px); }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  color: #f9dda8;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .065em;
}
.hero-kicker svg { width: 14px; height: 14px; }
.hero h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.58vw, 51px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -.052em;
  color: #fffaf2;
}
.hero-content p { margin-top: 13px; font-size: 15px; line-height: 1.65; color: #f8eff6; }
.hero-content .hero-kicker { margin-top: 0; color: #f9dda8; font-size: 12px; }
.hero-index {
  position: absolute;
  right: 20px;
  bottom: 17px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #fff9;
  border-radius: 999px;
  background: #1c122779;
  color: #fffaf2;
  font-size: 11px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}
.hero-index svg { width: 13px; height: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--plum);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.button:not(:disabled):active { transform: translateY(1px); }
.button svg { width: 16px; height: 16px; }
.button.primary, .button.hero-button {
  border-color: var(--plum);
  background: var(--plum);
  color: #fffaf9;
}
.button.primary:hover:not(:disabled) { border-color: var(--plum-dark); background: var(--plum-dark); }
.button.hero-button {
  min-height: 45px;
  margin-top: 23px;
  padding-inline: 16px;
  border-color: #f9e5c0;
  background: #fae7c2;
  color: #38253e;
}
.button.hero-button:hover:not(:disabled) { background: #fff2d7; }
.button.hero-button:focus-visible { outline-color: #fff3cc; }
.button.outline { border-color: #bfaaca; background: #fffdf9c9; color: var(--plum); }
.button.outline:hover:not(:disabled) { background: #f1e8f2; }
.button.ghost { background: transparent; }
.button.ghost:hover:not(:disabled) { background: #f0e8f1; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf9;
  color: var(--plum);
}
.icon-button:hover:not(:disabled) { background: var(--lavender); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 34px 0 13px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.044em;
}
.section-aside, .text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 570; }
.section-aside svg, .text-link svg { width: 15px; height: 15px; }
.text-link { color: var(--plum); text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.section-aside:is(button) { padding: 0; border: 0; background: transparent; }
.section-aside:is(button, a):hover { color: var(--plum); text-decoration: underline; }
.episode-grid, .character-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-icon {
  display: inline-grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  margin-bottom: 11px;
  border-radius: 11px;
  background: #e5d6ec;
  color: #674578;
}
.card-icon svg { width: 20px; height: 20px; }
.quiet-label { font-size: 12px; font-weight: 650; line-height: 1.4; }
.retention-note { display: flex; align-items: center; gap: 6px; margin-top: 11px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.retention-note svg { width: 15px; height: 15px; }
.episode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.episode-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  text-decoration: none;
}
.episode-card:hover { border-color: #bca5c8; }
.episode-cover { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #483352; color: #fff6df; }
.episode-cover img { width: 100%; height: 100%; object-fit: cover; }
.episode-cover .duration-tag {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 6px;
  border-radius: 5px;
  background: #24162ac9;
  color: #fffaf5;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.cover-play {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #fffa;
  border-radius: 50%;
  background: #2f1c369e;
  color: #fffaf5;
}
.episode-card:hover .cover-play { background: #2f1c36d9; }
.cover-play svg { width: 24px; height: 24px; }
.episode-info { display: block; padding: 13px 15px 15px; }
.episode-info h3, .episode-info strong { display: block; font-size: 16px; font-weight: 740; }
.episode-info p, .episode-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.episode-info .quiet-label { display: block; margin-bottom: 4px; color: var(--muted); }
.empty-state {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 36px 24px;
  border: 1px dashed #d5c7d7;
  border-radius: 15px;
  background: #fffcf9;
  text-align: center;
  color: var(--muted);
}
.episode-grid > .empty-state, .character-grid > .empty-state { grid-column: 1 / -1; }

.character-grid { align-items: stretch; }
.portrait { position: relative; overflow: hidden; }
.character-card, .add-card, .chat-panel, .draft-panel, .settings-card, .job-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.character-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 17px;
  padding: 20px;
}
.character-card .portrait {
  display: grid;
  width: clamp(82px, 9vw, 116px);
  height: clamp(82px, 9vw, 116px);
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  background: #eadfed;
  color: var(--plum);
  object-fit: cover;
}
.portrait img { position: absolute; width: 100%; max-width: none; height: 100%; object-fit: fill; }
.portrait svg { width: 32px; height: 32px; }
.char-detail { flex: 1 1 155px; min-width: 0; }
.char-detail h2 { font-family: var(--serif); font-size: 27px; font-weight: 700; letter-spacing: -.04em; }
.char-detail p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.char-detail .button, .char-detail .button-row { margin-top: 10px; }
.add-card {
  display: grid;
  min-height: 157px;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 20px;
  border-style: dashed;
  border-color: #cab7d0;
  color: var(--plum);
  text-align: center;
}
.add-card:hover { background: #f7f0f7; }
.add-card .card-icon { margin: 0 0 4px; }
.add-card > svg { width: 27px; height: 27px; }
.add-card small, .add-card > span:not(.card-icon) { color: var(--muted); font-size: 13px; }

.chat-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(250px, 1fr); gap: 17px; align-items: start; }
.chat-panel { display: flex; flex-direction: column; min-height: 480px; padding: 18px; }
.chat-panel h2, .draft-panel h2, .settings-card h2, .job-panel h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.036em;
}
.message-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  max-height: 455px;
  min-height: 270px;
  overflow: auto;
  padding: 3px 1px 14px;
  scrollbar-color: #d0bdd9 transparent;
}
.message { display: flex; align-items: flex-start; gap: 8px; max-width: 90%; }
.message.user, .message.parent, .message[data-role="user"] { align-self: flex-end; }
.message-text {
  padding: 10px 13px;
  border-radius: 4px 12px 12px;
  background: #f3edf4;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
:is(.user, .parent, [data-role="user"]) > .message-text { border-radius: 12px 4px 12px 12px; background: var(--plum); color: #fffaf9; }
.message > svg, .message .message-avatar { flex: 0 0 auto; width: 30px; height: 30px; color: var(--plum); }
.message-avatar { display: grid; place-items: center; border-radius: 9px; background: #f3e7f3; }
.message-avatar svg { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 11px; }
.chips button, .chip {
  padding: 6px 9px;
  border: 1px solid #d5c4da;
  border-radius: 999px;
  background: #f8f1fa;
  color: var(--plum);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.chips .button { min-height: 32px; border-radius: 999px; }
.chips button:hover:not(:disabled) { background: #efe2f2; }
.chat-input { display: flex; align-items: end; gap: 8px; }
.chat-input :is(input, textarea) { flex: 1 1 auto; min-width: 0; }
.chat-input textarea { min-height: 42px; max-height: 165px; }
.send-button { min-width: 42px; min-height: 42px; flex: 0 0 auto; }
.send-button:not(.button) {
  display: grid;
  place-items: center;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--plum);
  color: #fffaf9;
}
.draft-panel { padding: 19px; background: #f7f0f9; }
.draft-panel p { color: var(--muted); font-size: 14px; }
.draft-panel > p { margin-top: 8px; }
.draft-panel .button { margin-top: 13px; }
.draft-box {
  display: block;
  min-height: 104px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #e4d9e8;
  border-radius: 10px;
  background: #fffafc;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.draft-box:empty { white-space: normal; }

.settings-card { max-width: 675px; padding: clamp(16px, 2.8vw, 27px); }
.settings-card + .settings-card { margin-top: 15px; }
.settings-card .section-head { margin: 0 0 8px; }
.settings-card > .field { width: min(185px, 100%); margin: 6px 0 18px; }
.settings-card p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.feature-options { margin: 12px 0; }
.feature-options dt { font-weight: 650; }
.feature-options dd { margin: 0; color: var(--muted); font-size: 13px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.account-card { margin-bottom: 15px; }
.settings-card .account-error { color: #8e3d44; }
.setting-row { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 9px 18px; padding: 16px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row:last-child { padding-bottom: 0; }
.setting-row h3 { font-weight: 710; font-size: 16px; }
.setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.setting-row input[type="checkbox"] { width: 19px; height: 19px; }
.setting-row .field { min-width: min(215px, 100%); }
.job-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 13px;
  margin-top: 17px;
  padding: 14px 17px;
  background: #faf3fb;
}
.job-panel > .card-icon { margin: 0; }
.job-panel h2, .job-panel h3 { font-size: 17px; }
.job-copy { color: var(--muted); font-size: 13px; line-height: 1.45; }
.job-copy strong { color: var(--ink); }
.job-copy .progress-shell { margin-top: 6px; }
.progress-number { color: var(--plum); font-size: 13px; font-variant-numeric: tabular-nums; }
.progress-shell { grid-column: 1 / -1; overflow: hidden; width: 100%; height: 6px; border-radius: 999px; background: #e6d8ea; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: #704c83; transition: width .2s ease; }
progress.progress-shell { display: block; border: 0; appearance: none; }
progress.progress-shell::-webkit-progress-bar { background: #e6d8ea; }
progress.progress-shell::-webkit-progress-value { background: #704c83; }
progress.progress-shell::-moz-progress-bar { background: #704c83; }

.modal {
  width: min(575px, calc(100vw - 30px));
  max-width: none;
  max-height: min(90vh, 850px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #ece1e9;
  border-radius: 19px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 80px #23182d38;
}
.modal:has(.video-player), .modal.video-modal { width: min(860px, calc(100vw - 30px)); }
.modal::backdrop { background: #251930a3; backdrop-filter: blur(4px); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 13px; }
.modal-header h2 { font-family: var(--serif); font-size: clamp(23px, 4vw, 29px); letter-spacing: -.04em; }
.modal-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.modal-content { padding: 1px 22px 22px; }
.modal-content > p { margin: 8px 0; }
.voice-player { display: block; width: 100%; height: 42px; }
.voice-player[hidden] { display: none; }
.video-player { display: block; width: calc(100% - 44px); max-height: 62vh; margin: 0 22px 8px; aspect-ratio: 16 / 9; border-radius: 10px; background: #20182a; }
.video-player:focus-visible { outline-offset: 2px; }
.story-thread { padding: 8px 11px; border-radius: 7px; background: #f5ebf5; color: var(--plum); }
.story-thread svg { width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; font-size: 13px; font-weight: 670; }
.field > small { color: var(--muted); font-size: 12px; font-weight: 450; }
.field.wide, .field.full, .field:has(textarea), .field:has(input[type="file"]), .form-grid .crop-editor { grid-column: 1 / -1; }
:is(input:not([type="range"], [type="checkbox"], [type="radio"]), textarea, select) {
  display: block;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d7c9db;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 470;
  line-height: 1.45;
}
textarea { resize: vertical; }
.field > :is(input, textarea, select) { width: 100%; }
input[type="file"] { padding: 5px; }
input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: var(--lavender);
  color: var(--plum);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 670;
}
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--plum); }
.crop-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 15px; margin-block: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8f2f8; }
.crop-editor > :is(img, canvas), .crop-editor .crop-preview { width: min(155px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 11px; background: #e2d5e7; }
.crop-preview { display: grid; place-items: center; color: var(--plum); touch-action: none; user-select: none; }
.crop-preview:has(img) { cursor: grab; }
.crop-preview:active:has(img) { cursor: grabbing; }
.crop-controls { display: grid; flex: 1 1 135px; gap: 5px; }
.crop-controls label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.crop-controls small { line-height: 1.55; }
.crop-controls input[type="range"] { width: 100%; min-width: 0; }
.upload-label { position: relative; overflow: hidden; cursor: pointer; }
.upload-label:focus-within { outline: 3px solid #8959a2; outline-offset: 2px; }
.upload-label input[type="file"] { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.crop-range { margin-top: 5px; }
.crop-range > span { flex: 0 0 auto; }
.button-row { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 8px; }
.modal .button-row { justify-content: flex-end; margin-top: 15px; }
.profile-buttons .danger { margin-right: auto; color: #8e3d44; }
.toast {
  position: fixed;
  z-index: 10;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: min(450px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid #e1d2e7;
  border-radius: 11px;
  background: #fcf7fd;
  color: var(--plum-dark);
  box-shadow: 0 10px 25px #37243b24;
  font-size: 14px;
  line-height: 1.45;
}
.toast:empty { display: none; }

@media (max-width: 1050px) {
  :root { --side: 200px; }
  .sidebar { padding-inline: 16px; }
  .hero h2 { font-size: clamp(30px, 4vw, 45px); }
  .hero-content { width: min(60%, 450px); }
}

@media (max-width: 850px) {
  :root { --side: 0px; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px clamp(10px, 4vw, 28px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { width: auto; gap: 8px; padding: 0; }
  .brand strong, .brand-title { font-size: 19px; }
  .brand small, .brand-text > span, .brand-sub, .brand-subtitle { display: none; }
  .brand-mark, .brand-icon, .brand > svg, .brand > span:first-child:not(:last-child) { flex-basis: 34px; width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark svg, .brand-icon svg { width: 19px; height: 19px; }
  .brand > svg { padding: 7px; }
  .nav { display: flex; align-items: center; gap: 3px; margin: 0; }
  .nav-item { gap: 5px; min-height: 38px; padding: 6px 8px; font-size: 12px; }
  .nav-item svg { width: 15px; height: 15px; }
  .sidebar-footer { display: none; }
  .workspace { min-height: calc(100vh - 59px); margin-inline: auto; padding: 34px clamp(15px, 4.5vw, 35px) 45px; }
}

@media (max-width: 690px) {
  .chat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { min-width: 280px; }
  .sidebar { display: block; padding: 8px 12px 6px; }
  .brand { min-height: 32px; margin: 0 2px 5px; }
  .nav { justify-content: space-between; gap: 4px; }
  .nav-item { flex: 1 1 auto; justify-content: center; min-height: 34px; padding-inline: 4px; }
  .page-head { align-items: start; margin-bottom: 19px; }
  .page-date { padding: 5px 8px; font-size: 11px; }
  .hero { min-height: 360px; align-items: flex-end; padding: 22px 19px 30px; border-radius: 16px; }
  .hero-content { width: min(96%, 400px); }
  .hero h2 { font-size: clamp(29px, 7.8vw, 39px); }
  .hero-art, .hero-art img { object-position: 65% 40%; }
  .hero::after { background: linear-gradient(0deg, #21182df5 1%, #21182db7 35%, #21182d51 64%, #21182d0a 100%); }
  .hero-kicker, .hero-content .hero-kicker { margin-bottom: 7px; }
  .hero-content p { margin-top: 7px; }
  .button.hero-button { min-height: 41px; margin-top: 13px; }
  .hero-index { right: 10px; bottom: 10px; padding: 4px 6px; }
  .section-head { margin-top: 28px; }
  .section-head h2 { font-size: 23px; }
  .character-grid { grid-template-columns: 1fr; }
  .episode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chat-panel { min-height: 390px; padding: 13px; }
  .message-list { min-height: 215px; }
  .modal-header { padding: 15px 14px 11px; }
  .modal-content { padding: 0 14px 15px; }
  .video-player { width: calc(100% - 28px); margin-inline: 14px; }
}

@media (max-width: 440px) {
  .crop-editor .crop-preview { margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}

.creation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 22px;
  min-height: 92px;
  margin: 0 0 22px;
  padding: 17px clamp(17px, 2.2vw, 27px);
  border: 1px solid #e5d9eb;
  border-radius: 16px;
  background: #f2ebf5;
}
.creation-bar h2 { font-family: var(--serif); font-size: 21px; line-height: 1.25; }
.creation-bar p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.creation-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.creation-actions .button { min-height: 43px; white-space: nowrap; }
.offline-note {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--lavender);
  color: var(--plum-dark);
  font-size: 14px;
}
.playback-save-status {
  color: var(--plum);
  font-size: 13px;
  font-weight: 700;
}
@media (max-width: 660px) {
  .creation-bar { align-items: start; flex-direction: column; }
}
@media (max-width: 360px) {
  .creation-actions { width: 100%; }
  .creation-actions .button { justify-content: center; width: 100%; }
}
@media (max-width: 760px) {
  .sidebar { padding-top: calc(8px + env(safe-area-inset-top)); }
  .workspace { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
