/* Small adaptations for the React implementation; design1.0 remains the visual source. */
.workspace-dialog.credit-purchase-modal{width:min(680px,calc(100vw - 32px))}
.credit-purchase-modal .credit-purchase-balance{margin:0 0 20px;font-size:14px;color:#333}
.credit-purchase-modal .vip-plan-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding:0 3px 3px 0}
.credit-purchase-modal .membership-purchase-card{display:flex;flex-direction:column;gap:16px;min-width:0;padding:22px 18px;border:3px solid #000;border-radius:12px;background:#fff;box-shadow:2px 2px 0 #000;text-align:start;overflow-wrap:anywhere}
.credit-purchase-modal .membership-purchase-card>b{font-size:16px}
.credit-purchase-modal .membership-purchase-card>strong{display:block;font-size:32px;line-height:1.2;margin:0}
.credit-purchase-modal .membership-purchase-card>span{font-size:13px;color:#555}
.credit-purchase-modal .membership-purchase-card .membership-buy{width:100%;margin-top:auto;white-space:normal;overflow-wrap:anywhere}
@media(max-width:520px){.credit-purchase-modal .vip-plan-options{grid-template-columns:minmax(0,1fr)}.credit-purchase-modal .dialog-body{padding:20px}.credit-purchase-modal .membership-purchase-card{padding:18px}.credit-purchase-modal .membership-purchase-card>strong{font-size:28px}}
.app-header .interface-locale-control > .ph-globe {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
/* The source language menu uses hidden; native popovers use :popover-open. */
.story-ideas-popover[popover],
.language-popover.language-menu[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
}
.language-popover.language-menu[popover]:not(:popover-open) {
  display: none;
}
.story-character-count {
  font-size: 11px;
  color: #888;
  position: fixed;
  bottom: 4px;
  right: max(32px, calc((100% - 1200px) / 2));
  z-index: 9;
}
.creation-errors:empty {
  display: none;
}
.creation-errors:not(:empty) {
  position: relative;
  z-index: 12;
  background: #fff;
  padding: 12px;
  border: 2px solid #d43020;
  border-radius: 8px;
}
.creation-errors p {
  margin: 0;
}
.workspace-catalogue-notice {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 24px;
}
.service-notice {
  padding: 12px 16px;
  background: #f8f8ef;
  border: 1px solid #e5e3ce;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
  overflow-wrap: anywhere;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.service-error {
  background: #fff5f3;
  border-color: #d43020;
  color: #a52919;
}
.service-notice .button {
  margin-inline-start: auto;
}
.service-notice.service-loading,
.workspace-dialog .service-notice.service-loading {
  background: #fff;
  color: #000;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  font-weight: 600;
  flex-wrap: nowrap;
}
.service-loading-indicator {
  box-sizing: border-box;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: service-loading-turn 1s steps(8, end) infinite;
}
.service-loading-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}
@keyframes service-loading-turn {
  to { transform: rotate(1turn); }
}
@media (prefers-reduced-motion: reduce) {
  .service-loading-indicator { animation: none; }
}
.cost-confirmation {
  display: grid;
  gap: 16px;
}
.cost-confirmation svg {
  margin: auto;
}
.workspace-menu-toggle {
  display: none;
}
.workspace-menu-links {
  display: grid;
  gap: 12px;
}
.character-status-art {
  aspect-ratio: 1;
  background: #f4f4f4;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  color: #888;
}
.character-status-art .ph {
  font-size: 32px;
}
#cast-source-popover {
  width: max-content;
  min-width: 180px;
  max-width: calc(100vw - 24px);
}
#cast-source-popover .button {
  white-space: nowrap;
}
#cast-source-popover .button > .ph {
  flex-shrink: 0;
}
.workspace-shell .creation-submit-status {
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid #e2dfc8;
  border-radius: 8px;
  background: #faf9f0;
  color: #555;
  font-size: 12px;
  line-height: 1.5;
  text-align: start;
  overflow-wrap: anywhere;
}
.workspace-shell .story-compose-actions .creation-total-cost {
  white-space: nowrap;
}
.workspace-shell .story-compose-actions .button {
  max-width: 100%;
}
@media (max-width: 620px) {
  .workspace-shell .story-entry-card.signed-in-composer .story-compose-toolbar {
    bottom: 80px;
  }
  .workspace-shell .story-entry-card.signed-in-composer .story-compose-actions {
    left: 12px;
    right: 12px;
  }
  .workspace-shell .signed-in-composer .story-compose-actions .button {
    min-width: 0;
    flex-shrink: 1;
  }
  .workspace-shell .signed-in-composer .creation-total-cost {
    flex-shrink: 0;
  }
  .workspace-shell .story-entry-card.signed-in-composer:not(.is-expanded) .story-area {
    height: 224px;
    min-height: 224px;
    max-height: 224px;
    padding-bottom: 128px;
  }
}
/* The avatar X keeps the reference image's circle and solid lower-right shadow. */
.workspace-shell .cast-slot-actions > .cast-remove-button {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 2px solid #000;
  border-radius: 50%;
  background: #fff;
  color: #000;
  box-shadow: 2px 2px 0 #000;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
}
.workspace-shell .cast-remove-button:focus-visible {
  outline: 2px dashed #000;
  outline-offset: 5px;
}
.manual-character-modal .manual-upload-placeholder {
  width: 100%;
  font: inherit;
  cursor: pointer;
  border: 2px dashed #888;
  border-radius: 12px;
  background: #fafafa;
}
.manual-character-modal .portrait-crop-stage {
  max-width: 320px;
  margin: auto;
}
.manual-character-modal .portrait-crop-stage canvas {
  touch-action: none;
}
.manual-character-modal .character-replace-image {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0;
}
.manual-character-modal .cast-dialog-fields {
  margin-top: 20px;
}
.remote-character-preview {
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
  display: block;
  margin: auto;
  border: 3px solid #000;
  border-radius: 12px;
}
.ai-price-note {
  font-size: 13px;
  color: #666;
  text-align: center;
}
.referral-hero > .ph {
  font-size: 48px;
}
.referral-hero {
  display: grid;
  gap: 20px;
  padding: 32px;
}
.google-sign-in {
  width: 100%;
  justify-content: center;
}
#toast.show {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(640px, calc(100vw - 32px));
  overflow-wrap: anywhere;
}
#toast .icon-button {
  flex-shrink: 0;
  color: inherit;
  pointer-events: auto;
}
body:has(.workspace-menu-links) .workspace-menu-toggle {
  visibility: hidden;
}
button:disabled {
  cursor: not-allowed;
}
fieldset:disabled {
  opacity: 0.65;
}
a.button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.account-table-scroll {
  overflow: auto;
}
.account-table-scroll table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.account-table-scroll th,
.account-table-scroll td {
  padding: 12px;
  text-align: start;
  border-bottom: 1px solid #ddd;
}
html[dir="rtl"] .header-actions {
  margin-inline-start: auto;
  margin-inline-end: 0;
}
@media (max-width: 767px) {
  .workspace-menu-toggle {
    display: inline-flex;
  }
  .app-header .header-actions {
    gap: 6px;
  }
  .app-header #header-earn {
    font-size: 0;
    gap: 0;
  }
  .app-header #header-earn .ph {
    font-size: 18px;
  }
}
@media (max-width: 620px) {
  /* Keep the source's visual position without covering the inspiration trigger. */
  .workspace-shell .story-entry-card .story-compose-actions {
    left: auto;
  }
  .story-character-count {
    right: 20px;
    bottom: calc(2px + env(safe-area-inset-bottom));
    font-size: 9px;
  }
  .app-header .header-actions {
    gap: 5px;
  }
  .app-header #header-earn {
    display: none;
  }
  .app-header .brand {
    font-size: 19px;
  }
  .app-header {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .app-header .header-auth.is-guest {
    padding: 0 7px !important;
  }
  .referral-hero {
    padding: 24px;
  }
  .cost-confirmation {
    font-size: 14px;
  }
  .workspace-catalogue-notice {
    padding: 0 16px;
  }
}
/* Apply the source tablet's compact spacing to Chinese headers before their
   full navigation and signed-in actions would exceed the available row. */
@media (min-width: 621px) and (max-width: 900px) {
  html[lang^="zh"] .app-header { padding-inline: 16px; gap: 10px; }
  html[lang^="zh"] .app-header .brand { font-size: 21px; }
  html[lang^="zh"] .app-header > nav { margin: 0; gap: 10px; }
  html[lang^="zh"] .app-header > nav a { font-size: 12px; }
  html[lang^="zh"] .app-header > .header-actions { gap: 6px; }
  html[lang^="zh"] .app-header .button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.account-section {
  margin-block: 24px;
  padding: 24px;
  min-width: 0;
}
.account-details {
  display: grid;
  grid-template-columns: minmax(100px, 0.35fr) minmax(0, 1fr);
  gap: 12px 24px;
  font-size: 14px;
}
.account-details dt {
  color: #888;
}
.account-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.membership-status-summary p{margin:6px 0}
.membership-group>a{display:inline-flex;align-items:center;gap:6px;text-decoration:none}
.payment-confirmation{min-width:0}
.payment-confirmation>p{font-size:14px;line-height:1.8}
.payment-confirmation .account-details{margin:0 0 20px}
.payment-confirmation .account-details dt,.payment-receipt .account-details dt{min-width:0;overflow-wrap:anywhere}
.payment-receipt{margin:20px 0;min-width:0}
.payment-receipt h2{font-size:20px;line-height:1.5}
.payment-receipt .account-details{margin:16px 0}
.creation-balance-summary{font-variant-numeric:tabular-nums}

/* Count menus follow their labels instead of dividing a fixed-width panel. */
.story-settings-popover.count-settings-popover{width:max-content;min-width:0;max-width:calc(100vw - 24px);padding:16px}
.count-settings-popover .quick-setting-options{grid-template-columns:repeat(3,max-content)}
.count-settings-popover .quick-setting-options>.button{width:auto;min-width:max-content;min-height:44px;padding:8px 12px;white-space:nowrap}
@media(max-width:600px){.count-settings-popover .quick-setting-options{grid-template-columns:repeat(2,max-content)}}
@media(max-width:480px){
 .payment-confirmation .account-details,.payment-receipt .account-details{grid-template-columns:minmax(80px,.4fr) minmax(0,1fr);gap:10px 12px}
 .payment-confirmation-modal .dialog-actions{flex-wrap:wrap}
}
.ledger-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-block: 16px;
}
.ledger-scroll table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.ledger-scroll th,
.ledger-scroll td {
  padding: 12px;
  text-align: start;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
}
.account-section .empty-state {
  min-height: 150px;
  padding: 20px;
}
section[aria-busy="true"] {
  pointer-events: none;
}

/* The prototype scopes dialogs to #dialog. React can stack login over a form,
   so its equivalent scope is a class rather than a duplicate document ID. */
.workspace-dialog{box-sizing:border-box;width:min(560px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:0;border:3px solid #000;border-radius:12px;background:#fff;color:#333;box-shadow:4px 4px 0 #000;overflow:auto}
.workspace-dialog::backdrop{background:rgb(0 0 0 / 70%);backdrop-filter:blur(3px)}
.workspace-dialog .dialog-body{padding:28px;max-height:calc(100dvh - 38px);overflow:auto}
.workspace-dialog .dialog-top{display:flex;justify-content:space-between;gap:20px;margin-bottom:24px;align-items:flex-start}
.workspace-dialog .dialog-top h2{font-size:24px;line-height:1.4;font-weight:600;margin:0;overflow-wrap:anywhere}
.workspace-dialog .dialog-top .icon-button{flex:0 0 36px;width:36px;height:36px;padding:0;font-size:20px;border-radius:8px;box-shadow:2px 2px 0 #000}
.workspace-dialog .dialog-body>p{font-size:14px;line-height:1.8;color:#333;margin:0 0 20px}
.workspace-dialog label,.workspace-dialog .field-label-row,.workspace-dialog .ai-role-style-label{font-size:14px;color:#333}
.workspace-dialog .micro,.workspace-dialog .manual-character-note{font-size:12px;line-height:1.8;color:#888}
.workspace-dialog .field-error{font-size:12px;color:#d43020}
.workspace-dialog .dialog-actions{position:sticky;bottom:-28px;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;background:#fff;margin:24px 0 0;padding:16px 0 28px;box-shadow:0 -8px 0 #fff;border:0}
.workspace-dialog .dialog-actions:empty{display:none}
.workspace-dialog .button{font-size:14px;min-height:44px;padding:10px 16px;border:3px solid #000;border-radius:8px;box-shadow:2px 2px 0 #000}
.workspace-dialog .button:disabled{background:#eee;color:#888;box-shadow:none}
.workspace-dialog .button.primary:not(:disabled){background:var(--brand,#EEF200);color:#000}
.workspace-dialog :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),textarea,select){font-size:14px;box-shadow:2px 2px 0 #000}
.workspace-dialog .cast-dialog-fields :is(input,select):focus{border-color:#000;outline:3px solid #0098e4;outline-offset:4px}
.workspace-dialog [aria-invalid=true]{outline:2px solid #d43020;outline-offset:3px}
/* Resolved AI layout from ai-character-shared.css, using the React scope. */
.workspace-dialog.ai-character-modal{width:min(560px,calc(100vw - 32px));height:fit-content;max-height:calc(100dvh - 32px);overflow:hidden}
.workspace-dialog.ai-character-modal .dialog-body{height:auto;display:flex;flex-direction:column;gap:14px;max-height:calc(100dvh - 38px);overflow-y:auto;padding:0 20px 20px}
.workspace-dialog.ai-character-modal .dialog-top{position:relative;flex:0 0 46px;height:46px;min-height:46px;margin:0 0 16px;align-items:center;background:#fff}
.workspace-dialog.ai-character-modal .dialog-top h2{font-size:24px;line-height:34px}
.workspace-dialog.ai-character-modal .ai-role-layout{display:block;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 4px 6px}
.workspace-dialog.ai-character-modal .dialog-body:has(.ai-role-layout){overflow:hidden}
.workspace-dialog.ai-character-modal .ai-role-form{display:block;height:auto;max-height:none;min-width:0;border:0;padding:0 10px 4px 0;margin:0;overflow:visible}
.workspace-dialog.ai-character-modal .ai-role-fields{display:grid;grid-template-columns:minmax(0,1fr) 160px;align-items:start;gap:12px;margin:0 0 16px}
.workspace-dialog.ai-character-modal .ai-role-name-field{min-width:0}
.workspace-dialog.ai-character-modal .ai-role-name-hint{display:block;margin-top:6px;color:#626262;font-size:12px;font-weight:400;line-height:1.5;overflow-wrap:anywhere}
.workspace-dialog.ai-character-modal .ai-role-select{position:relative;display:block;margin-top:8px}
.workspace-dialog.ai-character-modal .ai-role-select #ai-role-gender{margin-top:0;padding-inline-end:36px;appearance:none;-webkit-appearance:none;background-image:none}
.workspace-dialog.ai-character-modal .ai-role-select>.ph-caret-down{position:absolute;inset-inline-end:12px;top:50%;transform:translateY(-50%);font-size:18px;line-height:1;color:#111;pointer-events:none}
.workspace-dialog.ai-character-modal .ai-role-select:has(select:disabled)>.ph-caret-down{color:#888}
.workspace-dialog.ai-character-modal label{font-size:14px;font-weight:600;line-height:22px}
.workspace-dialog.ai-character-modal :is(input,select){width:100%;height:44px;margin-top:8px;padding:8px 10px;background:#fff;color:#333;border:3px solid #000;border-radius:8px;font:inherit;font-size:14px}
.workspace-dialog.ai-character-modal .field-label-row{margin:0 0 8px}
.workspace-dialog.ai-character-modal .ai-role-prompt-wrap{position:relative}
.workspace-dialog.ai-character-modal #ai-role-prompt{display:block;width:100%;height:148px;min-height:148px;margin:0;padding:12px 12px 34px;resize:none;border:3px solid #000;border-radius:8px;background:#fff;color:#333;font:inherit;font-size:14px;line-height:1.6}
.workspace-dialog.ai-character-modal #ai-role-count{position:absolute;right:12px;bottom:10px;font-size:12px;line-height:18px;color:#888;pointer-events:none}
.workspace-dialog.ai-character-modal .ai-role-style-label{display:block;font-size:14px;font-weight:600;margin-bottom:8px}
.workspace-dialog.ai-character-modal .ai-role-styles{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));justify-content:start;align-items:start;gap:12px;padding:4px}
.workspace-dialog.ai-character-modal .ai-role-style-card{min-width:0;padding:0;border:0!important;border-radius:8px;background:transparent!important;color:#333!important;box-shadow:none!important;font:inherit}
.workspace-dialog.ai-character-modal .ai-role-style-card img{width:100%;height:auto;aspect-ratio:1;object-fit:cover;display:block;border:3px solid #000;border-radius:8px;box-shadow:2px 2px #000}
.workspace-dialog.ai-character-modal .ai-role-style-card span{display:block;margin-top:8px;font-size:12px;line-height:18px;text-align:center}
.workspace-dialog.ai-character-modal .ai-role-style-card.selected img{border:6px solid #eef200;outline:3px solid #000;outline-offset:-3px;box-shadow:none}
.workspace-dialog.ai-character-modal .ai-role-style-card.selected span{font-weight:600;background:#eef200;border-radius:4px}
.workspace-dialog.ai-character-modal .ai-role-result{width:100%;max-width:100%;min-height:0;text-align:center}
.workspace-dialog.ai-character-modal .ai-role-portrait{height:min(360px,42dvh);width:100%;overflow:hidden;border:3px solid #000;border-radius:12px;background:#f5f5f5}
.workspace-dialog.ai-character-modal .ai-role-portrait img{height:100%;width:100%;object-fit:contain}
.workspace-dialog.ai-character-modal .ai-role-caption{color:#333;font-size:16px}
.workspace-dialog.ai-character-modal .dialog-actions{position:static;display:flex;flex:0 0 auto;flex-wrap:wrap;gap:10px;width:100%;margin:0;padding:12px 0 0;background:#fff;box-shadow:none}
.workspace-dialog.ai-character-modal :is(.service-notice,.ai-price-note){flex:0 0 auto}
.workspace-dialog.ai-character-modal .dialog-actions>.button{flex:1}
@media(max-width:620px){
 .workspace-dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overscroll-behavior:contain}
 .workspace-dialog .dialog-body{padding:16px}
 .workspace-dialog .dialog-top h2{font-size:20px}
 .workspace-dialog .dialog-actions{bottom:-16px;padding-bottom:calc(16px + env(safe-area-inset-bottom));gap:10px}
 .workspace-dialog .dialog-actions>.button{flex:1;white-space:normal}
 .workspace-dialog :is(input,textarea,select){font-size:16px}
 .workspace-dialog.ai-character-modal .dialog-body{padding:16px}
 .workspace-dialog.ai-character-modal .dialog-top h2{font-size:20px}
 .workspace-dialog.ai-character-modal .dialog-actions{position:static;padding:12px 0 0;bottom:auto}
 .workspace-dialog .cast-dialog-fields>label>input:not([type=checkbox]),.workspace-dialog .cast-dialog-fields>label>select{height:48px;min-height:48px;padding-top:0;padding-bottom:0;font-size:14px;line-height:normal;margin-top:9px}
 .workspace-dialog .portrait-crop{margin:12px auto;max-width:100%}
 .workspace-dialog .portrait-crop-stage{width:clamp(180px,34dvh,240px);height:auto;aspect-ratio:1}
 .workspace-dialog .portrait-crop>p{margin:8px 0;font-size:11px}
}
@media(max-width:540px){.workspace-dialog.ai-character-modal .ai-role-styles{grid-template-columns:repeat(auto-fill,80px)}}
@media(max-width:440px){.workspace-dialog.ai-character-modal .ai-role-fields{grid-template-columns:1fr}}

/* Character picker scope alias; geometry follows design1.0. */
.workspace-dialog:has(.cast-library-picker){width:min(640px,calc(100vw - 32px));padding:0;overflow:hidden}
.workspace-dialog:has(.cast-library-picker) .dialog-body{display:flex;flex-direction:column;max-height:calc(100dvh - 38px);padding:28px;overflow:hidden}
.workspace-dialog:has(.cast-library-picker) .dialog-top{margin-bottom:8px;align-items:center}
.workspace-dialog:has(.cast-library-picker) .cast-library-intro{margin:0 0 22px;color:#626262;font-size:14px}
/* Match the composer's circular cast slots; selection belongs to the portrait. */
.workspace-dialog .cast-library-picker{display:grid;grid-template-columns:repeat(3,minmax(0,160px));align-items:start;gap:24px 32px;margin:0;padding:5px 5px 9px;overflow-y:auto;min-height:0;max-height:400px;overscroll-behavior:contain}
.workspace-dialog .cast-library-option{display:flex;flex-direction:column;align-items:center;gap:12px;min-width:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;color:#000;transition:none}
.workspace-dialog .cast-library-option:hover:not(:disabled),.workspace-dialog .cast-library-option[aria-pressed="true"]{background:transparent;box-shadow:none;transform:none}
.workspace-dialog .cast-library-option:focus-visible{outline:2px dashed #000;outline-offset:4px;border-radius:8px}
.workspace-dialog .cast-library-portrait{position:relative;display:block;width:100%;aspect-ratio:1}
.workspace-dialog .cast-library-avatar{display:block;width:100%;height:100%;border:3px solid #000;border-radius:50%;overflow:hidden;background:#edf1ed;box-shadow:2px 2px 0 #000}
.workspace-dialog .cast-library-avatar img{display:block;position:static;width:100%;height:100%;max-height:none;max-width:100%;object-fit:cover;border-radius:50%}
.workspace-dialog .cast-library-check{position:absolute;right:0;top:0;display:grid;place-items:center;width:30px;height:30px;border:2px solid #000;background:#fff;border-radius:50%;box-shadow:2px 2px 0 #000;color:#000}
.workspace-dialog .cast-library-option[aria-pressed="true"] .cast-library-check{background:#eef200}
.workspace-dialog .cast-library-check .ph{font-size:18px;font-weight:bold}
.workspace-dialog .cast-library-option strong{font-size:15px;font-weight:600;line-height:1.5;max-width:100%;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.workspace-dialog .cast-library-option:disabled{opacity:.45;cursor:not-allowed}
.workspace-dialog .cast-library-option[data-in-story]{opacity:1;color:#888}
.workspace-dialog .cast-library-option[data-in-story] .cast-library-avatar{border-color:#aaa;background:#eee;box-shadow:2px 2px 0 #aaa}
.workspace-dialog .cast-library-option[data-in-story] .cast-library-avatar img{filter:grayscale(1);opacity:.4}
.workspace-dialog .cast-library-used{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;place-items:center;width:48px;height:48px;border:3px solid #000;border-radius:50%;background:#eef200;color:#fff;box-shadow:4px 4px 0 #000;pointer-events:none}
.workspace-dialog .cast-library-used .ph{font-size:28px;font-weight:900;line-height:1;text-shadow:-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000,2px 2px 0 #000}
.workspace-dialog:has(.cast-library-picker) .dialog-actions{position:static;flex:0 0 auto;margin:22px 0 0;padding:18px 0 0;border-top:1px solid #e9e9e3;box-shadow:none;gap:12px;flex-wrap:nowrap;background:white}
.workspace-dialog .cast-library-summary{margin-right:auto;font-size:12px;color:#626262;line-height:1.5}
/* An empty library is a starting point, rather than an alert with a disabled selection. */
.workspace-dialog.cast-library-is-empty .dialog-body{overflow-y:auto}
.workspace-dialog .cast-library-picker[data-empty]{display:block;max-height:none;padding:0;overflow:visible}
.workspace-dialog .cast-picker-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;min-height:310px;padding:22px 16px 12px;text-align:center}
.workspace-dialog .cast-picker-empty-art{display:grid;place-items:center;flex-shrink:0;width:88px;height:88px;margin-bottom:22px;border:3px solid #000;border-radius:50%;background:var(--brand,#EEF200);box-shadow:3px 3px 0 #000;color:#000}
.workspace-dialog .cast-picker-empty-art>.ph{font-size:46px;line-height:1}
.workspace-dialog .cast-picker-empty h3{margin:0;color:#111;font-size:22px;font-weight:700;line-height:1.5;overflow-wrap:anywhere}
.workspace-dialog .cast-picker-empty>p{max-width:340px;margin:10px 0 24px;color:#626262;font-size:14px;line-height:1.75}
.workspace-dialog .cast-picker-empty-actions{display:flex;flex-direction:column;align-items:center;gap:10px;max-width:100%}
.workspace-dialog .cast-picker-empty-actions>.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:180px;min-height:48px;max-width:100%;padding:12px 22px;white-space:normal;overflow-wrap:anywhere}
html body .workspace-dialog .cast-picker-empty-back{display:inline-flex;align-items:center;justify-content:center;min-height:44px;max-width:100%;padding:8px 12px;border:0;border-radius:6px;box-shadow:none;background:none;color:#626262;font:inherit;font-size:13px;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.workspace-dialog .cast-picker-empty-back:focus-visible{outline:2px solid #000;outline-offset:2px}
@media(max-height:560px){.workspace-dialog .cast-picker-empty{min-height:220px;padding-block:10px}.workspace-dialog .cast-picker-empty-art{width:64px;height:64px;margin-bottom:14px}.workspace-dialog .cast-picker-empty-art>.ph{font-size:36px}.workspace-dialog .cast-picker-empty>p{margin-bottom:16px}}
.workspace-dialog:has(.cast-library-picker) .dialog-actions .button{white-space:nowrap}
@media(max-width:620px){
 .workspace-dialog:has(.cast-library-picker){width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
 .workspace-dialog:has(.cast-library-picker) .dialog-body{padding:20px;max-height:calc(100dvh - 30px)}
 .workspace-dialog:has(.cast-library-picker) .dialog-top h2{font-size:21px}
 .workspace-dialog:has(.cast-library-picker) .cast-library-intro{font-size:13px;margin-bottom:18px}
 .workspace-dialog .cast-library-picker{grid-template-columns:repeat(2,minmax(0,160px));gap:24px 20px;max-height:45dvh}
 .workspace-dialog .cast-library-check{top:-2px;right:-2px;width:28px;height:28px}
 .workspace-dialog .cast-library-used{width:42px;height:42px;box-shadow:3px 3px 0 #000}
 .workspace-dialog .cast-library-used .ph{font-size:25px}
 .workspace-dialog:has(.cast-library-picker) .dialog-actions{display:grid;grid-template-columns:1fr 1fr;margin-top:16px;padding-top:14px;gap:10px}
 .workspace-dialog .cast-library-summary{grid-column:1/-1;margin:0 0 2px;font-size:12px}
 .workspace-dialog:has(.cast-library-picker) .dialog-actions .button{width:100%;min-width:0;padding:10px}
}

/* Character lifecycle follows the original paper cards and yellow actions. */
.character-shelf-card .character-portrait{isolation:isolate}
.character-status-art{width:100%;height:100%;font-size:14px;line-height:1.5;overflow:hidden}
.character-status-art>span:not(.character-generation-progress){font-size:14px;max-width:calc(100% - 24px);justify-self:center;overflow-wrap:anywhere}
.character-state-processing{min-height:100%;background:radial-gradient(circle at 50% 40%,#fffed4 0,transparent 55%),#f5f5ef;color:#555}
.character-state-processing>.ph{display:inline-grid;place-items:center;justify-self:center;width:62px;height:62px;border:2px solid #d6d7b5;border-radius:50%;background:#fffef0;color:#222;animation:character-sparkle 2.4s ease-in-out infinite}
.character-generation-progress{display:block;width:100px;height:5px;justify-self:center;overflow:hidden;border-radius:99px;background:#e2e3d4}
.character-generation-progress>span{display:block;width:45%;height:100%;border-radius:inherit;background:var(--brand,#eef200);animation:character-progress 1.6s ease-in-out infinite}
.character-state-failed{min-height:100%;background:repeating-linear-gradient(-45deg,#f6f5f1 0,#f6f5f1 10px,#f0efea 10px,#f0efea 11px);color:#777}
.character-state-failed>.ph{justify-self:center;width:58px;height:58px;display:grid;place-items:center;border:2px dashed #aaa99f;border-radius:50%;background:#fffdf7}
.character-retry-overlay{position:absolute;inset:0;z-index:2;display:grid;place-items:center;pointer-events:none;background:rgb(255 255 255 / 35%);opacity:0;transition:opacity .16s ease}
html:not([data-preview-device="tablet"]) .character-retry-overlay{bottom:auto;aspect-ratio:1;border-radius:50%}
.character-retry-action{pointer-events:none;display:inline-flex;align-items:center;gap:7px;min-height:44px;border:3px solid #111;border-radius:9px;background:var(--brand,#eef200)!important;color:#111!important;box-shadow:3px 3px 0 #111;transform:translateY(5px);transition:transform .16s ease}
.character-shelf-card.is-failed:has(:focus-visible) .character-retry-overlay,.character-shelf-card[data-retry-visible=true] .character-retry-overlay,.character-shelf-card.is-retrying .character-retry-overlay{opacity:1}
.character-shelf-card.is-failed:has(:focus-visible) .character-retry-action,.character-shelf-card[data-retry-visible=true] .character-retry-action,.character-shelf-card.is-retrying .character-retry-action{pointer-events:auto;transform:translateY(0)}
.character-shelf-card.is-retrying .character-retry-action .ph{animation:character-spin 1s linear infinite}
.character-shelf-card .character-delete,.character-shelf-card .character-portrait-labels{z-index:3}
@keyframes character-sparkle{50%{transform:scale(1.09) rotate(8deg)}}
@keyframes character-progress{0%{transform:translateX(-110%)}100%{transform:translateX(330%)}}
@keyframes character-spin{to{transform:rotate(360deg)}}

@media(hover:hover) and (pointer:fine){
 .character-shelf-card.is-failed:hover .character-retry-overlay{opacity:1}
 .character-shelf-card.is-failed:hover .character-retry-action{pointer-events:auto;transform:translateY(0)}
}
.character-status-art{grid-template-columns:minmax(0,1fr);justify-items:center}
.character-shelf-card.is-processing .character-portrait-edit{opacity:1;cursor:default}
.character-retry-overlay{z-index:4}
.character-shelf-card .character-portrait-labels{pointer-events:none}
@media(max-width:620px){
 .character-status-art{align-content:start;gap:4px;padding-top:10px;box-sizing:border-box}
 .character-state-processing>.ph,.character-state-failed>.ph{width:28px;height:28px;font-size:18px}
 .character-status-art>span:not(.character-generation-progress){font-size:12px;line-height:1.4}
 .character-generation-progress{display:none}
}
@media(prefers-reduced-motion:reduce){
 .character-state-processing>.ph,.character-generation-progress>span,.character-shelf-card.is-retrying .character-retry-action .ph{animation:none!important}
}

.character-retry-note{margin:12px auto 0;max-width:240px;text-align:center;font-size:12px;line-height:1.7;color:#666;overflow-wrap:anywhere}

.credit-history-filter{display:grid;gap:8px;min-width:168px;max-width:100%;font-size:14px}.credit-history-filter>span{font-weight:600}.credit-history-filter-trigger{width:100%;justify-content:space-between;gap:20px;text-align:start;background:#fff;color:#111;border:3px solid #000;border-radius:8px;box-shadow:3px 3px 0 #000}.credit-history-filter-trigger .ph{font-size:16px;flex:none}.credit-history-filter-trigger[aria-expanded=true]{background:#eef200}.credit-history-filter-menu{position:fixed;inset:auto;margin:0;padding:6px;background:#fff;color:#111;border:3px solid #000;border-radius:10px;box-shadow:4px 4px 0 #000;box-sizing:border-box;overscroll-behavior:contain}.credit-history-filter-menu [role=option]{display:flex;align-items:center;justify-content:space-between;gap:18px;width:100%;min-height:42px;padding:10px 12px;border:0;border-radius:5px;background:#fff;color:inherit;text-align:start;font:inherit;font-size:14px;line-height:1.5;cursor:pointer}.credit-history-filter-menu [role=option]:is(:hover,:focus-visible,[aria-selected=true]){background:#eef200}.credit-history-filter-menu [role=option]:focus-visible{outline:2px solid #000;outline-offset:-2px}.credit-filter-check{display:inline-flex;flex:0 0 18px;justify-content:center;font-size:18px}@media(max-width:600px){.credit-history-filter{min-width:150px}.credit-history-filter-trigger{min-height:44px}.credit-history-filter-menu [role=option]{min-height:44px}}

/* Restore the design's attached cost preview while allowing translated copy to fit. */
.workspace-shell .story-entry-card > .creation-total{height:auto;min-height:36px;max-height:none}
.workspace-shell .story-entry-card > .creation-total > strong{min-width:0;white-space:normal}
.workspace-shell .story-entry-card > .creation-total > .creation-total-cost{flex-shrink:0}
@media(max-width:620px){.workspace-shell .story-entry-card > .creation-total > strong{font-size:12px;line-height:1.2}}

/* The approved catalogue has twelve square previews on every device. */
@media (min-width:768px) {
  .workspace-shell.single-page-workflow .style-selection-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* The AI create form has one primary action; Pro denotes a native eligibility lock. */
.workspace-dialog.ai-character-modal .ai-role-generate{display:inline-flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
.workspace-dialog.ai-character-modal .ai-role-pro-badge{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border:1.5px solid #000;border-radius:6px;background:var(--brand,#EEF200);color:#000;font-size:12px;font-weight:800;line-height:18px;white-space:nowrap}
.workspace-dialog.ai-character-modal .ai-role-pro-badge>.ph{font-size:14px;color:inherit}
