:root {
  --paper: #f3eee5;
  --paper-2: #e8dece;
  --sheet: #fffaf1;
  --ink: #16130f;
  --ink-2: #2f2a22;
  --muted: #766d60;
  --line: #d5c7b6;
  --line-dark: #16130f;
  --red: #a13434;
  --teal: #214f45;
  --blue: #394a61;
  --gold: #c79a55;
  --radius: 8px;
  --shadow: 0 26px 70px rgba(32, 25, 18, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 19, 15, 0.045) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(180deg, #f8f3eb 0, var(--paper) 520px, #ede4d7 100%),
    var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(250px, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 100px;
  padding: 18px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line-dark);
  background: rgba(243, 238, 229, 0.92);
  backdrop-filter: blur(18px);
}

.brand-slogan {
  display: grid;
  justify-self: start;
  align-content: center;
  gap: 5px;
  min-width: 0;
  max-width: 440px;
  padding: 7px 0 7px 22px;
  border-left: 2px solid var(--gold);
  text-align: left;
}

.brand-slogan strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 24px;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-slogan span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 68px;
  border: 1px solid var(--line-dark);
  color: var(--sheet);
  background: var(--ink);
  box-shadow: 8px 8px 0 var(--gold);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 35px;
  line-height: 1;
}

.cat-face {
  --cat-bg: var(--sheet);
  --cat-ink: var(--ink);
  position: relative;
  display: inline-block;
  width: 34px;
  height: 30px;
  border-radius: 46% 46% 42% 42%;
  background: var(--cat-bg);
}

.cat-face::before,
.cat-face::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 15px;
  height: 16px;
  background: var(--cat-bg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.cat-face::before {
  left: 1px;
  transform: rotate(-18deg);
}

.cat-face::after {
  right: 1px;
  transform: rotate(18deg);
}

.cat-face i {
  position: absolute;
  inset: 0;
  display: block;
}

.cat-face i::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 12px;
  width: 4px;
  height: 5px;
  border-radius: 50%;
  background: var(--cat-ink);
  box-shadow: 12px 0 0 var(--cat-ink);
}

.cat-face i::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 19px;
  width: 5px;
  height: 4px;
  border-radius: 50%;
  background: var(--cat-ink);
}

.cat-face.mini {
  width: 23px;
  height: 21px;
}

.cat-face.mini::before,
.cat-face.mini::after {
  top: -6px;
  width: 10px;
  height: 11px;
}

.cat-face.mini i::before {
  left: 6px;
  top: 8px;
  width: 3px;
  height: 4px;
  box-shadow: 8px 0 0 var(--cat-ink);
}

.cat-face.mini i::after {
  left: 10px;
  top: 14px;
  width: 4px;
  height: 3px;
}

.kicker,
.eyebrow,
.rail-label {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 4vw, 62px);
  line-height: 0.92;
}

h2 {
  font-size: clamp(38px, 5vw, 78px);
  line-height: 0.98;
}

h3 {
  font-size: 20px;
  line-height: 1.25;
}

.top-actions,
.action-row,
.story-controls,
.page-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.top-actions {
  justify-self: end;
}

.login-entry {
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--sheet);
  background: var(--ink);
  font-weight: 900;
}

.account-host {
  position: relative;
}

.notification-host {
  position: relative;
  display: flex;
  align-items: center;
}

.notification-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--ink);
  background: var(--sheet);
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.notification-trigger:hover,
.notification-trigger[aria-expanded="true"] {
  border-color: var(--red);
  color: var(--red);
  background: color-mix(in srgb, var(--red) 7%, var(--sheet));
}

.notification-trigger:active {
  transform: translateY(1px);
}

.notification-trigger svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 2px solid var(--sheet);
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 58;
  width: min(430px, calc(100vw - 28px));
  border: 1px solid var(--ui-border, var(--line-dark));
  border-radius: var(--ui-radius-modal, var(--radius));
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--sheet));
  box-shadow: var(--ui-shadow-float, 0 24px 70px rgba(12, 9, 6, 0.28));
  overflow: hidden;
}

.notification-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--ui-border, var(--line));
}

.notification-popover-head p {
  margin: 0 0 3px;
  color: var(--ui-primary, var(--red));
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.notification-popover-head h2 {
  margin: 0;
  font-family: var(--ui-font-serif, "SimSun", "Songti SC", serif);
  font-size: 26px;
  line-height: 1.15;
}

.notification-popover-head > div:first-child > span {
  display: block;
  margin-top: 5px;
  color: var(--ui-text-muted, var(--muted));
  font-size: 12px;
}

.notification-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.notification-head-actions button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 8px;
  color: var(--ui-text-secondary, var(--muted));
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.notification-head-actions button:hover:not(:disabled) {
  border-color: var(--ui-primary, var(--red));
  color: var(--ui-primary, var(--red));
}

.notification-head-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.notification-head-actions .notification-close {
  width: 34px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.system-message-list {
  max-height: min(480px, calc(100dvh - 200px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--ui-border-strong, #b7aa9c) transparent;
  scrollbar-width: thin;
}

.system-message-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 18px 20px;
  border: 0;
  border-bottom: 1px solid var(--ui-border, var(--line));
  border-radius: 0;
  color: var(--ui-text, var(--ink));
  background: transparent;
  font: inherit;
  text-align: left;
}

button.system-message-item:hover {
  background: color-mix(in srgb, var(--ui-primary, var(--red)) 8%, var(--ui-surface, var(--sheet)));
}

.system-message-item.unread {
  background: color-mix(in srgb, var(--ui-primary, var(--red)) 5%, var(--ui-surface, var(--sheet)));
}

.system-message-item.read {
  color: var(--ui-text-secondary, var(--muted));
}

.system-message-dot {
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--ui-border-strong, #aa9f93);
}

.system-message-item.unread .system-message-dot {
  background: var(--ui-primary, var(--red));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary, var(--red)) 12%, transparent);
}

.system-message-copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.system-message-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.system-message-title-row strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-message-title-row small {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--ui-primary, var(--red));
  background: color-mix(in srgb, var(--ui-primary, var(--red)) 11%, transparent);
  font-size: 10px;
  font-weight: 900;
}

.system-message-content {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.system-message-copy time {
  color: var(--ui-text-muted, #8f877d);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.system-message-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 230px;
  padding: 30px;
  color: var(--ui-text-muted, var(--muted));
  text-align: center;
}

.system-message-state strong {
  margin-top: 10px;
  color: var(--ui-text, var(--ink));
  font-size: 16px;
}

.system-message-state span {
  max-width: 280px;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.65;
}

.system-message-state button {
  min-height: 38px;
  margin-top: 16px;
  padding: 7px 16px;
  border: 1px solid var(--ui-primary, var(--red));
  border-radius: 999px;
  color: var(--ui-primary, var(--red));
  background: transparent;
  font-weight: 800;
}

.system-message-state.loading i {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ui-border, var(--line));
  border-top-color: var(--ui-primary, var(--red));
  border-radius: 50%;
  animation: system-message-spin 760ms linear infinite;
}

.system-message-state.error strong {
  color: var(--ui-error, var(--red));
}

@keyframes system-message-spin {
  to { transform: rotate(360deg); }
}

.account-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--ink);
  background: var(--sheet);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--sheet);
  background: var(--red);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 20px;
  font-weight: 700;
}

.account-avatar.cat-avatar {
  color: transparent;
}

.account-avatar.cat-avatar .cat-face {
  --cat-bg: var(--sheet);
  --cat-ink: var(--red);
}

.account-avatar.large {
  width: 52px;
  height: 52px;
  font-size: 26px;
}

.account-balance {
  display: grid;
  min-width: 36px;
  text-align: left;
  line-height: 1.05;
}

.account-balance b {
  font-size: 14px;
}

.account-balance small {
  color: var(--muted);
  font-size: 10px;
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 55;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100dvh - 132px);
  padding: 18px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  color: var(--sheet);
  background: #191714;
  box-shadow: 0 24px 70px rgba(12, 9, 6, 0.34);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #70675d #24211e;
  scrollbar-width: thin;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.account-popover::-webkit-scrollbar {
  width: 8px;
}

.account-popover::-webkit-scrollbar-track {
  background: #24211e;
}

.account-popover::-webkit-scrollbar-thumb {
  border: 2px solid #24211e;
  border-radius: 999px;
  background: #70675d;
}

.account-host:hover .account-popover,
.account-host:focus-within .account-popover,
.account-popover.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.account-profile {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
}

.account-profile > .account-avatar {
  grid-column: 1;
  grid-row: 1 / 4;
}

.account-identity,
.member-status-block {
  display: contents;
}

.account-profile #accountName {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile #accountPhone {
  grid-column: 2;
  grid-row: 2;
  color: #aaa195;
  font-size: 12px;
}

.account-profile .account-public-id {
  grid-column: 2;
  grid-row: 3;
  color: #c9bfb2;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}

.member-badge {
  padding: 4px 7px;
  border: 1px solid #716a61;
  border-radius: 4px;
  color: #d6cdc1;
  font-size: 11px;
  font-weight: 900;
}

.member-badge.active {
  border-color: var(--gold);
  color: #f1ce8f;
}

.account-profile .member-status-block .member-badge {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  color: #d6cdc1;
  font-size: 11px;
}

.account-profile .member-status-block .member-badge.active {
  color: #f1ce8f;
}

.member-expiry {
  grid-column: 3;
  grid-row: 3;
  justify-self: end;
  padding: 4px 7px;
  border: 1px solid rgba(208, 160, 82, 0.46);
  border-radius: 4px;
  color: #f2cc82;
  background: rgba(208, 160, 82, 0.1);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.account-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 12px;
}

.account-quick-actions button {
  width: 100%;
  min-height: 40px;
}

.account-popover .ghost-btn {
  border-color: #776f65;
  color: var(--sheet);
  background: #292622;
}

.balance-panel {
  padding: 14px;
  border: 1px solid #39342e;
  border-radius: var(--radius);
  background: #24211e;
}

.balance-panel div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.balance-panel strong {
  color: #f0c873;
  font-size: 26px;
}

.balance-panel small {
  display: block;
  margin-top: 5px;
  color: #aaa195;
}

.account-menu-list {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid #39342e;
}

.account-menu-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 8px 3px;
  border: 0;
  border-bottom: 1px solid #302c28;
  color: var(--sheet);
  background: transparent;
  text-align: left;
}

.account-menu-list button:hover {
  color: #f0c873;
}

.account-menu-list small {
  color: #8f877d;
}

.mode-strip {
  position: sticky;
  top: 100px;
  z-index: 35;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  background: rgba(248, 243, 235, 0.94);
  backdrop-filter: blur(18px);
}

.mode-strip-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 0;
}

.mode-family {
  position: relative;
  display: grid;
  grid-template-rows: 34px 1fr;
  min-width: 0;
  border-right: 1px solid var(--line-dark);
}

.mode-family:last-child {
  border-right: 0;
}

.mode-family-label {
  display: grid;
  place-items: center;
  color: #7e2929;
  background: #eee0d8;
  font-size: 16px;
  font-weight: 900;
}

.drama-family .mode-family-label {
  color: #1f584f;
  background: #dfe9e4;
}

.mode-family-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drama-family .mode-family-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 22px);
  min-height: 68px;
  padding: 10px clamp(18px, 3vw, 44px);
  border: 0;
  border-right: 1px solid var(--line-dark);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: center;
  transition: background 140ms ease, color 140ms ease;
}

.mode-tab:last-child {
  border-right: 0;
}

.mode-tab strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 28px;
  line-height: 1;
  font-family: "SimSun", "Songti SC", serif;
}

.mode-tab:hover {
  background: rgba(161, 52, 52, 0.08);
}

.mode-tab.active {
  color: var(--sheet);
  background: var(--red);
  box-shadow: inset 0 -6px 0 var(--gold);
}

.drama-family .mode-tab.active {
  background: var(--teal);
}

.studio-rail .mode-tabs {
  display: none !important;
}

.app-shell {
  display: block;
  width: min(1120px, calc(100% - 34px));
  margin: 26px auto 90px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  width: min(1120px, calc(100% - 34px));
  margin: -52px auto 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--red);
  text-decoration: underline;
}

.skill-dock {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
}

.skill-dock-head {
  display: grid;
  align-content: center;
  gap: 6px;
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.skill-dock-head span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.skill-dock-head strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 28px;
  line-height: 1.05;
}

.skill-button-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.skill-choice {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 78px;
  min-width: 0;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.skill-choice strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.skill-choice span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.skill-choice:hover {
  border-color: var(--line-dark);
  transform: translateY(-1px);
}

.skill-choice.active {
  border-color: var(--ink);
  color: var(--sheet);
  background: var(--ink);
  box-shadow: inset 0 -5px 0 var(--gold);
}

.skill-choice.active span {
  color: #dccfb8;
}

.skill-choice:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.studio-rail {
  position: sticky;
  top: 190px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.rail-title {
  padding: 16px 0 18px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line-dark);
}

.rail-title span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.rail-title strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 32px;
}

.workspace {
  min-width: 0;
  width: 100%;
}

.rail-sheet {
  padding: 16px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.86);
}

.rail-sheet-dark {
  color: var(--sheet);
  background: var(--teal);
}

.rail-sheet-dark .rail-label {
  color: #dfc58a;
}

.tag-count,
.api-badge,
.outline-tags {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--ink);
  background: var(--sheet);
  font-size: 13px;
  font-weight: 900;
}

.tag-count {
  min-width: 64px;
  justify-content: center;
}

.api-badge.ready {
  border-color: var(--teal);
  color: var(--teal);
}

.api-badge.demo {
  border-color: var(--red);
  color: var(--red);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.band {
  margin-bottom: 22px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-band {
  min-height: 210px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.96), rgba(255, 250, 241, 0.7)),
    linear-gradient(135deg, transparent 0 65%, rgba(161, 52, 52, 0.12) 65% 100%),
    var(--sheet);
}

.hero-band .section-head {
  min-height: 210px;
  align-items: center;
  border-bottom: 0;
}

.hero-band .eyebrow {
  color: var(--red);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(22px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
}

.compact-head {
  padding-bottom: 18px;
}

.section-number {
  color: rgba(22, 19, 15, 0.08);
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(76px, 12vw, 160px);
  font-weight: 700;
  line-height: 0.82;
}

.tool-band {
  padding-bottom: clamp(18px, 3vw, 30px);
}

.category-host {
  display: grid;
  gap: 0;
  padding: 0 clamp(22px, 3vw, 34px);
}

.category-group {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.category-group:first-child {
  border-top: 0;
}

.group-title {
  display: grid;
  align-content: start;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.group-title strong {
  color: var(--ink);
  font-size: 16px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chip {
  min-height: 34px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: #fffdf8;
  font-size: 14px;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.chip:hover {
  border-color: var(--line-dark);
  transform: translateY(-1px);
}

.chip.active {
  border-color: var(--ink);
  color: var(--sheet);
  background: var(--ink);
}

.chip:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action-row {
  justify-content: flex-end;
  padding: 24px clamp(22px, 3vw, 34px) 0;
  border-top: 1px solid var(--line);
}

.primary-btn,
.dark-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-btn {
  color: var(--sheet);
  background: var(--red);
  border-color: var(--red);
}

.dark-btn {
  color: var(--sheet);
  background: var(--ink);
}

.ghost-btn {
  color: var(--ink);
  background: rgba(255, 250, 241, 0.9);
}

.danger-btn {
  color: var(--sheet);
  background: var(--red);
  border-color: var(--red);
  margin: 18px clamp(22px, 3vw, 34px) 0;
}

.primary-btn:hover,
.dark-btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 5px 5px 0 rgba(22, 19, 15, 0.14);
}

.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.tool-band > .field-label,
.tool-band > .brief-input {
  margin-left: clamp(22px, 3vw, 34px);
  margin-right: clamp(22px, 3vw, 34px);
  width: calc(100% - clamp(44px, 6vw, 68px));
}

.brief-input,
select,
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
}

.brief-input {
  min-height: 240px;
  padding: 18px;
  resize: vertical;
  line-height: 1.8;
  box-shadow: inset 0 0 0 1px rgba(22, 19, 15, 0.04);
}

.brief-input.small {
  min-height: 112px;
}

.creative-brief-example {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  margin: 0 clamp(22px, 3vw, 34px) 16px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--red) 22%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 4%, var(--paper));
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.creative-brief-example > div {
  display: grid;
  align-content: start;
  gap: 5px;
}

.creative-brief-example strong,
.creative-brief-example b {
  color: var(--red);
}

.creative-brief-example > div span {
  color: var(--ink);
  font-weight: 700;
}

.creative-brief-example p {
  margin: 0;
}

.creative-brief-example p b {
  margin-right: 8px;
}

.creative-brief-assist {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 20px;
  margin: 12px clamp(22px, 3vw, 34px) 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.creative-brief-assist > p {
  margin: 0;
}

#creativeBriefGuidance {
  grid-column: 1 / -1;
}

.creative-brief-feedback {
  font-weight: 750;
}

.creative-brief-feedback.error {
  color: var(--red);
}

.creative-brief-feedback.advice {
  color: var(--ui-warning, #97641f);
}

.creative-brief-feedback.valid {
  color: var(--green);
}

.creative-brief-count {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#creativeBrief[aria-invalid="true"] {
  border-color: color-mix(in srgb, var(--red) 70%, var(--line-dark));
}

.outline-request-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 18px clamp(22px, 3vw, 34px) 0;
  padding: 20px 22px;
  border: 1px solid var(--ui-border, var(--line));
  border-left: 4px solid var(--green);
  border-radius: 14px;
  background: color-mix(in srgb, var(--green) 7%, var(--paper));
}

.outline-request-status.error {
  border-left-color: var(--red);
  background: color-mix(in srgb, var(--red) 7%, var(--paper));
}

.outline-request-status > div { min-width: 0; }
.outline-request-status span {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.outline-request-status h3 { margin: 4px 0 6px; font-size: 21px; }
.outline-request-status p { margin: 0; color: var(--muted); line-height: 1.65; }
.outline-request-status small { display: block; margin-top: 8px; color: var(--green); font-weight: 700; }
.outline-request-status.error small { color: var(--red); }

.outline-precheck-modal {
  position: fixed;
  z-index: 121;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 32px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: var(--ui-radius-modal, 20px);
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--paper));
  box-shadow: var(--ui-shadow-float, 0 28px 70px rgba(24, 20, 16, 0.28));
}

.outline-precheck-modal header { padding-bottom: 20px; border-bottom: 1px solid var(--ui-border, var(--line)); }
.outline-precheck-modal header p { margin: 0 0 6px; color: var(--red); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.outline-precheck-modal header h2 { margin: 0 0 10px; font-family: var(--serif); font-size: clamp(28px, 5vw, 42px); line-height: 1.15; }
.outline-precheck-modal header span { display: block; color: var(--muted); line-height: 1.75; }
.outline-precheck-details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.outline-precheck-details > div { padding: 16px; border: 1px solid var(--ui-border, var(--line)); border-radius: 12px; background: var(--ui-surface-raised, rgba(255,255,255,.35)); }
.outline-precheck-details strong { display: block; margin-bottom: 8px; }
.outline-precheck-details ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.7; }
.outline-precheck-billing-note { margin: 18px 0; padding: 12px 14px; color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); border-radius: 10px; font-weight: 700; }
.outline-precheck-modal footer { display: flex; justify-content: flex-end; gap: 12px; }

html[data-theme="dark"] .outline-precheck-modal,
html[data-theme="dark"] .outline-request-status { background: var(--ui-surface, #151a17); }

@media (max-width: 680px) {
  .creative-brief-example {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .outline-request-status { align-items: stretch; flex-direction: column; }
  .outline-precheck-modal { padding: 24px 20px; }
  .outline-precheck-details { grid-template-columns: 1fr; }
  .outline-precheck-modal footer { flex-direction: column; }
  .outline-precheck-modal footer button { width: 100%; }
}

select,
input[type="number"],
input[type="text"] {
  min-height: 42px;
  padding: 8px 12px;
}

.drama-workbench {
  background: rgba(255, 250, 241, 0.96);
}

.drama-head {
  align-items: center;
  background: transparent;
  color: var(--ink);
}

.drama-head .eyebrow {
  color: var(--red);
}

.drama-head h2 {
  font-size: clamp(32px, 5vw, 56px);
}

.compact-head h2.creation-section-title,
.drama-head h2.creation-section-title,
.localization-head h2.creation-section-title {
  font-size: clamp(32px, 5vw, 56px);
}

.drama-form {
  padding: 0 clamp(22px, 4vw, 42px) 34px;
}

.drama-fieldset[hidden] { display: none; }

#dramaSourceFieldset:has(#dramaPasteField[hidden]) .novel-source-grid {
  grid-template-columns: 1fr;
}

#dramaSourceFieldset:has(#dramaPasteField[hidden]) .novel-upload-field {
  max-width: 720px;
  width: 100%;
}

.profile-form { display: grid; gap: 24px; }
.profile-form > label { display: grid; gap: 10px; font-weight: 700; }
.profile-form input {
  min-height: 52px; border: 1px solid var(--ink); border-radius: 8px; padding: 0 16px;
  background: var(--paper); color: var(--ink); font: inherit;
}
.profile-avatar-editor { display: flex; align-items: center; gap: 20px; }
.profile-avatar-editor > div { display: grid; justify-items: start; gap: 8px; }
.profile-avatar-editor small { color: var(--muted); }
.account-avatar.profile-preview { width: 88px; height: 88px; flex: 0 0 88px; }

.avatar-cropper {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(180px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5efe5;
}

.avatar-crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: #d8cec0;
}

.avatar-crop-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.avatar-crop-stage canvas.dragging {
  cursor: grabbing;
}

.avatar-crop-mask {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 250, 241, 0.94);
  border-radius: 50%;
  pointer-events: none;
}

.avatar-crop-controls {
  display: grid;
  gap: 22px;
}

.avatar-crop-controls > label {
  display: grid;
  gap: 10px;
  font-weight: 800;
}

.avatar-crop-controls input[type="range"] {
  width: 100%;
  min-height: 28px;
  padding: 0;
  accent-color: var(--red);
}

.avatar-crop-controls > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.avatar-cropper > small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.drama-fieldset {
  min-width: 0;
  margin: 0;
  padding: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.drama-fieldset:first-child {
  border-top: 0;
}

.drama-fieldset legend {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  margin-bottom: 18px;
  padding: 0;
}

.drama-fieldset legend > span {
  color: var(--red);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 22px;
  font-weight: 900;
}

.drama-fieldset legend strong {
  font-size: 20px;
}

.drama-fieldset legend small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.compact-choice-field {
  padding-top: 22px;
  padding-bottom: 22px;
}

.compact-choice-field legend {
  margin-bottom: 10px;
}

.drama-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.drama-choice {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: #fffdf8;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.drama-choice:hover {
  border-color: var(--line-dark);
  transform: translateY(-1px);
}

.drama-choice.active {
  border-color: var(--red);
  color: var(--sheet);
  background: var(--red);
  box-shadow: inset 0 -4px 0 rgba(91, 24, 24, 0.28);
}

.novel-source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 16px;
}

.novel-paste-field,
.novel-upload-field {
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr);
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.novel-paste-field textarea,
.optional-fieldset textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  line-height: 1.75;
  resize: vertical;
}

.novel-paste-field textarea {
  height: 100%;
  min-height: 300px;
}

.file-dropzone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  height: 100%;
  min-height: 300px;
  padding: 26px;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  background: #eee7db;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-dropzone:hover,
.file-dropzone:focus-visible {
  border-color: var(--teal);
  background: #e8e2d7;
  outline: 2px solid rgba(31, 88, 79, 0.14);
  outline-offset: 2px;
}

.file-dropzone.dragging {
  border-color: var(--red);
  background: #f3ded8;
}

.file-pick-button {
  display: grid;
  place-items: center;
  gap: 10px;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.upload-symbol {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--sheet);
  background: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.file-dropzone p,
.file-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.file-status {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink-2);
}

.file-status.working {
  color: var(--red);
}

.file-status.ready {
  color: var(--teal);
  font-weight: 900;
}

.inline-custom-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.inline-custom-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
}

.custom-number-control,
.custom-duration-control {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: #fffdf8;
  overflow: hidden;
}

.custom-number-control input,
.custom-duration-control input {
  flex: 1;
  min-width: 100px;
  border: 0;
  border-radius: 0;
}

.custom-number-control b {
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.custom-duration-control {
  padding-right: 4px;
}

.duration-unit-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 1fr));
  flex: 0 0 auto;
  padding: 3px;
  border-left: 1px solid var(--line);
  background: var(--paper-2);
}

.duration-unit-toggle button {
  min-height: 34px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.duration-unit-toggle button.active {
  color: var(--sheet);
  background: var(--ink);
}

.inline-custom-field > small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.audience-groups {
  display: grid;
  gap: 14px;
}

.audience-group {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.audience-group > strong {
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.optional-fieldset textarea {
  min-height: 124px;
}

.regenerate-episode-list {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

.regenerate-episode-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
}

.regenerate-episode-row > span {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 800;
}

.regenerate-episode-row input {
  width: 100px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
  font-weight: 800;
  text-align: center;
}

.regenerate-episode-row input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(174, 52, 52, 0.14);
}

.episode-step-button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--teal);
  border-radius: 50%;
  color: var(--teal);
  background: transparent;
  font-size: 23px;
  line-height: 1;
}

.episode-step-button.remove {
  color: var(--red);
  border-color: var(--red);
}

.episode-step-button:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.drama-submit-bar {
  position: sticky;
  bottom: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.96);
  box-shadow: 0 15px 38px rgba(24, 20, 16, 0.16);
  backdrop-filter: blur(16px);
}

.drama-task-count {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}

.drama-submit-bar span {
  color: var(--muted);
  font-size: 12px;
}

.drama-task-count strong {
  font-size: 18px;
}

.drama-result-area {
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(36, 30, 22, 0.1);
}

.localization-workbench {
  overflow: hidden;
  border-color: var(--line-dark);
  background: rgba(255, 250, 241, 0.96);
}

.localization-head {
  align-items: center;
  padding: clamp(24px, 4vw, 40px);
  color: var(--ink);
  background: transparent;
}

.localization-head > div {
  display: grid;
  gap: 7px;
}

.localization-head .eyebrow {
  color: var(--red);
}

.localization-head h2 {
  color: var(--ink);
}

.localization-title-lockup {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  min-width: 0;
}

.localization-title-lockup h2 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.localization-slogan {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  max-width: 520px;
  padding: 7px 0 7px clamp(12px, 1.8vw, 22px);
  border-left: 2px solid var(--gold);
  text-align: left;
}

.localization-slogan strong {
  color: var(--ink);
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
}

.localization-slogan span {
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 14px);
  font-weight: 700;
  line-height: 1.35;
}

.localization-skill-badge {
  max-width: 260px;
  padding: 10px 14px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(31, 88, 79, 0.06);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.localization-source-fieldset .file-dropzone {
  min-height: 230px;
}

.localization-parameter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.localization-select-field {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  padding-right: 18px;
  border-top: 0;
  border-right: 1px solid var(--line);
}

.localization-select-field + .localization-select-field {
  padding-left: 18px;
}

.localization-select-field:last-child {
  padding-right: 0;
  border-right: 0;
}

.localization-select-field legend {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: 10px;
  row-gap: 4px;
  min-height: 66px;
  margin-bottom: 14px;
}

.localization-select-field legend > span {
  grid-column: 1;
  grid-row: 1 / 3;
}

.localization-select-field legend strong {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  line-height: 1.2;
}

.localization-select-field legend small {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin-left: 0;
  line-height: 1.35;
}

.localization-select-field label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.localization-select-field input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

.localization-select-field input[type="search"]:focus {
  border-color: #31546d;
  outline: 2px solid rgba(49, 84, 109, 0.16);
  outline-offset: 1px;
}

.localization-select-field > p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.localization-character-bios-fieldset {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.localization-character-bios-toggle {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.localization-character-bios-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.localization-toggle-track {
  position: relative;
  display: block;
  width: 48px;
  height: 26px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: var(--paper-2);
  transition: background 160ms ease, border-color 160ms ease;
}

.localization-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.localization-character-bios-toggle input:checked + .localization-toggle-track {
  border-color: var(--teal);
  background: var(--teal);
}

.localization-character-bios-toggle input:checked + .localization-toggle-track .localization-toggle-thumb {
  background: var(--sheet);
  transform: translateX(22px);
}

.localization-character-bios-toggle input:focus-visible + .localization-toggle-track {
  outline: 3px solid rgba(31, 88, 79, 0.2);
  outline-offset: 3px;
}

.localization-character-bios-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.localization-character-bios-copy strong {
  color: var(--ink);
  font-size: 15px;
}

.localization-character-bios-advice {
  display: block;
  max-width: 920px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.55;
}

.localization-cost-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.localization-cost-copy > span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.localization-cost-copy > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.localization-submit-bar .dark-btn {
  background: #203944;
}

.localization-result-area .drama-file-icon {
  background: #31546d;
}

.drama-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.delivery-title-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.drama-result-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.drama-reader {
  padding: clamp(26px, 5vw, 56px);
  color: #25211c;
  background: #fff;
}

.drama-file-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid #ded8ce;
  border-radius: var(--radius);
  background: #fbfaf8;
  box-shadow: 0 8px 24px rgba(36, 30, 22, 0.08);
}

.drama-file-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 62px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  color: var(--sheet);
  background: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.drama-file-icon::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 15px;
  height: 15px;
  border-left: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  background: #fbfaf8;
}

.drama-file-card > div > strong,
.drama-file-card > div > span {
  display: block;
  min-width: 0;
}

.drama-file-card > div > strong {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.drama-file-card > div > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.drama-file-status {
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.drama-reader h2 {
  margin: 38px 0 18px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 30px;
}

.drama-reader h3 {
  margin: 30px 0 14px;
  font-size: 21px;
}

.drama-reader h4 {
  margin: 22px 0 10px;
  font-size: 18px;
}

.drama-reader hr {
  margin: 34px 0;
  border: 0;
  border-top: 1px solid #ded8ce;
}

.drama-line,
.drama-action,
.drama-cast,
.drama-screen,
.drama-bullet {
  margin: 7px 0;
  line-height: 1.75;
}

.drama-episode {
  padding: 12px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid #ded8ce;
}

.drama-scene {
  margin: 22px 0 6px;
  padding: 9px 12px;
  border-left: 4px solid var(--red);
  color: var(--ink);
  background: #f1eee9;
  font-weight: 900;
}

.drama-cast {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.drama-action {
  color: #4f4a43;
}

.drama-screen {
  color: var(--teal);
  font-weight: 900;
}

.drama-bullet {
  padding-left: 20px;
  position: relative;
}

.drama-bullet::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.drama-space {
  height: 8px;
}

.drama-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.drama-cancelled-note {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  color: #7a2525;
  background: #f7e4df;
  font-weight: 900;
}

.result-band {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.primary-btn:disabled,
.dark-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.ai-generated-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 8px;
  padding: 3px 9px;
  border: 1px solid rgba(161, 52, 52, 0.58);
  border-radius: 999px;
  color: #7a2525;
  background: #f7e4df;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.trend-card {
  padding: clamp(28px, 4vw, 42px);
  border-radius: 20px;
  background: #fffefe;
  box-shadow: 0 18px 48px rgba(36, 30, 22, 0.1);
}

.trend-card h2 {
  margin-bottom: 26px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 24px;
  line-height: 1.3;
}

.trend-card h2 .ai-generated-badge {
  margin: 0 0 3px 8px;
}

.trend-list {
  display: grid;
  gap: 12px;
}

.trend-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 96px 58px;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(24, 20, 16, 0.07);
}

.trend-rank {
  font-size: 28px;
  line-height: 1;
}

.trend-copy {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}

.trend-copy b {
  min-width: max-content;
  font-size: 20px;
}

.trend-copy span {
  min-width: 0;
  color: #5d6672;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-meter {
  height: 8px;
  border-radius: 999px;
  background: #e8e4dd;
  overflow: hidden;
}

.trend-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.trend-scoreline {
  color: #d17a00;
  font-size: 20px;
  font-weight: 900;
  text-align: right;
}

.trend-scoreline.up {
  color: #00a85a;
}

.trend-note {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid #d9d3c9;
  border-radius: 12px;
  background: #fff;
}

.trend-note.muted-note {
  background: #f1f1f1;
}

.trend-note strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.trend-note p {
  margin: 0;
  font-size: 20px;
  line-height: 1.65;
}

.trend-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 30px;
}

.plain-list {
  margin: 12px 0 22px;
  padding: 0;
  list-style: none;
}

.plain-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  line-height: 1.7;
}

.story-area {
  padding-bottom: clamp(20px, 3vw, 34px);
}

.outline-area {
  padding: 0 0 28px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(36, 30, 22, 0.1);
}

.outline-area > .section-head {
  display: none;
}

.outline-blocks {
  display: block;
  padding: 0;
  background: transparent;
}

.outline-document {
  padding: clamp(28px, 4vw, 42px);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.outline-doc-head h2 {
  margin-bottom: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 26px;
  line-height: 1.35;
}

.outline-doc-head p {
  margin: 0;
  color: #606672;
  font-size: 16px;
  line-height: 1.6;
}

.outline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.outline-meta span {
  padding: 5px 9px;
  border-radius: 5px;
  color: var(--ink-2);
  background: #eee9df;
  font-size: 12px;
}

.outline-highlight {
  margin-top: 26px;
  padding: 18px;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #f1f1f1;
}

.outline-highlight strong,
.outline-module h3 {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
}

.outline-highlight p {
  margin: 0;
  line-height: 1.7;
  font-size: 17px;
}

.outline-opening {
  padding: 18px;
  border-left: 4px solid var(--gold);
  background: #f7f1e8;
}

.outline-opening p {
  margin: 0;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.75;
}

.outline-module {
  margin-top: 28px;
}

.outline-fallback-notice {
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--ui-warning, #97641f) 44%, #dedede);
  border-radius: 10px;
  background: var(--ui-warning-soft, #f2e7d0);
  color: var(--ui-warning, #97641f);
}

.outline-fallback-notice h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.outline-fallback-notice p {
  margin: 0;
  line-height: 1.7;
}

@media (max-width: 680px) {
  .creative-brief-assist {
    grid-template-columns: 1fr;
  }

  .creative-brief-count {
    text-align: left;
  }
}

.act-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.act-card {
  min-height: 120px;
  padding: 14px;
  border: 1px solid #ded8ce;
  border-radius: 10px;
  background: #fffdf8;
}

.act-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--red);
  font-weight: 900;
}

.act-card p {
  margin: 0;
  line-height: 1.6;
}

.act-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.act-card small {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--red);
  line-height: 1.5;
}

.chapter-timeline {
  display: grid;
  gap: 12px;
}

.chapter-card {
  border: 1px solid #ded8ce;
  border-radius: var(--radius);
  background: #fffdfa;
  overflow: hidden;
}

.chapter-card summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.chapter-card summary::-webkit-details-marker {
  display: none;
}

.chapter-index {
  color: var(--red);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 26px;
  font-weight: 700;
}

.chapter-card h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.chapter-card summary p {
  margin: 0;
  color: #606672;
  line-height: 1.6;
}

.chapter-words {
  color: var(--muted);
  font-size: 12px;
}

.chapter-body {
  padding: 0 16px 18px 88px;
  border-top: 1px solid #eee8de;
}

.hook-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.hook-box {
  padding: 12px;
  border-left: 3px solid var(--gold);
  background: #f5f0e8;
}

.hook-box.end {
  border-left-color: var(--red);
}

.hook-box strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.hook-box p,
.chapter-summary {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.7;
}

.scene-list {
  margin: 14px 0;
  padding-left: 20px;
  color: var(--ink-2);
}

.scene-list li + li {
  margin-top: 8px;
}

.chapter-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.chapter-detail-grid div {
  padding: 10px;
  border: 1px solid #e7e0d5;
  border-radius: 6px;
  background: #fff;
}

.chapter-detail-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--red);
  font-size: 12px;
}

.chapter-detail-grid span {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.mini-tags,
.outline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-tags {
  margin-top: 8px;
}

.mini-tags span,
.outline-chips span,
.character-card span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eee9df;
  color: var(--ink);
  font-size: 13px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.character-card {
  padding: 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(24, 20, 16, 0.07);
}

.character-card strong {
  display: inline-block;
  margin-right: 8px;
  font-size: 18px;
}

.character-card p {
  margin: 10px 0 0;
  color: #606672;
  line-height: 1.6;
}

.character-facts {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.character-facts div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  padding-top: 7px;
  border-top: 1px solid #eee8de;
  color: #606672;
  font-size: 13px;
  line-height: 1.55;
}

.character-facts b {
  color: var(--ink);
}

.foreshadow-table {
  display: grid;
  gap: 8px;
}

.foreshadow-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #e1dbd1;
  border-radius: 7px;
}

.foreshadow-row i {
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

.outline-chips {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e4ded4;
}

.regen-panel {
  display: grid;
  gap: 14px;
  margin: 0 clamp(28px, 4vw, 42px);
  padding-top: 28px;
  border-top: 1px solid #e4ded4;
}

.section-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-controls {
  align-items: end;
  margin: 26px clamp(28px, 4vw, 42px) 0;
  padding-top: 24px;
  border-top: 1px solid #e4ded4;
}

.story-controls label {
  display: grid;
  gap: 6px;
  min-width: 190px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.story-reader {
  min-height: 520px;
  margin: 0 clamp(22px, 3vw, 34px);
  padding: clamp(22px, 4vw, 52px);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 0 calc(100% - 1px), rgba(22, 19, 15, 0.055) calc(100% - 1px)) 0 0 / 34px 34px,
    #fffdf8;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 18px;
  line-height: 2.05;
  white-space: pre-wrap;
}

.export-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 15;
  min-width: 150px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.export-menu button {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 8px 12px;
}

.export-menu button:hover {
  background: var(--paper-2);
}

.page-controls {
  justify-content: center;
  margin-top: 18px;
  padding: 0 clamp(22px, 3vw, 34px);
}

.page-controls button {
  min-width: 38px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
}

.page-controls button.active {
  color: var(--sheet);
  border-color: var(--ink);
  background: var(--ink);
}

.history-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(440px, 100%);
  height: 100dvh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 180ms ease;
  border-left: 1px solid var(--line-dark);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.history-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 20px;
}

.history-search {
  display: block;
  flex: 0 0 auto;
  margin-bottom: 16px;
}

.history-search input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper-2);
  font: inherit;
}

.history-search input:focus {
  outline: 2px solid color-mix(in srgb, var(--red) 45%, transparent);
  outline-offset: 2px;
}

.history-list {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--red) var(--paper-2);
}

.history-list::-webkit-scrollbar {
  width: 10px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--paper-2);
}

.history-list::-webkit-scrollbar-thumb {
  border: 2px solid var(--paper-2);
  border-radius: 5px;
  background: var(--red);
}

.history-item {
  padding: 15px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  text-align: left;
}

.history-item strong {
  display: block;
  margin-bottom: 6px;
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progress-panel {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  width: min(720px, calc(100% - 32px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  padding: 16px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  grid-column: 1 / -1;
}

.progress-copy span,
#progressPercent {
  color: var(--muted);
  font-size: 13px;
}

.progress-long-task-notice {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
}

.progress-long-task-alert {
  color: var(--red);
}

.progress-telemetry {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 14px;
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.progress-telemetry[hidden] {
  display: none;
}

.progress-health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--teal);
  font-weight: 800;
}

.progress-health i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: progress-heartbeat 1.8s ease-out infinite;
}

.progress-health.is-waiting {
  color: #9a6927;
}

.progress-health.is-recovering {
  color: var(--red);
}

.progress-track {
  position: relative;
  height: 10px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
}

.progress-bar {
  position: relative;
  overflow: hidden;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal));
  transition: width 180ms ease;
}

.progress-bar::after {
  position: absolute;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(
    115deg,
    transparent 0 12px,
    rgba(255, 255, 255, 0.34) 12px 20px,
    transparent 20px 34px
  );
  animation: progress-flow 1.1s linear infinite;
}

@keyframes progress-flow {
  from {
    transform: translateX(-34px);
  }

  to {
    transform: translateX(34px);
  }
}

@keyframes progress-heartbeat {
  0% {
    box-shadow: 0 0 0 0 currentColor;
    opacity: 1;
  }

  70% {
    box-shadow: 0 0 0 6px transparent;
    opacity: 0.72;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
    opacity: 1;
  }
}

.progress-stop-btn {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  top: 118px;
  z-index: 120;
  max-width: min(520px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px 16px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--sheet);
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 10, 8, 0.64);
  backdrop-filter: blur(8px);
}

.auth-modal,
.billing-modal,
.invitation-modal,
.activity-modal,
.announcement-modal,
.membership-expiry-modal,
.legal-modal,
.ai-export-modal,
.settings-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 85;
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  transform: translate(-50%, -50%);
  overflow: auto;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.34);
}

.auth-modal {
  padding: 32px;
}

.ai-export-modal {
  width: min(590px, calc(100% - 28px));
  padding: clamp(24px, 4vw, 34px);
}

.ai-export-head {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.ai-export-head p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.ai-export-head h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 34px);
}

.ai-export-head > span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.6;
}

.ai-export-default-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
}

.ai-export-default-note .ai-generated-badge {
  margin: 0;
}

.ai-export-default-note p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.6;
}

.ai-export-choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.ai-export-choice:hover {
  border-color: var(--teal);
}

.ai-export-choice input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.ai-export-choice strong,
.ai-export-choice small {
  display: block;
}

.ai-export-choice strong {
  margin-bottom: 4px;
  font-size: 16px;
}

.ai-export-choice small {
  color: var(--muted);
  line-height: 1.55;
}

.ai-export-responsibility {
  margin-top: 12px;
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  color: #662e28;
  background: #f8e8e3;
}

.ai-export-responsibility strong {
  display: block;
  margin-bottom: 5px;
}

.ai-export-responsibility p {
  margin: 0;
  line-height: 1.65;
}

.ai-export-remember-choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  cursor: pointer;
}

.ai-export-remember-choice input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.ai-export-remember-choice strong,
.ai-export-remember-choice small {
  display: block;
}

.ai-export-remember-choice strong {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 15px;
}

.ai-export-remember-choice small {
  color: var(--muted);
  line-height: 1.55;
}

.ai-export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 34px;
}

.auth-brand > span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  color: var(--sheet);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--gold);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 30px;
}

.auth-brand > span .cat-face {
  --cat-bg: var(--sheet);
  --cat-ink: var(--ink);
}

.auth-brand p,
.billing-modal header p,
.activity-modal header p,
.announcement-modal header p,
.invitation-modal header p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.auth-brand strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 24px;
}

.reward-copy-highlight {
  color: var(--red);
  display: inline-block;
  padding: 0 0.12em;
  border-bottom: 2px solid currentColor;
  background: rgba(177, 52, 52, 0.08);
  font-size: 1.16em;
  font-weight: 900;
  line-height: 1.05;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 30px 0 22px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs button {
  min-height: 44px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.auth-tabs button.active {
  border-bottom-color: var(--red);
  color: var(--ink);
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: grid;
  gap: 18px;
}

.phone-auth-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4ede2;
}

.phone-auth-modes button {
  min-height: 38px;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.phone-auth-modes button.active {
  color: var(--ink);
  background: #fffdf8;
  box-shadow: 0 3px 12px rgba(27, 24, 20, 0.08);
}

.phone-auth-fields {
  display: grid;
  gap: 18px;
}

.phone-auth-fields[hidden] {
  display: none;
}

.auth-panel label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

.auth-panel label > span small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.auth-panel input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
}

.code-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.code-input input {
  border-radius: var(--radius) 0 0 var(--radius);
}

.code-input button {
  padding: 8px 14px;
  border: 1px solid var(--line-dark);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--red);
  background: #f4ede2;
  font-weight: 900;
}

.auth-submit,
.wechat-login-btn {
  min-height: 50px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--sheet);
  background: var(--red);
  font-weight: 900;
}

.dev-code-hint {
  margin: -6px 0 0;
  padding: 10px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  background: #f4ede2;
  font-size: 12px;
}

#wechatLoginPanel {
  justify-items: center;
  padding: 10px 0;
  text-align: center;
}

.wechat-mark {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  color: #fff;
  background: #1aad19;
  font-size: 36px;
  font-weight: 900;
}

#wechatLoginPanel p,
.billing-note {
  color: var(--muted);
  font-size: 12px;
}

.wechat-login-btn {
  width: 100%;
  border-color: var(--teal);
  background: var(--teal);
}

.wechat-binding-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.auth-inline-link {
  justify-self: start;
  padding: 0;
  border: 0;
  color: var(--red);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

.auth-consent {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-consent-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.auth-consent-check input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--red);
}

.legal-link {
  padding: 0;
  border: 0;
  color: var(--red);
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-consent-hint {
  margin: 7px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.legal-modal {
  width: min(720px, calc(100% - 28px));
  padding: 34px;
}

.legal-head {
  padding: 0 48px 20px 0;
  border-bottom: 1px solid var(--line);
}

.legal-head p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.legal-head h2 {
  margin: 0 0 8px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 38px;
}

.legal-head span {
  color: var(--muted);
  font-size: 12px;
}

.legal-document {
  display: grid;
  gap: 22px;
  padding-top: 24px;
}

.legal-intro {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-left: 4px solid var(--gold);
  background: #f5f0e8;
}

.legal-intro > strong {
  font-size: 17px;
}

.legal-document section {
  display: grid;
  gap: 7px;
}

.legal-document h3,
.legal-document p,
.legal-document ul {
  margin: 0;
}

.legal-document h3 {
  font-size: 16px;
}

.legal-document p {
  color: #5f584e;
  font-size: 14px;
  line-height: 1.85;
}

.legal-document ul {
  display: grid;
  gap: 7px;
  padding-left: 22px;
  color: #5f584e;
  font-size: 14px;
  line-height: 1.75;
}

.legal-document a {
  color: var(--red);
  text-underline-offset: 2px;
}

.billing-modal {
  width: min(1060px, calc(100% - 28px));
  padding: 34px;
}

.membership-expiry-modal {
  width: min(540px, calc(100% - 28px));
  padding: 34px;
}

.membership-expiry-modal header {
  padding: 0 42px 20px 0;
  border-bottom: 1px solid var(--line);
}

.membership-expiry-modal header p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.membership-expiry-modal header h2 {
  margin: 0 0 8px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 34px;
}

.membership-expiry-modal header span {
  color: var(--muted);
  line-height: 1.7;
}

.membership-expiry-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 24px 0;
  padding: 20px;
  border-left: 5px solid var(--gold);
  color: var(--sheet);
  background: var(--ink);
}

.membership-expiry-summary > div:last-child {
  display: grid;
  gap: 7px;
}

.membership-expiry-summary > div:last-child > strong {
  color: #f2cc82;
  font-size: 17px;
}

.membership-expiry-summary p {
  margin: 0;
  color: #cfc5b8;
  line-height: 1.65;
}

.membership-expiry-count {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  column-gap: 4px;
  min-width: 78px;
}

.membership-expiry-count span {
  grid-column: 1 / -1;
  color: #cfc5b8;
  font-size: 12px;
}

.membership-expiry-count strong {
  color: #f2cc82;
  font-size: 42px;
  line-height: 1;
}

.membership-expiry-count small {
  padding-bottom: 4px;
  color: var(--sheet);
  font-weight: 800;
}

.membership-expiry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.membership-expiry-actions button {
  min-height: 48px;
}

.announcement-modal {
  width: min(620px, calc(100% - 28px));
  padding: 34px;
}

.announcement-modal header {
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.announcement-modal header h2 {
  margin: 0 0 8px;
  padding-right: 42px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 34px;
}

.announcement-modal header span,
.announcement-period {
  color: var(--muted);
  line-height: 1.7;
}

.announcement-details {
  max-height: min(45vh, 430px);
  margin: 22px 0 14px;
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #fffdf8;
  line-height: 1.85;
}

.announcement-period {
  font-size: 13px;
}

.announcement-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.announcement-actions > span {
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.announcement-actions button {
  min-width: 150px;
  min-height: 48px;
}

.activity-modal {
  width: min(620px, calc(100% - 28px));
  padding: 34px;
}

.activity-modal header {
  padding-right: 42px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.activity-modal header h2 {
  margin: 0 0 8px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 34px;
}

.activity-modal header span,
.activity-period {
  color: var(--muted);
  line-height: 1.7;
}

.activity-details {
  margin: 22px 0 14px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fffdf8;
  line-height: 1.85;
  white-space: normal;
}

.activity-image-wrap {
  margin: 22px 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.activity-image-wrap a {
  display: block;
}

.activity-image-wrap a.clickable {
  cursor: pointer;
}

.activity-image-wrap img {
  display: block;
  width: 100%;
  max-height: min(62vh, 720px);
  object-fit: contain;
}

.activity-period {
  font-size: 13px;
}

.activity-confirm {
  width: 100%;
  margin-top: 22px;
}

.activity-modal.image-only {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.activity-modal.image-only header,
.activity-modal.image-only .activity-details,
.activity-modal.image-only .activity-period,
.activity-modal.image-only .activity-confirm {
  display: none;
}

.activity-modal.image-only .modal-close {
  top: 12px;
  right: 12px;
  z-index: 2;
  border-color: rgba(255, 255, 255, 0.72);
  color: #fff;
  background: rgba(15, 13, 11, 0.72);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.24);
}

.activity-modal.image-only .activity-image-wrap {
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.activity-modal.image-only .activity-image-wrap img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 32px);
  margin: 0 auto;
}

.invitation-modal {
  width: min(640px, calc(100% - 28px));
  padding: 34px;
}

.invitation-modal header {
  padding-right: 42px;
}

.invitation-modal header h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.invitation-modal header > span {
  color: var(--muted);
  line-height: 1.7;
}

.invitation-code-panel {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: #f5f0e8;
}

.invitation-code-panel > span,
.invitation-code-panel > small {
  display: block;
  color: var(--muted);
}

.invitation-code-panel > span {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
}

.invitation-code-panel > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.invitation-code-panel strong {
  color: var(--red);
  font-size: 34px;
  letter-spacing: 0;
}

.invitation-link-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--sheet);
  background: var(--red);
  box-shadow: 0 7px 0 rgba(107, 31, 31, 0.2);
  font-weight: 900;
  animation: invitation-link-pulse 1.35s ease-in-out infinite;
}

.invitation-link-btn:hover {
  background: #962b2e;
}

@keyframes invitation-link-pulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 7px 0 rgba(107, 31, 31, 0.2);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 11px 18px rgba(174, 52, 55, 0.28);
  }
}

.invitation-code-panel > small {
  margin-top: 14px;
  line-height: 1.6;
}

.invitation-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.invitation-stats > div {
  display: grid;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.invitation-stats span,
.invitation-recent small {
  color: var(--muted);
  font-size: 12px;
}

.invitation-stats strong {
  font-size: 22px;
}

.invitation-recent {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.invitation-recent h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.invitation-recent > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.invitation-recent > div strong {
  color: var(--teal);
}

.invitation-recent > div small {
  grid-column: 1 / -1;
}

.settings-modal {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 32px;
  overflow-y: auto;
}

.settings-head {
  padding: 0 44px 22px 0;
  border-bottom: 1px solid var(--line);
}

.settings-head p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-head h2 {
  margin: 0;
  font-size: 34px;
}

.settings-head > span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 24px 0 18px;
}

.settings-row strong,
.settings-row span {
  display: block;
}

.settings-row strong {
  font-size: 18px;
}

.settings-row span,
.settings-note {
  color: var(--muted);
  font-size: 13px;
}

.settings-row span {
  margin-top: 5px;
}

.directory-status {
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--teal);
  background: #f5f0e8;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-status.custom {
  border-color: var(--teal);
  background: #edf4f1;
}

.directory-status.unsupported {
  color: var(--muted);
}

.settings-note {
  min-height: 20px;
  margin: 0 0 18px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-actions button {
  min-height: 44px;
}

.required-binding-modal {
  width: min(560px, calc(100% - 28px));
}

.required-binding-notice {
  display: grid;
  gap: 4px;
  margin: 22px 0 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--teal);
  background: #edf4f1;
}

.required-binding-notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.binding-cancel {
  justify-self: center;
  margin-top: -4px;
}

.security-method-list {
  display: grid;
  gap: 12px;
  padding-top: 22px;
}

.security-completion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding: 16px;
  border: 1px solid #d7a24b;
  border-radius: var(--radius);
  background: #fff5dd;
}

.security-completion strong,
.security-completion span {
  display: block;
}

.security-completion span {
  margin-top: 4px;
  color: #765d32;
  font-size: 12px;
  line-height: 1.55;
}

.security-completion.complete {
  border-color: #4e8a73;
  background: #e9f5ee;
}

.security-completion.complete span {
  color: #35634f;
}

.account-menu-list button.security-attention,
.account-menu-list button.security-attention small {
  color: #f0c873;
}

.security-method-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.security-method-card strong,
.security-method-card span {
  display: block;
}

.security-method-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.security-method-card button {
  min-width: 74px;
  min-height: 38px;
}

.security-method-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.security-method-icon.phone {
  background: var(--red);
}

.security-method-icon.wechat {
  background: #1aad19;
}

.security-method-icon.password {
  background: var(--teal);
}

.security-error {
  margin: 18px 0 0;
  padding: 12px 14px;
  color: #862929;
  background: #f8e8e3;
  line-height: 1.6;
}

.security-flow {
  padding-top: 22px;
}

.security-flow[hidden],
.security-method-list[hidden] {
  display: none;
}

.security-back {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 900;
}

.security-flow > header {
  margin-bottom: 18px;
}

.security-flow > header span {
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.security-flow > header h3 {
  margin: 5px 0 6px;
  font-size: 24px;
}

.security-flow > header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.security-form {
  display: grid;
  gap: 18px;
}

.security-form [hidden] {
  display: none !important;
}

.security-form label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

.security-form label > span small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.security-form input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
}

.security-form .code-input input {
  border-radius: var(--radius) 0 0 var(--radius);
}

.security-form > button[type="submit"] {
  min-height: 48px;
}

.security-verified-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f0e8;
}

.security-verified-target span {
  color: var(--muted);
  font-size: 12px;
}

.wechat-security-submit {
  border: 1px solid #178f17;
  border-radius: var(--radius);
  color: #fff;
  background: #1aad19;
  font-weight: 900;
}

.export-folder-browser {
  margin-top: 18px;
  border: 1px solid var(--ink);
  background: #fffdf8;
}

.folder-browser-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.folder-browser-head strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-command {
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 21px;
}

.folder-roots {
  display: flex;
  gap: 8px;
  min-height: 48px;
  padding: 9px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.folder-root-btn,
.folder-entry-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.folder-root-btn {
  flex: 0 0 auto;
  min-width: 64px;
  height: 30px;
  padding: 0 10px;
}

.folder-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  height: 230px;
  padding: 12px;
  overflow-y: auto;
}

.folder-entry-btn {
  min-width: 0;
  min-height: 42px;
  padding: 8px 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-root-btn:hover,
.folder-entry-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.folder-empty {
  grid-column: 1 / -1;
  margin: auto;
  color: var(--muted);
  font-size: 13px;
}

.folder-browser-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.billing-modal header h2 {
  margin-bottom: 8px;
  font-size: 34px;
}

.billing-modal header > span {
  color: var(--muted);
}

.billing-product-groups {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}

.billing-product-group {
  display: grid;
  gap: 10px;
}

.package-subgroup {
  display: grid;
  gap: 10px;
}

.package-subgroup + .package-subgroup {
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.package-subgroup-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.package-subgroup-heading strong {
  font-size: 15px;
}

.package-subgroup-heading span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.billing-benefit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
  padding: 13px 16px;
  border-radius: var(--radius);
  color: var(--sheet);
}

.billing-benefit strong,
.billing-benefit span {
  display: block;
}

.billing-benefit span {
  margin-top: 3px;
  font-size: 12px;
}

.billing-benefit small {
  flex: 0 0 auto;
  font-weight: 900;
}

.member-benefit {
  background: var(--teal);
}

.member-benefit span {
  color: #d4e6e0;
}

.member-benefit .member-ai-label-benefit {
  margin-top: 5px;
  color: #fff;
  font-weight: 800;
  line-height: 1.55;
}

.word-benefit {
  background: var(--red);
}

.word-benefit span {
  color: #f4dada;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

#wordPackageGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.package-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  text-align: left;
}

.package-card.has-recommendation {
  padding-top: 24px;
}

.recommendation-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  color: var(--sheet);
  background: var(--ink);
  box-shadow: 3px 3px 0 rgba(208, 160, 82, 0.72);
  animation: recommendation-bob 1.45s ease-in-out infinite;
  pointer-events: none;
}

.package-card .recommendation-tag > span {
  color: inherit;
  font-size: 15px;
  line-height: 1;
}

.package-card .recommendation-tag b {
  color: #f2cc82;
  font-size: 11px;
  line-height: 1;
}

@keyframes recommendation-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.package-card.recurring {
  border-color: #8ea59e;
  background: #f7fbf8;
}

.package-card.recurring small {
  color: var(--teal);
}

.package-card.selected {
  border-color: var(--ink);
  background: #f4e8d7;
  box-shadow: inset 0 0 0 2px var(--ink), 0 8px 20px rgba(22, 19, 15, 0.12);
}

.package-card.selected::after {
  content: "已选择";
  justify-self: end;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
}

.package-card small {
  color: var(--red);
  font-weight: 900;
}

.package-card strong {
  font-size: 20px;
}

.package-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: auto;
}

.package-price b {
  font-size: 28px;
  line-height: 1;
  white-space: nowrap;
}

.package-price del {
  color: var(--muted);
  font-size: 14px;
}

.package-price em {
  padding: 2px 5px;
  color: var(--red);
  background: #f8e6df;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

#wordPackageGrid .package-price {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 8px;
  row-gap: 4px;
}

#wordPackageGrid .package-price b {
  justify-self: start;
  font-size: 26px;
}

.package-card span {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .recommendation-tag,
  .invitation-link-btn {
    animation: none;
  }
}

.payment-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.15fr);
  gap: 18px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.payment-selection {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.payment-selection > span {
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.payment-selection strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-selection small {
  color: var(--muted);
  line-height: 1.5;
}

.payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.payment-method {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #fff;
  text-align: left;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.payment-method:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.payment-method:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4);
  opacity: 0.48;
}

.payment-method[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

.wechat-pay {
  background: #07c160;
}

.alipay-pay {
  background: #1677ff;
}

.payment-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 18px;
  font-weight: 900;
}

.payment-method > span:last-child {
  display: grid;
  gap: 2px;
}

.payment-method strong {
  font-size: 15px;
}

.payment-method small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
}

.wechat-native-checkout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 18px;
  border: 1px solid rgba(7, 193, 96, 0.28);
  border-radius: var(--radius);
  background: rgba(7, 193, 96, 0.06);
}

.wechat-native-checkout[hidden] {
  display: none;
}

.wechat-native-checkout img {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 12px;
  background: #fff;
}

.wechat-native-checkout > div {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.wechat-native-checkout strong {
  font-size: 20px;
}

.wechat-native-checkout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.billing-note {
  margin-bottom: 0;
  line-height: 1.6;
}

.recurring-pricing-disclaimer {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.billing-disclaimer {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.support-float {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 74;
  min-width: 96px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line-dark);
  border-radius: 26px;
  color: var(--sheet);
  background: var(--ink);
  box-shadow: 0 14px 36px rgba(22, 18, 14, 0.24);
  font-weight: 900;
}

.support-float.left {
  right: auto;
  left: 22px;
}

.support-float:hover {
  background: var(--red);
}

.support-float-icon {
  position: relative;
  width: 18px;
  height: 16px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 4px 4px;
}

.support-float-icon::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -4px;
  width: 4px;
  height: 8px;
  border-radius: 3px;
  background: currentColor;
  box-shadow: 18px 0 0 currentColor;
}

.support-float-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 8px;
  height: 5px;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 6px 0;
}

.support-float > b {
  position: absolute;
  top: -5px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border-radius: 9px;
  color: #fff;
  background: var(--red);
  font-size: 10px;
}

.support-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 76;
  width: min(520px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 116px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: 0 24px 72px rgba(18, 15, 12, 0.28);
}

.support-chat-panel.left {
  right: auto;
  left: 22px;
}

.support-chat-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--sheet);
  background: var(--ink);
  box-shadow: inset 0 -3px var(--gold);
}

.support-chat-panel.support-home-mode {
  background: #fbf7f0;
}

.support-chat-panel.support-home-mode .support-chat-header {
  min-height: 96px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 0;
  color: var(--sheet);
  background: var(--ink);
  box-shadow: inset 0 -3px var(--gold);
}

.support-chat-panel.support-home-mode .support-chat-mark {
  display: grid;
}

.support-chat-panel.support-home-mode .support-chat-header > div {
  flex: 1;
}

.support-chat-panel.support-home-mode .support-chat-header strong {
  font-size: 19px;
}

.support-chat-panel.support-home-mode .support-chat-header small {
  color: #cfc7bd;
  font-size: 12px;
}

.support-chat-panel.support-home-mode .support-chat-header > button {
  border-color: #57514b;
  color: var(--sheet);
}

.support-chat-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-chat-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--sheet);
  background: var(--red);
}

.support-chat-mark .cat-face {
  --cat-bg: var(--sheet);
  --cat-ink: var(--red);
}

.support-chat-header p {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.support-chat-header strong,
.support-chat-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chat-header strong {
  font-size: 18px;
}

.support-chat-header small {
  color: #cfc7bd;
  font-size: 13px;
}

.support-chat-header > button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #57514b;
  border-radius: 50%;
  color: var(--sheet);
  background: transparent;
  font-size: 22px;
}

.support-chat-header > .support-back-button {
  font-size: 19px;
}

.support-home-view {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px 24px;
  background: #fbf7f0;
}

.support-home-search {
  position: relative;
  display: block;
}

.support-home-search > span {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 15px;
  height: 15px;
  border: 2px solid #85817a;
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.support-home-search > span::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 1px;
  background: #85817a;
  transform: rotate(45deg);
}

.support-home-search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 47px;
  border: 1px solid #e8e4dd;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  font-size: 13px;
}

.support-home-search input:focus {
  border-color: var(--red);
  outline: 2px solid rgba(177, 52, 52, 0.1);
}

.support-home-topics {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.support-home-topics > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.support-home-topics h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.support-home-topics header small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.support-home-topics ol {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 2px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.support-home-topics li {
  min-height: 54px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid #f0ede8;
}

.support-home-topics li > span {
  color: #9a938a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-style: italic;
}

.support-home-topics li button {
  min-width: 0;
  padding: 13px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 16px;
  line-height: 1.45;
}

.support-home-topics li button:hover {
  color: var(--red);
}

.support-home-topics > p {
  margin: 40px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.support-start-chat-button {
  min-height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: #fff;
  background: var(--red);
  font-size: 14px;
  font-weight: 900;
}

.support-start-chat-button:hover {
  border-color: var(--ink);
  background: var(--ink);
}

.support-conversation-view {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.support-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fbf7f0;
}

.support-chat-loading,
.support-chat-error {
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.support-chat-error button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--sheet);
  font-weight: 800;
}

.support-chat-message {
  width: min(88%, 410px);
  align-self: flex-start;
}

.support-chat-message.user {
  align-self: flex-end;
}

.support-chat-message.system {
  width: 100%;
  align-self: center;
}

.support-chat-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.support-chat-message > div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.support-chat-message.user > div {
  border-color: #dca7a2;
  background: #fff4f1;
}

.support-chat-message.system > div {
  padding: 9px 12px;
  border: 0;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.045);
  text-align: center;
  font-size: 13px;
}

.support-chat-message img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin-bottom: 7px;
  object-fit: contain;
}

.support-chat-message a {
  display: inline-block;
  color: var(--teal);
  font-weight: 800;
}

.support-chat-composer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: #fbf7f0;
}

.support-chat-composer > textarea {
  width: 100%;
  min-height: 96px;
  max-height: 180px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: #fffdf8;
  font-size: 15px;
  line-height: 1.55;
}

.support-attachment-row {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.support-attachment-row label,
.support-attachment-row button {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.support-attachment-row label {
  position: relative;
  overflow: hidden;
}

.support-attachment-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.support-attachment-row span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chat-composer footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 7px;
}

.support-chat-composer footer button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 900;
}

.support-leave-queue-button {
  margin-right: auto;
  border: 1px solid var(--red);
  color: var(--red);
  background: #fff7f6;
}

.support-send-button {
  min-width: 88px;
  border: 1px solid var(--ink);
  color: var(--sheet);
  background: var(--ink);
}

.support-resolution-card {
  width: min(92%, 340px);
  align-self: flex-start;
  padding: 14px;
  border: 1px solid #e1d7ca;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--sheet);
  box-shadow: 0 8px 22px rgba(41, 30, 20, 0.08);
}

.support-resolution-card form {
  display: grid;
  gap: 10px;
}

.support-resolution-card strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.support-resolution-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.support-resolution-options button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #f4f0ea;
  font-size: 11px;
  font-weight: 800;
}

.support-resolution-options button.active {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.support-resolution-card fieldset {
  display: flex;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
}

.support-resolution-card fieldset button {
  padding: 0;
  border: 0;
  color: #d6cec3;
  background: transparent;
  font-size: 26px;
  line-height: 1;
}

.support-resolution-card fieldset button.active {
  color: var(--gold);
}

.support-resolution-card small {
  min-height: 16px;
  color: var(--muted);
  font-size: 10px;
}

.support-resolution-card textarea {
  width: 100%;
  min-height: 72px;
  padding: 9px 10px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf8;
  font-size: 11px;
  line-height: 1.5;
}

.support-resolution-card .support-feedback-submit {
  min-height: 38px;
  border: 1px solid var(--red);
  border-radius: 4px;
  color: #fff;
  background: var(--red);
  font-weight: 800;
}

.support-resolution-card.submitted {
  display: grid;
  gap: 5px;
}

.support-resolution-card.submitted p {
  margin: 0;
  color: var(--red);
  font-size: 11px;
}

.customer-service-modal {
  width: min(500px, calc(100% - 28px));
}

.customer-service-qr {
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 24px auto 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.customer-service-qr img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 12px;
  object-fit: contain;
}

.customer-service-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.customer-service-note {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.ledger-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.ledger-row div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ledger-row b.positive {
  color: var(--teal);
}

.ledger-row b.negative {
  color: var(--red);
}

.ledger-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .mode-strip {
    position: static;
  }

  .mode-strip-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-slogan {
    max-width: 340px;
    padding: 6px 0 6px 16px;
  }

  .brand-slogan strong {
    font-size: 18px;
  }

  .brand-slogan span {
    font-size: 10px;
  }

  .skill-button-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .act-grid,
  .character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) and (min-width: 781px) {
  #wordPackageGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .payment-checkout,
  .payment-methods {
    grid-template-columns: 1fr;
  }

  .wechat-native-checkout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .wechat-native-checkout > div {
    justify-items: center;
  }

  .package-subgroup-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .package-subgroup-heading span {
    text-align: left;
  }

  .topbar,
  .section-head,
  .progress-copy {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-strip {
    position: static;
  }

  .mode-strip-inner,
  .skill-dock,
  .skill-button-group,
  .act-grid,
  .character-grid,
  .package-grid,
  .hook-pair,
  .chapter-detail-grid {
    grid-template-columns: 1fr;
  }

  .localization-parameter-grid {
    grid-template-columns: 1fr;
  }

  .localization-select-field,
  .localization-select-field + .localization-select-field {
    padding-right: 0;
    padding-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .localization-select-field:first-child {
    border-top: 0;
  }

  .localization-select-field legend {
    min-height: 0;
  }

  .localization-character-bios-toggle {
    width: 100%;
  }

  .topbar {
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: clamp(8px, 2vw, 14px);
    min-height: 78px;
    padding: 12px clamp(10px, 3vw, 18px);
  }

  .brand-slogan {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    width: auto;
    padding: 4px 0 4px clamp(8px, 1.8vw, 14px);
    border-left: 2px solid var(--gold);
    border-top: 0;
    overflow: hidden;
    text-align: left;
  }

  .brand-slogan strong {
    font-size: clamp(13px, 3vw, 18px);
    line-height: 1.2;
    white-space: normal;
  }

  .brand-slogan span {
    font-size: clamp(8px, 1.7vw, 10px);
    line-height: 1.25;
  }

  .topbar .brand-lockup {
    gap: clamp(7px, 1.6vw, 12px);
  }

  .topbar .brand-mark {
    width: 46px;
    height: 54px;
    font-size: 28px;
  }

  .topbar h1 {
    font-size: clamp(27px, 5vw, 32px);
    white-space: nowrap;
  }

  .topbar .kicker {
    font-size: clamp(7px, 1.4vw, 9px);
    white-space: nowrap;
  }

  .top-actions {
    flex-wrap: nowrap;
  }

  .login-entry {
    margin-left: auto;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .mode-strip-inner {
    grid-template-columns: 1fr;
  }

  .mode-family {
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .mode-family:last-child {
    border-bottom: 0;
  }

  .mode-tab {
    min-height: 66px;
    padding: 8px;
  }

  .mode-tab strong {
    white-space: nowrap;
    font-size: 20px;
  }

  .mode-family-label {
    font-size: 14px;
  }

  .account-balance,
  #apiBadge {
    display: none;
  }

  #wordPackageGrid {
    grid-template-columns: 1fr;
  }

  .avatar-cropper {
    grid-template-columns: 1fr;
  }

  .avatar-crop-stage {
    max-width: 320px;
    margin: 0 auto;
  }

  .account-popover {
    position: fixed;
    top: 86px;
    right: 14px;
    max-height: calc(100dvh - 100px);
  }

  .skill-dock-head {
    padding-right: 0;
    padding-bottom: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .novel-source-grid {
    grid-template-columns: 1fr;
  }

  .file-dropzone {
    min-height: 220px;
  }

  .drama-submit-bar {
    align-items: stretch;
    flex-direction: column;
    bottom: 10px;
  }

  .drama-submit-bar button,
  .inline-custom-field {
    width: 100%;
    max-width: none;
  }

  .inline-custom-field {
    grid-template-columns: 1fr;
  }

  .inline-custom-field > small {
    grid-column: 1;
  }

  .audience-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .audience-group > strong {
    padding-top: 0;
  }

  .drama-result-actions {
    width: 100%;
  }

  .drama-result-actions button {
    flex: 1;
  }

  .drama-file-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .drama-file-icon {
    width: 44px;
    height: 54px;
    font-size: 10px;
  }

  .drama-file-status {
    grid-column: 2;
    white-space: normal;
  }

  .progress-stop-btn {
    width: 100%;
    justify-self: stretch;
  }

  .trend-row {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px 14px;
  }

  .trend-meter,
  .trend-scoreline {
    grid-column: 2;
  }

  .trend-copy {
    display: grid;
    gap: 4px;
  }

  .trend-copy b {
    min-width: 0;
  }

  .category-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .action-row {
    justify-content: stretch;
  }

  .action-row button,
  .story-controls label,
  .story-controls button {
    width: 100%;
  }

  .chapter-card summary {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .chapter-words {
    grid-column: 2;
  }

  .chapter-body {
    padding: 0 14px 16px;
  }

  .foreshadow-row {
    grid-template-columns: 1fr;
  }

  .auth-modal,
  .billing-modal,
  .invitation-modal,
  .activity-modal,
  .announcement-modal,
  .membership-expiry-modal,
  .legal-modal,
  .settings-modal {
    padding: 24px 18px;
  }

  .membership-expiry-summary {
    grid-template-columns: 1fr;
  }

  .membership-expiry-actions {
    grid-template-columns: 1fr;
  }

  .announcement-actions {
    grid-template-columns: 1fr;
  }

  .announcement-actions button {
    width: 100%;
  }

  .invitation-code-panel > div {
    align-items: stretch;
    flex-direction: column;
  }

  .invitation-code-panel strong {
    font-size: 28px;
  }

  .settings-row {
    grid-template-columns: 1fr;
  }

  .directory-status {
    max-width: 100%;
  }

  .settings-actions {
    display: grid;
  }

  .folder-list {
    grid-template-columns: 1fr;
  }

  .security-method-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .security-method-card button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .security-completion {
    align-items: stretch;
    flex-direction: column;
  }

  .security-completion button {
    width: 100%;
  }

  .security-verified-target {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 8px;
    min-height: 70px;
    padding: 10px 8px;
  }

  .topbar .brand-lockup {
    gap: 7px;
  }

  .topbar .brand-mark {
    width: 42px;
    height: 48px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .topbar .kicker {
    margin-bottom: 3px;
    font-size: 7px;
  }

  .brand-slogan {
    gap: 3px;
    padding-left: 8px;
  }

  .brand-slogan strong {
    font-size: 12px;
  }

  .brand-slogan span {
    font-size: 8px;
  }

  .login-entry {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .account-trigger {
    min-height: 42px;
    padding: 3px;
  }

  .account-trigger .account-avatar {
    width: 34px;
    height: 34px;
  }

  .localization-head {
    padding: 22px 18px;
  }

  .localization-title-lockup {
    gap: 12px;
  }

  .localization-slogan {
    gap: 3px;
    padding: 4px 0 4px 10px;
  }

  .localization-slogan strong {
    font-size: 15px;
  }

  .localization-slogan span {
    font-size: 11px;
  }

  .support-float,
  .support-float.left {
    right: 12px;
    left: auto;
    bottom: 12px;
    height: 48px;
  }

  .support-chat-panel,
  .support-chat-panel.left {
    right: 8px;
    left: 8px;
    bottom: 68px;
    width: auto;
    height: min(680px, calc(100vh - 80px));
  }

  .support-chat-message {
    width: 90%;
  }
}

/* ========================================================================== */
/* 2026 literary redesign: Paper Day / Ink Night                              */
/* This layer intentionally overrides the legacy visual system without        */
/* changing any production markup or behavior.                                */
/* ========================================================================== */

:root {
  color-scheme: light;
  --ui-canvas: #f6f1e8;
  --ui-canvas-subtle: #f0e9de;
  --ui-surface: #fbf8f2;
  --ui-surface-raised: #fffdf8;
  --ui-text: #26211d;
  --ui-text-secondary: #665e55;
  --ui-text-tertiary: #857c72;
  --ui-border: #d8d0c5;
  --ui-border-strong: #bdb4a8;
  --ui-primary: #9e443a;
  --ui-primary-hover: #85362f;
  --ui-primary-soft: #f1dfda;
  --ui-on-primary: #fffaf2;
  --ui-success: #4f725e;
  --ui-success-soft: #e4ece6;
  --ui-warning: #97641f;
  --ui-warning-soft: #f2e7d0;
  --ui-error: #a33c3a;
  --ui-error-soft: #f4dfdc;
  --ui-info: #526e81;
  --ui-overlay: rgba(29, 25, 21, 0.46);
  --ui-shadow-card: 0 14px 38px rgba(53, 43, 33, 0.065);
  --ui-shadow-float: 0 20px 56px rgba(37, 29, 23, 0.16);
  --ui-font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --ui-font-sans: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --ui-radius-input: 8px;
  --ui-radius-card: 12px;
  --ui-radius-modal: 16px;
  --ui-header-height: 72px;

  /* Map legacy semantic variables onto the new palette. */
  --paper: var(--ui-canvas);
  --paper-2: var(--ui-canvas-subtle);
  --sheet: var(--ui-surface-raised);
  --ink: var(--ui-text);
  --ink-2: var(--ui-text-secondary);
  --muted: var(--ui-text-secondary);
  --line: var(--ui-border);
  --line-dark: var(--ui-border-strong);
  --red: var(--ui-primary);
  --teal: var(--ui-success);
  --blue: var(--ui-info);
  --gold: #b27851;
  --radius: var(--ui-radius-input);
  --shadow: var(--ui-shadow-card);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ui-canvas: #0c110f;
  --ui-canvas-subtle: #0f1512;
  --ui-surface: #121815;
  --ui-surface-raised: #171e1a;
  --ui-text: #efe6d3;
  --ui-text-secondary: #b9b09f;
  --ui-text-tertiary: #8e8a7e;
  --ui-border: #2b342f;
  --ui-border-strong: #3a463f;
  --ui-primary: #d3a14e;
  --ui-primary-hover: #e2b768;
  --ui-primary-soft: #2a2318;
  --ui-on-primary: #111612;
  --ui-success: #7fa68c;
  --ui-success-soft: #17251d;
  --ui-warning: #d3a14e;
  --ui-warning-soft: #2a2318;
  --ui-error: #d98278;
  --ui-error-soft: #2b1d1b;
  --ui-info: #83a5b4;
  --ui-overlay: rgba(0, 0, 0, 0.68);
  --ui-shadow-card: 0 12px 32px rgba(0, 0, 0, 0.16);
  --ui-shadow-float: 0 22px 64px rgba(0, 0, 0, 0.38);
  --gold: var(--ui-primary);
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--ui-canvas);
}

body {
  min-height: 100vh;
  color: var(--ui-text);
  background: var(--ui-canvas);
  font-family: var(--ui-font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body,
.topbar,
.home-prompt-card,
.band,
.skill-dock,
.workspace-context-bar,
.mode-tab,
.modal-backdrop,
.auth-modal,
.billing-modal,
.invitation-modal,
.activity-modal,
.announcement-modal,
.membership-expiry-modal,
.legal-modal,
.ai-export-modal,
.settings-modal,
.history-drawer,
.support-chat-panel,
input,
select,
textarea,
button {
  transition-property: color, background-color, border-color, box-shadow, opacity;
  transition-duration: 170ms;
  transition-timing-function: ease;
}

h1,
h2,
h3,
h4,
.home-hero-copy blockquote p,
.mode-tab strong,
.outline-document,
.story-reader,
.drama-reader {
  font-family: var(--ui-font-serif);
}

p,
blockquote {
  margin-top: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font-family: var(--ui-font-sans);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
select,
textarea,
.brief-input,
.auth-panel input,
.security-form input,
.profile-form input,
.localization-select-field input[type="search"],
.history-search input,
.support-home-search input,
.support-chat-composer > textarea,
.support-resolution-card textarea {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--ui-text-tertiary);
  opacity: 0.76;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-primary) 72%, transparent);
  outline-offset: 3px;
}

::selection {
  color: var(--ui-on-primary);
  background: var(--ui-primary);
}

/* Header and brand --------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 28px;
  min-height: var(--ui-header-height);
  height: var(--ui-header-height);
  padding: 0 max(24px, calc((100vw - 1320px) / 2));
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  background: color-mix(in srgb, var(--ui-canvas) 94%, transparent);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.brand-lockup {
  gap: 12px;
}

.brand-mark,
.topbar .brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 10px;
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  box-shadow: none;
}

.brand-mark .cat-face {
  --cat-bg: #fff9ef;
  --cat-ink: #9e443a;
}

html[data-theme="dark"] .brand-mark {
  border: 1px solid var(--ui-primary);
  background: #151b18;
}

html[data-theme="dark"] .brand-mark .cat-face {
  --cat-bg: #d3a14e;
  --cat-ink: #151b18;
}

.topbar .brand-lockup > div:last-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.topbar .brand-lockup h1 {
  font-family: var(--ui-font-sans);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.topbar .kicker {
  margin: 0;
  color: var(--ui-text-secondary);
  font-size: 8px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.global-nav {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 30px;
}

.global-nav-link {
  position: relative;
  min-width: 74px;
  padding: 0 4px;
  border: 0;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}

.global-nav-link::after {
  content: "";
  position: absolute;
  right: 28%;
  bottom: -1px;
  left: 28%;
  height: 2px;
  background: var(--ui-primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 170ms ease;
}

.global-nav-link:hover,
.global-nav-link.active {
  color: var(--ui-text);
}

.global-nav-link.active::after {
  transform: scaleX(1);
}

.top-actions {
  justify-self: end;
  flex-wrap: nowrap;
  gap: 10px;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-input);
  background: var(--ui-canvas-subtle);
}

.theme-switcher button {
  min-width: 40px;
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.theme-switcher.compact button {
  min-width: 30px;
  width: 30px;
  padding: 0;
}

html[data-theme-preference="light"] [data-theme-choice="light"],
html[data-theme-preference="system"] [data-theme-choice="system"],
html[data-theme-preference="dark"] [data-theme-choice="dark"] {
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: 0 1px 4px rgba(36, 29, 23, 0.08);
}

html[data-theme="dark"][data-theme-preference="light"] [data-theme-choice="light"],
html[data-theme="dark"][data-theme-preference="system"] [data-theme-choice="system"],
html[data-theme="dark"][data-theme-preference="dark"] [data-theme-choice="dark"] {
  box-shadow: none;
}

.login-entry,
.primary-btn,
.dark-btn,
.ghost-btn,
.danger-btn,
.secondary-button,
.auth-submit,
.wechat-login-btn {
  min-height: 44px;
  padding: 9px 18px;
  border-radius: var(--ui-radius-input);
  font-weight: 650;
  letter-spacing: 0;
  box-shadow: none;
}

.creator-partner-entry {
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 6px 15px;
  border: 1px solid var(--ui-primary);
  border-radius: var(--ui-radius-input);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  box-shadow: none;
  text-align: left;
}

.creator-partner-entry:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
}

.creator-partner-entry span {
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.creator-partner-entry small {
  color: inherit;
  opacity: 0.82;
  font-size: 8px;
  line-height: 1.2;
}

.creator-partner-entry.has-status small {
  color: inherit;
}

.login-entry,
.primary-btn,
.auth-submit {
  border: 1px solid var(--ui-primary);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
}

.login-entry:hover,
.primary-btn:hover,
.auth-submit:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
  transform: none;
  box-shadow: none;
}

.dark-btn,
.support-send-button,
.support-start-chat-button {
  border-color: var(--ui-text);
  color: var(--ui-canvas);
  background: var(--ui-text);
}

.dark-btn:hover,
.support-send-button:hover,
.support-start-chat-button:hover {
  opacity: 0.88;
  transform: none;
  box-shadow: none;
}

.ghost-btn,
.secondary-button {
  border: 1px solid var(--ui-border-strong);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.ghost-btn:hover,
.secondary-button:hover {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  transform: none;
  box-shadow: none;
}

.danger-btn {
  border-color: var(--ui-error);
  color: var(--ui-on-primary);
  background: var(--ui-error);
}

.primary-btn:disabled,
.dark-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
  transform: none;
  box-shadow: none;
}

.api-badge {
  min-height: 28px;
  padding: 4px 9px;
  border-color: var(--ui-border);
  border-radius: 4px;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 11px;
  font-weight: 550;
}

/* Home --------------------------------------------------------------------- */

.app-shell {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 0 92px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(500px, 7fr);
  gap: clamp(54px, 6vw, 92px);
  align-items: center;
  width: min(1320px, calc(100% - 64px));
  min-height: calc(100vh - var(--ui-header-height));
  margin: 0 auto;
  padding: 74px 0 88px;
}

.home-hero-copy {
  min-width: 0;
  padding-right: clamp(0px, 2vw, 28px);
}

.hero-index {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 42px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ui-border-strong);
  color: var(--ui-text-secondary);
  font-size: 11px;
}

.hero-index b {
  color: var(--ui-primary);
  font-family: var(--ui-font-serif);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.hero-overline {
  margin: 0 0 16px;
  color: var(--ui-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.home-hero-copy h2 {
  max-width: 560px;
  margin: 0;
  color: var(--ui-text);
  font-size: clamp(46px, 4.25vw, 66px);
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.hero-period {
  display: block;
  width: 20px;
  height: 20px;
  margin: 22px 0 22px min(36%, 180px);
  border-radius: 50%;
  background: var(--ui-primary);
}

.hero-subtitle {
  max-width: 470px;
  margin: 0 0 30px;
  color: var(--ui-text-secondary);
  font-size: 15px;
  line-height: 1.8;
}

.home-hero-copy blockquote {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px 12px;
  max-width: 470px;
  margin: 0;
  padding: 16px 20px 16px 18px;
  border-left: 2px solid var(--ui-primary);
  color: var(--ui-text-secondary);
  background: color-mix(in srgb, var(--ui-surface) 76%, transparent);
}

.home-hero-copy blockquote > span {
  grid-row: 1 / 3;
  color: var(--ui-primary);
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.home-hero-copy blockquote p {
  margin: 0;
  color: var(--ui-text);
  font-size: 14px;
  line-height: 1.7;
}

.home-hero-copy blockquote small {
  color: var(--ui-text-tertiary);
  font-size: 11px;
}

.home-prompt-card {
  position: relative;
  min-width: 0;
  padding: clamp(32px, 3.4vw, 48px);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}

.home-prompt-card::before,
.home-prompt-card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.home-prompt-card::before {
  top: 10px;
  left: 10px;
  border-top: 1px solid var(--ui-border-strong);
  border-left: 1px solid var(--ui-border-strong);
}

.home-prompt-card::after {
  right: 10px;
  bottom: 10px;
  border-right: 1px solid var(--ui-border-strong);
  border-bottom: 1px solid var(--ui-border-strong);
}

.prompt-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.prompt-card-head p {
  margin: 0 0 5px;
  color: var(--ui-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.prompt-card-head h3 {
  color: var(--ui-text);
  font-size: clamp(30px, 2.6vw, 40px);
  font-weight: 500;
  line-height: 1.25;
}

.prompt-brand-stamp {
  display: grid;
  place-items: center;
  width: 40px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--ui-primary) 72%, var(--ui-border));
  color: var(--ui-primary);
  font-family: var(--ui-font-serif);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.home-path-selector {
  display: flex;
  gap: 0;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--ui-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.home-path-selector::-webkit-scrollbar {
  display: none;
}

.home-path-selector button {
  position: relative;
  min-width: max-content;
  min-height: 42px;
  padding: 7px 14px;
  border: 0;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 13px;
}

.home-path-selector button::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  background: var(--ui-primary);
  transform: scaleX(0);
}

.home-path-selector button:hover,
.home-path-selector button.active {
  color: var(--ui-primary);
}

.home-path-selector button.active::after {
  transform: scaleX(1);
}

.home-prompt-field {
  display: grid;
  gap: 10px;
  margin: 0;
  color: var(--ui-text-secondary);
  font-size: 12px;
}

.home-prompt-field textarea {
  width: 100%;
  min-height: 182px;
  padding: 18px;
  resize: vertical;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  font-family: var(--ui-font-serif);
  font-size: 16px;
  line-height: 1.8;
}

.home-prompt-field textarea:focus {
  border-color: var(--ui-primary);
}

.home-prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 14px 0 20px;
}

.home-prompt-suggestions button {
  min-height: 34px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 12px;
}

.home-prompt-suggestions button:hover {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
}

.home-prompt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-border);
}

.home-prompt-actions > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ui-text-tertiary);
  font-size: 11px;
}

.home-prompt-actions > span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ui-success);
}

.home-prompt-actions .primary-btn {
  min-width: 142px;
}

.home-prompt-actions .primary-btn b {
  margin-left: 12px;
}

/* Path cards --------------------------------------------------------------- */

.pathway-section {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
  padding: 72px 0 92px;
  border-top: 1px solid var(--ui-border);
}

.pathway-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.pathway-heading p {
  margin: 0 0 5px;
  color: var(--ui-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.pathway-heading h2 {
  color: var(--ui-text);
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 500;
  line-height: 1.25;
}

.pathway-heading > span {
  padding-bottom: 6px;
  color: var(--ui-text-tertiary);
  font-size: 12px;
}

.mode-strip {
  position: static;
  z-index: auto;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.mode-strip-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.mode-family {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-width: 0;
  border: 0;
}

.mode-family-label,
.drama-family .mode-family-label {
  display: block;
  padding: 0;
  color: var(--ui-text-tertiary);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: left;
}

.mode-family-actions,
.drama-family .mode-family-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-tab {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  justify-content: stretch;
  gap: 18px;
  min-width: 0;
  min-height: 236px;
  padding: 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  color: var(--ui-text);
  background: color-mix(in srgb, var(--ui-surface) 74%, transparent);
  text-align: left;
  box-shadow: none;
}

.mode-tab::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 28px;
  left: 28px;
  height: 2px;
  background: var(--ui-primary);
  opacity: 0;
}

.mode-tab:hover {
  border-color: var(--ui-border-strong);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  transform: translateY(-2px);
  box-shadow: var(--ui-shadow-card);
}

.mode-tab.active,
.drama-family .mode-tab.active {
  border-color: color-mix(in srgb, var(--ui-primary) 54%, var(--ui-border));
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.mode-tab.active::before {
  opacity: 1;
}

.path-index {
  color: var(--ui-text-tertiary);
  font-family: var(--ui-font-serif);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.mode-tab strong {
  overflow: visible;
  color: inherit;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
}

.mode-tab small {
  display: block;
  color: var(--ui-text-secondary);
  font-size: 13px;
  line-height: 1.75;
}

.mode-tab b {
  align-self: end;
  color: var(--ui-primary);
  font-size: 12px;
  font-weight: 650;
}

/* Creation workspace ------------------------------------------------------- */

.creation-workspace-anchor {
  height: 0;
  scroll-margin-top: 152px;
}

.workspace-context-bar,
.skill-dock,
.workspace {
  width: min(1200px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.workspace-context-bar {
  position: sticky;
  top: var(--ui-header-height);
  z-index: 28;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  margin-bottom: 20px;
  padding: 10px 16px;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text-secondary);
  background: color-mix(in srgb, var(--ui-canvas) 94%, transparent);
  backdrop-filter: blur(14px);
}

.workspace-context-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  white-space: nowrap;
}

.workspace-context-title span {
  color: var(--ui-text-tertiary);
  font-size: 11px;
}

.workspace-context-title strong {
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: 18px;
  font-weight: 550;
}

.workspace-step-labels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.workspace-step-labels::-webkit-scrollbar {
  display: none;
}

.workspace-step-labels span {
  min-width: max-content;
  color: var(--ui-text-tertiary);
  font-size: 12px;
}

.workspace-step-labels span.active {
  color: var(--ui-primary);
  font-weight: 700;
}

.workspace-step-labels i {
  width: clamp(18px, 3vw, 46px);
  min-width: 18px;
  height: 1px;
  background: var(--ui-border);
}

.workspace-context-bar > small {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--ui-text-tertiary);
  font-size: 10px;
}

.workspace-context-bar > small b {
  color: var(--ui-success);
  font-size: 8px;
}

.skill-dock {
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: none;
}

.skill-dock-head {
  padding-right: 20px;
  border-right: 1px solid var(--ui-border);
}

.skill-dock-head strong {
  color: var(--ui-text);
  font-size: 20px;
  font-weight: 550;
}

.skill-choice {
  min-height: 74px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.skill-choice:hover {
  border-color: var(--ui-primary);
  transform: none;
}

.skill-choice.active {
  border-color: var(--ui-primary);
  color: var(--ui-text);
  background: var(--ui-primary-soft);
  box-shadow: inset 3px 0 0 var(--ui-primary);
}

.skill-choice.active span {
  color: var(--ui-text-secondary);
}

.workspace {
  min-width: 0;
}

.band {
  margin-bottom: 20px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: none;
  overflow: clip;
}

.hero-band {
  background: var(--ui-surface);
}

.section-head,
.compact-head {
  gap: 18px;
  padding: clamp(22px, 3vw, 32px);
  border-bottom-color: var(--ui-border);
}

.section-head h2,
.drama-head h2,
.localization-head h2,
.compact-head h2.creation-section-title,
.drama-head h2.creation-section-title,
.localization-head h2.creation-section-title {
  color: var(--ui-text);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 550;
  line-height: 1.3;
}

.eyebrow,
.kicker,
.rail-label {
  color: var(--ui-primary);
  letter-spacing: 0.12em;
}

.section-number {
  color: color-mix(in srgb, var(--ui-text) 7%, transparent);
}

.category-host {
  padding: 0 clamp(22px, 3vw, 32px);
}

.category-group {
  border-top-color: var(--ui-border);
}

.group-title,
.field-label,
.drama-fieldset legend small,
.localization-select-field legend small,
.file-status,
.delivery-title-meta {
  color: var(--ui-text-secondary);
}

.group-title strong,
.field-label > strong {
  color: var(--ui-text);
}

.chip,
.drama-choice,
.duration-unit-toggle button,
.page-controls button,
.section-selector button,
.outline-tags,
.tag-count {
  border-color: var(--ui-border);
  border-radius: 4px;
  color: var(--ui-text-secondary);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.chip:hover,
.drama-choice:hover,
.duration-unit-toggle button:hover,
.page-controls button:hover,
.section-selector button:hover {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
  transform: none;
}

.chip.active,
.drama-choice.active,
.duration-unit-toggle button.active,
.page-controls button.active,
.section-selector button.active {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.action-row {
  border-top-color: var(--ui-border);
}

.brief-input,
.novel-paste-field textarea,
.optional-fieldset textarea,
.localization-select-field input[type="search"],
.support-chat-composer > textarea {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.drama-workbench,
.localization-workbench {
  border-color: var(--ui-border);
}

.drama-head,
.localization-head {
  background: var(--ui-surface);
}

.localization-head {
  border-color: var(--ui-border);
}

.localization-slogan {
  border-left-color: var(--ui-primary);
}

.localization-slogan strong,
.localization-skill-badge {
  color: var(--ui-primary);
}

.localization-slogan span {
  color: var(--ui-text-secondary);
}

.drama-form,
.localization-form {
  color: var(--ui-text);
  background: transparent;
}

.drama-fieldset,
.localization-select-field,
.localization-character-bios-fieldset {
  border-color: var(--ui-border);
}

.drama-fieldset legend strong,
.localization-select-field legend strong,
.localization-character-bios-copy strong {
  color: var(--ui-text);
}

.file-dropzone {
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text-secondary);
  background: var(--ui-canvas-subtle);
}

.file-dropzone:hover,
.file-dropzone:focus-visible,
.file-dropzone.dragging {
  border-color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.file-pick-button,
.upload-symbol {
  color: var(--ui-primary);
}

.inline-custom-field,
.custom-number-control,
.custom-duration-control,
.regenerate-episode-row input {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.localization-toggle-track {
  border-color: var(--ui-border-strong);
  background: var(--ui-canvas-subtle);
}

.localization-character-bios-toggle input:checked + .localization-toggle-track {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
}

.localization-cost-copy,
.drama-task-count,
.drama-submit-bar {
  border-color: var(--ui-border);
  background: var(--ui-canvas-subtle);
}

.drama-submit-bar {
  box-shadow: none;
}

/* Outline, reader and result surfaces ------------------------------------- */

.trend-card,
.trend-row,
.trend-note,
.outline-document,
.act-card,
.chapter-card,
.hook-box,
.character-card,
.foreshadow-row,
.regen-panel,
.story-reader,
.drama-file-card,
.drama-reader {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.trend-meter,
.progress-track {
  border-color: var(--ui-border);
  background: var(--ui-canvas-subtle);
}

.trend-meter i,
.progress-bar {
  background: var(--ui-primary);
}

.trend-copy span,
.trend-note p,
.outline-doc-head p,
.act-card p,
.act-card small,
.chapter-card summary p,
.chapter-summary,
.hook-box p,
.character-card p,
.drama-file-card > div > span,
.drama-line,
.drama-action,
.drama-cast,
.drama-screen,
.drama-bullet {
  color: var(--ui-text-secondary);
}

.act-card span,
.chapter-index,
.trend-rank,
.drama-file-status {
  color: var(--ui-primary);
}

.mini-tags span,
.outline-chips span,
.character-card span {
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
  background: var(--ui-canvas-subtle);
}

.story-reader,
.drama-reader {
  max-width: 880px;
  margin-right: auto;
  margin-left: auto;
  padding: clamp(28px, 5vw, 64px);
  font-size: 18px;
  line-height: 1.82;
}

.story-reader {
  min-height: 560px;
}

.story-controls,
.page-controls {
  border-color: var(--ui-border);
}

.export-menu {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: var(--ui-shadow-float);
}

.export-menu button {
  color: var(--ui-text);
  background: transparent;
}

.export-menu button:hover {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.ai-generated-badge {
  border-color: color-mix(in srgb, var(--ui-primary) 52%, var(--ui-border));
  border-radius: 4px;
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.drama-file-icon {
  border-color: var(--ui-border-strong);
  color: var(--ui-primary);
  background: var(--ui-canvas-subtle);
}

.drama-file-icon::after {
  border-color: var(--ui-border-strong);
}

/* Progress, toast and operational feedback -------------------------------- */

.progress-panel {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: var(--ui-shadow-float);
}

.progress-copy span,
.progress-telemetry,
.progress-long-task-notice {
  color: var(--ui-text-secondary);
}

.progress-long-task-notice,
.progress-long-task-alert {
  border-color: color-mix(in srgb, var(--ui-warning) 44%, var(--ui-border));
  color: var(--ui-warning);
  background: var(--ui-warning-soft);
}

.progress-health {
  color: var(--ui-success);
}

.progress-health i {
  background: currentColor;
}

.progress-health.is-waiting,
.progress-health.is-recovering {
  color: var(--ui-warning);
}

.progress-bar::after {
  background: rgba(255, 255, 255, 0.28);
}

.progress-stop-btn {
  border-color: var(--ui-error);
  border-radius: var(--ui-radius-input);
  color: var(--ui-error);
  background: var(--ui-error-soft);
}

.toast {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: var(--ui-shadow-float);
}

/* Drawers, account and modal system --------------------------------------- */

.modal-backdrop {
  background: var(--ui-overlay);
  backdrop-filter: blur(4px);
}

.auth-modal,
.billing-modal,
.invitation-modal,
.activity-modal,
.announcement-modal,
.membership-expiry-modal,
.legal-modal,
.ai-export-modal,
.settings-modal {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-modal);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-float);
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text-secondary);
  background: var(--ui-surface-raised);
}

.modal-close:hover {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.auth-brand > span,
.support-chat-mark {
  border-radius: 10px;
  background: var(--ui-primary);
  box-shadow: none;
}

.auth-brand > span .cat-face,
.support-chat-mark .cat-face,
.account-avatar.cat-avatar .cat-face {
  --cat-bg: #fff9ef;
  --cat-ink: #9e443a;
}

html[data-theme="dark"] .auth-brand > span,
html[data-theme="dark"] .support-chat-mark {
  border: 1px solid var(--ui-primary);
  background: #151b18;
}

html[data-theme="dark"] .auth-brand > span .cat-face,
html[data-theme="dark"] .support-chat-mark .cat-face,
html[data-theme="dark"] .account-avatar.cat-avatar .cat-face {
  --cat-bg: #d3a14e;
  --cat-ink: #151b18;
}

.auth-brand p,
.billing-modal header p,
.activity-modal header p,
.announcement-modal header p,
.invitation-modal header p,
.legal-head p,
.settings-head p {
  color: var(--ui-primary);
  letter-spacing: 0.12em;
}

.auth-brand strong,
.billing-modal header h2,
.activity-modal header h2,
.announcement-modal header h2,
.invitation-modal header h2,
.membership-expiry-modal header h2,
.legal-head h2,
.settings-head h2,
.ai-export-head h2 {
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-weight: 550;
}

.auth-tabs,
.phone-auth-modes {
  border-color: var(--ui-border);
  background: var(--ui-canvas-subtle);
}

.auth-tabs button,
.phone-auth-modes button {
  color: var(--ui-text-secondary);
  background: transparent;
}

.auth-tabs button.active,
.phone-auth-modes button.active {
  color: var(--ui-primary);
  background: var(--ui-surface-raised);
}

.wechat-login-btn {
  border-color: var(--ui-success);
  color: var(--ui-text);
  background: var(--ui-success-soft);
}

.dev-code-hint,
.wechat-binding-note,
.billing-note,
.billing-disclaimer,
.auth-consent-hint,
.settings-note,
.customer-service-note {
  color: var(--ui-text-secondary);
}

.auth-inline-link,
.legal-link {
  color: var(--ui-primary);
}

.ai-export-default-note,
.ai-export-choice,
.ai-export-responsibility,
.legal-intro,
.legal-document section,
.membership-expiry-summary,
.announcement-details,
.activity-details,
.invitation-code-panel,
.invitation-stats > div,
.invitation-recent > div,
.settings-row,
.security-completion,
.security-method-card,
.security-verified-target,
.billing-product-group,
.billing-benefit,
.payment-method,
.payment-checkout {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.ai-export-choice:hover,
.security-method-card:hover,
.payment-method:hover {
  border-color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.ai-export-choice small,
.ai-export-default-note p,
.ai-export-responsibility p,
.legal-document p,
.legal-document li,
.membership-expiry-summary p,
.settings-row span,
.security-completion span,
.security-method-card span,
.security-flow > header p,
.billing-benefit span,
.billing-benefit small {
  color: var(--ui-text-secondary);
}

.settings-theme-switcher {
  justify-self: end;
}

.directory-status {
  border-color: var(--ui-border);
  border-radius: 4px;
  color: var(--ui-text-secondary);
  background: var(--ui-canvas-subtle);
}

.security-method-icon {
  border-color: var(--ui-border);
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.security-error,
.auth-consent-hint.error {
  color: var(--ui-error);
  background: var(--ui-error-soft);
}

.invitation-link-btn {
  border-radius: var(--ui-radius-input);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  animation: none;
  box-shadow: none;
}

.history-drawer {
  border-left: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-float);
}

.drawer-head {
  border-bottom-color: var(--ui-border);
}

.history-search input {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.history-item {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.history-item:hover {
  border-color: var(--ui-primary);
}

.history-item span,
.history-item small,
.ledger-row small {
  color: var(--ui-text-secondary);
}

.account-trigger {
  min-height: 42px;
  padding: 3px 10px 3px 3px;
  border-color: var(--ui-border);
  border-radius: 8px;
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.account-avatar {
  background-color: var(--ui-primary);
}

.account-popover {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: var(--ui-shadow-float);
  scrollbar-color: var(--ui-border-strong) var(--ui-canvas-subtle);
}

.account-popover::-webkit-scrollbar-track {
  background: var(--ui-canvas-subtle);
}

.account-popover::-webkit-scrollbar-thumb {
  border-color: var(--ui-canvas-subtle);
  background: var(--ui-border-strong);
}

.account-profile #accountPhone,
.account-profile .account-public-id,
.account-menu-list small,
.balance-panel small {
  color: var(--ui-text-secondary);
}

.member-badge,
.account-profile .member-status-block .member-badge {
  border-color: var(--ui-border-strong);
  color: var(--ui-text-secondary);
}

.member-badge.active,
.account-profile .member-status-block .member-badge.active,
.member-expiry {
  border-color: color-mix(in srgb, var(--ui-primary) 55%, var(--ui-border));
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.account-popover .ghost-btn,
.balance-panel {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-canvas-subtle);
}

.balance-panel strong {
  color: var(--ui-primary);
}

.account-menu-list {
  border-top-color: var(--ui-border);
}

.account-menu-list button {
  border-bottom-color: var(--ui-border);
  color: var(--ui-text);
  background: transparent;
}

.account-menu-list button:hover {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

/* Customer support --------------------------------------------------------- */

.support-float {
  min-height: 48px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-input);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: var(--ui-shadow-float);
}

.support-float:hover,
.support-float:focus-visible {
  border-color: var(--ui-primary);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  transform: none;
}

.support-float:hover .support-float-icon,
.support-float:focus-visible .support-float-icon {
  color: var(--ui-on-primary);
}

.support-float-icon {
  color: var(--ui-primary);
}

.support-chat-panel {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-modal);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-float);
  overflow: hidden;
}

.support-chat-header {
  border-bottom-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.support-chat-header small,
.support-home-topics header small,
.support-chat-message header,
.support-attachment-row {
  color: var(--ui-text-secondary);
}

.support-chat-header > button {
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
  background: var(--ui-surface-raised);
}

.support-home-view,
.support-conversation-view,
.support-chat-messages {
  background: var(--ui-surface);
}

.support-home-search input,
.support-chat-composer,
.support-chat-composer > textarea {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

.support-home-topics li {
  border-color: var(--ui-border);
}

.support-home-topics li button,
.support-attachment-row label,
.support-attachment-row button,
.support-chat-message a {
  color: var(--ui-primary);
}

.support-chat-message > div,
.support-resolution-card {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  box-shadow: none;
}

.support-chat-message.user > div {
  border-color: color-mix(in srgb, var(--ui-primary) 44%, var(--ui-border));
  background: var(--ui-primary-soft);
}

.support-chat-message.system > div {
  color: var(--ui-text-secondary);
  background: var(--ui-canvas-subtle);
}

.support-chat-composer {
  border-top-color: var(--ui-border);
}

.support-leave-queue-button {
  border-color: var(--ui-error);
  color: var(--ui-error);
  background: var(--ui-error-soft);
}

.support-resolution-card {
  border-left-color: var(--ui-primary);
}

.support-resolution-options button {
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
  background: var(--ui-canvas-subtle);
}

.support-resolution-options button.active,
.support-resolution-card .support-feedback-submit {
  border-color: var(--ui-primary);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
}

.support-resolution-card fieldset button {
  color: var(--ui-border-strong);
}

.support-resolution-card fieldset button.active {
  color: var(--ui-primary);
}

.customer-service-qr {
  border-color: var(--ui-border);
  background: #ffffff;
}

/* Dark-mode hard-color cleanup -------------------------------------------- */

html[data-theme="dark"] .home-prompt-card,
html[data-theme="dark"] .mode-tab,
html[data-theme="dark"] .band,
html[data-theme="dark"] .skill-dock,
html[data-theme="dark"] .progress-panel,
html[data-theme="dark"] .account-popover,
html[data-theme="dark"] .support-chat-panel,
html[data-theme="dark"] .history-drawer,
html[data-theme="dark"] .auth-modal,
html[data-theme="dark"] .billing-modal,
html[data-theme="dark"] .invitation-modal,
html[data-theme="dark"] .activity-modal,
html[data-theme="dark"] .announcement-modal,
html[data-theme="dark"] .membership-expiry-modal,
html[data-theme="dark"] .legal-modal,
html[data-theme="dark"] .ai-export-modal,
html[data-theme="dark"] .settings-modal {
  background-image: none;
}

html[data-theme="dark"] img:not(.customer-service-qr img):not(.activity-image-wrap img):not(.brand-mark-art img) {
  filter: none;
}

/* Mobile primary navigation ------------------------------------------------ */

.mobile-primary-nav {
  display: none;
}

/* Responsive: 1180 --------------------------------------------------------- */

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(190px, 1fr) auto minmax(250px, 1fr);
    gap: 18px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .global-nav {
    gap: 18px;
  }

  .home-hero {
    width: min(1080px, calc(100% - 48px));
    grid-template-columns: minmax(0, 5fr) minmax(460px, 7fr);
    gap: 44px;
  }

  .pathway-section {
    width: min(1080px, calc(100% - 48px));
  }

  .mode-tab {
    min-height: 220px;
    padding: 20px;
  }

  .workspace-context-bar {
    gap: 18px;
  }

  .workspace-context-bar > small {
    display: none;
  }

  .workspace-context-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* Responsive: 960 ---------------------------------------------------------- */

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: minmax(190px, 1fr) auto;
  }

  .global-nav {
    display: none;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 54px;
    width: min(760px, calc(100% - 48px));
    min-height: auto;
    padding: 64px 0 74px;
  }

  .home-hero-copy {
    padding-right: 0;
  }

  .home-hero-copy h2 {
    max-width: 680px;
    font-size: clamp(48px, 8vw, 64px);
  }

  .hero-period {
    margin-left: 180px;
  }

  .pathway-section {
    width: min(760px, calc(100% - 48px));
  }

  .mode-strip-inner {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .mode-tab {
    min-height: 210px;
  }

  .workspace-context-bar,
  .skill-dock,
  .workspace {
    width: min(760px, calc(100% - 48px));
  }

  .workspace-context-bar {
    position: static;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 0;
    background: transparent;
    backdrop-filter: none;
  }

  .workspace-step-labels {
    justify-content: flex-start;
  }

  .skill-dock {
    grid-template-columns: 1fr;
  }

  .skill-dock-head {
    padding: 0 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .skill-button-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Responsive: 768 ---------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --ui-header-height: 64px;
  }

  html {
    scroll-padding-bottom: 78px;
  }

  body {
    padding-bottom: 72px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: var(--ui-header-height);
    height: var(--ui-header-height);
    padding: 0 16px;
  }

  .topbar .brand-lockup {
    gap: 9px;
  }

  .brand-mark,
  .topbar .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 8px;
  }

  .topbar .brand-mark .cat-face {
    transform: scale(0.72);
  }

  .topbar .brand-lockup h1 {
    font-size: 16px;
  }

  .topbar .kicker {
    font-size: 7px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions > .theme-switcher,
  .top-actions > .api-badge,
  .account-balance {
    display: none;
  }

  .login-entry {
    min-height: 40px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .creator-partner-entry {
    min-height: 38px;
    padding: 6px 11px;
  }

  .creator-partner-entry small {
    display: none;
  }

  .account-trigger {
    min-width: 40px;
    min-height: 40px;
    padding: 2px;
  }

  .account-trigger .account-avatar {
    width: 34px;
    height: 34px;
  }

  .notification-trigger {
    width: 40px;
    height: 40px;
  }

  .notification-trigger svg {
    width: 21px;
    height: 21px;
  }

  .notification-badge {
    top: -4px;
    right: -4px;
  }

  .notification-popover {
    position: fixed;
    top: 70px;
    right: -6px;
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 152px);
  }

  .notification-popover-head {
    padding: 17px 16px 14px;
  }

  .notification-popover-head h2 {
    font-size: 23px;
  }

  .system-message-list {
    max-height: calc(100dvh - 272px);
  }

  .system-message-item {
    padding: 16px;
  }

  .account-popover {
    position: fixed;
    top: 70px;
    right: 10px;
    width: min(420px, calc(100vw - 20px));
    max-height: calc(100dvh - 152px);
  }

  .home-hero,
  .pathway-section,
  .workspace-context-bar,
  .skill-dock,
  .workspace {
    width: calc(100% - 32px);
  }

  .home-hero {
    gap: 40px;
    padding: 46px 0 58px;
  }

  .hero-index {
    margin-bottom: 28px;
  }

  .hero-overline {
    margin-bottom: 12px;
  }

  .home-hero-copy h2 {
    font-size: clamp(36px, 11vw, 48px);
    line-height: 1.26;
  }

  .hero-period {
    width: 14px;
    height: 14px;
    margin: 16px 0 18px 108px;
  }

  .hero-subtitle {
    margin-bottom: 22px;
    font-size: 14px;
  }

  .home-prompt-card {
    padding: 26px 20px;
  }

  .prompt-card-head h3 {
    font-size: 28px;
  }

  .home-prompt-field textarea {
    min-height: 156px;
    padding: 14px;
  }

  .home-prompt-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .home-prompt-actions .primary-btn {
    width: 100%;
  }

  .pathway-section {
    padding: 54px 0 64px;
  }

  .pathway-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .pathway-heading h2 {
    font-size: 30px;
  }

  .mode-family-actions,
  .drama-family .mode-family-actions {
    grid-template-columns: 1fr;
  }

  .mode-tab {
    min-height: 178px;
    padding: 20px;
    gap: 12px;
  }

  .workspace-context-bar {
    margin-bottom: 16px;
  }

  .workspace-step-labels {
    margin: 0 -16px;
    padding: 4px 16px;
  }

  .skill-button-group {
    grid-template-columns: 1fr;
  }

  .band,
  .skill-dock {
    border-radius: 10px;
  }

  .section-head,
  .compact-head,
  .localization-head,
  .drama-head {
    align-items: flex-start;
    padding: 22px 18px;
  }

  .section-head h2,
  .drama-head h2,
  .localization-head h2,
  .compact-head h2.creation-section-title,
  .drama-head h2.creation-section-title,
  .localization-head h2.creation-section-title {
    font-size: 27px;
  }

  .category-host {
    padding: 0 18px;
  }

  .action-row {
    padding: 20px 18px 0;
  }

  .action-row button,
  .story-controls button,
  .story-controls label,
  .drama-result-actions button,
  .drama-submit-bar button {
    min-height: 46px;
  }

  .story-reader,
  .drama-reader {
    min-height: 420px;
    padding: 26px 20px;
    font-size: 17px;
    line-height: 1.78;
  }

  .auth-modal,
  .billing-modal,
  .invitation-modal,
  .activity-modal,
  .announcement-modal,
  .membership-expiry-modal,
  .legal-modal,
  .ai-export-modal,
  .settings-modal {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 24px);
    padding: 24px 18px;
    border-radius: 14px;
  }

  .settings-theme-switcher {
    justify-self: stretch;
    width: 100%;
  }

  .settings-theme-switcher button {
    flex: 1;
    min-height: 40px;
  }

  .history-drawer {
    width: 100%;
    max-width: 100%;
  }

  .support-float,
  .support-float.left {
    right: 12px;
    bottom: 82px;
    left: auto;
    min-width: 48px;
  }

  .support-chat-panel,
  .support-chat-panel.left {
    right: 8px;
    bottom: 78px;
    left: 8px;
    width: auto;
    height: min(680px, calc(100dvh - 92px));
  }

  .mobile-primary-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 68px;
    padding: 5px max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--ui-border);
    background: color-mix(in srgb, var(--ui-surface) 96%, transparent);
    box-shadow: 0 -8px 28px rgba(24, 20, 16, 0.08);
    backdrop-filter: blur(14px);
  }

  .mobile-primary-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1px;
    min-width: 44px;
    min-height: 54px;
    padding: 3px 4px;
    border: 0;
    border-radius: 8px;
    color: var(--ui-text-tertiary);
    background: transparent;
  }

  .mobile-primary-nav button.active {
    color: var(--ui-primary);
    background: var(--ui-primary-soft);
  }

  .mobile-primary-nav span {
    font-size: 19px;
    font-weight: 400;
    line-height: 1;
  }

  .mobile-primary-nav b {
    font-size: 10px;
    font-weight: 600;
  }

  .site-footer {
    width: calc(100% - 32px);
    margin-bottom: 18px;
  }
}

/* Membership-gated reading and TXT export -------------------------------- */

.drama-choice.member-locked,
.export-menu button.member-locked {
  position: relative;
  border-color: color-mix(in srgb, var(--ui-border) 78%, transparent);
  color: var(--ui-text-tertiary);
  background: color-mix(in srgb, var(--ui-surface-muted) 88%, transparent);
  box-shadow: none;
  cursor: pointer;
  opacity: 0.72;
}

.drama-choice.member-locked:hover,
.export-menu button.member-locked:hover {
  border-color: color-mix(in srgb, var(--ui-accent-gold) 55%, var(--ui-border));
  color: var(--ui-text-secondary);
  background: color-mix(in srgb, var(--ui-accent-gold) 10%, var(--ui-surface-muted));
  transform: none;
}

.drama-choice.member-locked::after,
.export-menu button.member-locked::after {
  content: "会员";
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #6a4614;
  background: #dfb45e;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: 0.04em;
  vertical-align: 2px;
}

#storyArea,
#dramaResultArea,
#localizationResultArea {
  position: relative;
  overflow: hidden;
}

.free-preview-protected #storyReader,
.free-preview-protected #dramaReader,
.free-preview-protected #localizationReader {
  user-select: none;
  -webkit-user-select: none;
}

.free-preview-watermark {
  position: absolute;
  inset: -16%;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  grid-auto-rows: 112px;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  color: rgba(164, 67, 57, 0.14);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.16em;
  pointer-events: none;
  transform: rotate(-18deg);
  transform-origin: center;
}

html[data-theme="dark"] .free-preview-watermark {
  color: rgba(222, 173, 83, 0.14);
}

.free-capture-shield {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-content: center;
  gap: 10px;
  color: #fffaf2;
  background: #211d18;
  text-align: center;
}

.free-capture-shield[hidden] {
  display: none;
}

.free-capture-shield strong {
  font-family: var(--ui-font-serif);
  font-size: clamp(26px, 5vw, 42px);
}

.free-capture-shield span {
  color: #d7c8b4;
  font-size: 13px;
}

.membership-gate-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 85;
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: clamp(24px, 4vw, 36px);
  transform: translate(-50%, -50%);
  overflow: auto;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-modal);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.34);
}

.membership-gate-modal > header {
  padding: 0 46px 20px 0;
  border-bottom: 1px solid var(--ui-border);
}

.membership-gate-modal > header p {
  margin: 0 0 6px;
  color: var(--ui-primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.membership-gate-modal > header h2 {
  margin: 0;
  font-family: var(--ui-font-serif);
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
}

.membership-gate-modal > header span {
  display: block;
  margin-top: 8px;
  color: var(--ui-text-secondary);
  line-height: 1.65;
}

.membership-gate-highlight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--ui-accent-gold) 52%, var(--ui-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--ui-accent-gold) 10%, var(--ui-surface-muted));
}

.membership-gate-highlight > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  color: #fffaf2;
  background: var(--ui-primary);
  font-family: var(--ui-font-serif);
  font-size: 24px;
  font-weight: 900;
}

.membership-gate-highlight div,
.membership-gate-highlight strong,
.membership-gate-highlight small {
  display: block;
}

.membership-gate-highlight small {
  margin-top: 4px;
  color: var(--ui-text-secondary);
}

.membership-gate-benefits,
.member-benefit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.membership-gate-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.membership-gate-benefits li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface-raised);
}

.membership-gate-benefits li > b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ui-primary) 40%, var(--ui-border));
  border-radius: 8px;
  color: var(--ui-primary);
  font-size: 11px;
}

.membership-gate-benefits span,
.membership-gate-benefits strong,
.membership-gate-benefits small {
  display: block;
}

.membership-gate-benefits strong {
  font-size: 13px;
}

.membership-gate-benefits small {
  margin-top: 4px;
  color: var(--ui-text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.membership-gate-note {
  margin: 16px 0 0;
  color: var(--ui-text-tertiary);
  font-size: 10px;
  line-height: 1.6;
}

.membership-gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.member-benefit {
  align-items: flex-start;
  min-height: 0;
}

.member-benefit > div {
  width: 100%;
}

.member-benefit-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.member-benefit-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 2px 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 250, 242, 0.24);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.08);
}

.member-benefit-list li > span {
  grid-row: 1 / span 2;
  display: grid;
  width: 26px;
  height: 26px;
  margin: 0;
  place-items: center;
  border-radius: 7px;
  color: #5d3511;
  background: #e1b866;
  font-size: 10px;
  font-weight: 900;
}

.member-benefit-list b,
.member-benefit-list small {
  display: block;
  min-width: 0;
}

.member-benefit-list b {
  color: #fffaf2;
  font-size: 11px;
}

.member-benefit-list small,
.member-benefit-list .member-ai-label-benefit {
  margin: 0;
  color: #f4dcd5;
  font-size: 9px;
  line-height: 1.45;
}

html[data-theme="dark"] .membership-gate-modal {
  border-color: var(--ui-border);
  background: var(--ui-surface-raised);
}

@media (max-width: 900px) {
  .member-benefit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .membership-gate-benefits,
  .member-benefit-list {
    grid-template-columns: 1fr;
  }

  .membership-gate-actions {
    flex-direction: column-reverse;
  }

  .membership-gate-actions button {
    width: 100%;
  }

  .free-preview-watermark {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
    grid-auto-rows: 92px;
    font-size: 13px;
  }
}

/* 2026-08 refinement: layered brand, two literary creation volumes and works */

.brand-mark,
.topbar .brand-mark {
  --brand-front: 52px;
  --brand-offset: 7px;
  position: relative;
  isolation: isolate;
  display: block;
  width: calc(var(--brand-front) + var(--brand-offset));
  height: calc(var(--brand-front) + var(--brand-offset));
  flex: 0 0 calc(var(--brand-front) + var(--brand-offset));
  overflow: visible;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: var(--brand-offset);
  left: var(--brand-offset);
  z-index: 0;
  width: var(--brand-front);
  height: var(--brand-front);
  border-radius: 11px;
  background: #c99a4c;
}

.brand-mark::after {
  content: none;
}

.brand-mark-art {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 1;
  display: block;
  width: var(--brand-front);
  height: var(--brand-front);
  overflow: hidden;
  border-radius: 11px;
  background: #17130f;
  box-shadow: 0 2px 8px rgba(39, 29, 21, 0.16);
}

.brand-mark-art img {
  position: absolute;
  top: calc(var(--brand-front) * -0.178947);
  left: calc(var(--brand-front) * -0.210526);
  width: calc(var(--brand-front) * 4.821053);
  max-width: none;
  height: auto;
  filter: none;
  mix-blend-mode: normal;
  user-select: none;
  pointer-events: none;
}

html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .topbar .brand-mark {
  border: 0;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .brand-mark::before {
  background: #e8dcc3;
}

html[data-theme="dark"] .brand-mark-art {
  background: #d3a14e;
  box-shadow: none;
}

html[data-theme="dark"] .brand-mark-art img {
  filter: invert(1) grayscale(1) contrast(1.18);
  mix-blend-mode: multiply;
}

.mode-family {
  --family-accent: #a7473d;
  --family-panel: #f6ebe4;
  --family-card: #fffaf5;
  position: relative;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--family-accent) 30%, var(--ui-border));
  border-top: 3px solid var(--family-accent);
  border-radius: 16px;
  background: var(--family-panel);
}

.short-story-family {
  --family-accent: #a7473d;
  --family-panel: #f6ebe4;
  --family-card: #fffaf5;
}

.drama-family {
  --family-accent: #41685b;
  --family-panel: #e9f0eb;
  --family-card: #f8fbf8;
}

.mode-family-label,
.drama-family .mode-family-label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 12px;
  min-height: 24px;
  padding: 0 2px;
  color: var(--family-accent);
  background: transparent;
  text-align: left;
}

.mode-family-label small {
  grid-column: 1;
  font-family: var(--ui-font-sans);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.mode-family-label strong {
  grid-column: 2;
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.mode-family-label em {
  grid-column: 3;
  color: var(--family-accent);
  font-family: var(--ui-font-sans);
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.mode-family .mode-tab {
  border-color: color-mix(in srgb, var(--family-accent) 20%, var(--ui-border));
  background: color-mix(in srgb, var(--family-card) 88%, transparent);
}

.mode-family .mode-tab::before {
  background: var(--family-accent);
}

.mode-family .mode-tab b {
  color: var(--family-accent);
}

.mode-family .mode-tab:hover,
.mode-family .mode-tab.active,
.mode-family.drama-family .mode-tab.active {
  border-color: color-mix(in srgb, var(--family-accent) 64%, var(--ui-border));
  background: var(--family-card);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--family-accent) 16%, transparent);
}

.mode-family .mode-tab:focus-visible {
  outline-color: var(--family-accent);
}

html[data-theme="dark"] .short-story-family {
  --family-accent: #cf7a6f;
  --family-panel: #211714;
  --family-card: #281c18;
}

html[data-theme="dark"] .drama-family {
  --family-accent: #d3a14e;
  --family-panel: #111d18;
  --family-card: #18251f;
}

html[data-theme="dark"] .mode-family .mode-tab {
  color: var(--ui-text);
  background: color-mix(in srgb, var(--family-card) 88%, var(--ui-surface));
}

html[data-theme="dark"] .mode-family .mode-tab:hover,
html[data-theme="dark"] .mode-family .mode-tab.active {
  background: var(--family-card);
}

/* Night outline cards must remain ink-on-dark, never pale-on-pale. */

html[data-theme="dark"] .outline-opening,
html[data-theme="dark"] .outline-highlight {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface);
}

html[data-theme="dark"] .outline-meta span,
html[data-theme="dark"] .chapter-detail-grid > div {
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-canvas-subtle);
}

html[data-theme="dark"] .outline-opening p,
html[data-theme="dark"] .outline-highlight p,
html[data-theme="dark"] .outline-meta span,
html[data-theme="dark"] .chapter-detail-grid > div span,
html[data-theme="dark"] .chapter-detail-grid > div p {
  color: var(--ui-text-secondary);
}

html[data-theme="dark"] .outline-opening h3,
html[data-theme="dark"] .outline-highlight h3,
html[data-theme="dark"] .outline-highlight strong,
html[data-theme="dark"] .chapter-detail-grid > div strong {
  color: var(--ui-primary);
}

html[data-theme="dark"] .story-reader {
  border-color: var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-raised);
}

/* Dedicated works page ---------------------------------------------------- */

.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;
}

.works-page {
  display: none;
  width: min(1240px, calc(100% - 64px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: clamp(58px, 7vw, 92px) 0 96px;
}

.app-shell[data-app-view="works"] > .home-hero,
.app-shell[data-app-view="works"] > .pathway-section,
.app-shell[data-app-view="works"] > .creation-workspace-anchor,
.app-shell[data-app-view="works"] > .workspace-context-bar,
.app-shell[data-app-view="works"] > .skill-dock,
.app-shell[data-app-view="works"] > .workspace,
.app-shell[data-app-view="home"] > .works-page,
.app-shell[data-app-view="create"] > .works-page {
  display: none !important;
}

.app-shell[data-app-view="works"] > .works-page {
  display: block;
}

.works-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--ui-border);
}

.works-page-head > div {
  display: grid;
  gap: 7px;
}

.works-page-head p {
  margin: 0;
  color: var(--ui-primary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.works-page-head h2 {
  margin: 0;
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: clamp(38px, 4.5vw, 58px);
  font-weight: 500;
  line-height: 1.15;
}

.works-page-head > div > span {
  color: var(--ui-text-secondary);
  font-size: 12px;
}

.works-page-head .primary-btn {
  min-width: 148px;
  min-height: 46px;
}

.works-page-head .primary-btn b {
  margin-left: 12px;
}

.works-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
}

.works-search {
  display: block;
  margin: 0;
}

.works-search input {
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  color: var(--ui-text);
  background:
    linear-gradient(45deg, transparent 46%, var(--ui-text-tertiary) 47% 53%, transparent 54%) 23px 25px / 7px 7px no-repeat,
    radial-gradient(circle, transparent 43%, var(--ui-text-tertiary) 46% 57%, transparent 60%) 15px 13px / 15px 15px no-repeat,
    var(--ui-surface-raised);
  font: inherit;
}

.works-search input::placeholder {
  color: var(--ui-text-tertiary);
}

.works-search input:focus-visible {
  border-color: var(--ui-primary);
  outline: 2px solid color-mix(in srgb, var(--ui-primary) 28%, transparent);
  outline-offset: 2px;
}

.works-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-canvas-subtle);
}

.works-filters button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
}

.works-filters button:hover {
  color: var(--ui-text);
  background: var(--ui-surface);
}

.works-filters button.active {
  color: var(--ui-on-primary);
  background: var(--ui-primary);
}

.works-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 42px 0 16px;
}

.works-list-meta strong {
  color: var(--ui-text);
  font-size: 14px;
}

.works-list-meta span {
  color: var(--ui-text-tertiary);
  font-size: 11px;
}

.history-list.works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-height: 0;
  overflow: visible;
  padding: 0;
  scrollbar-gutter: auto;
}

.works-grid .history-item {
  --work-accent: #a7473d;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  min-width: 0;
  min-height: 238px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-top: 3px solid var(--work-accent);
  border-radius: 12px;
  color: var(--ui-text);
  background: var(--ui-surface-raised);
  text-align: left;
  box-shadow: none;
}

.works-grid .history-item.is-drama {
  --work-accent: #41685b;
}

.works-grid .history-item.is-localization {
  --work-accent: #a97625;
}

.works-grid .history-item:hover {
  border-color: color-mix(in srgb, var(--work-accent) 62%, var(--ui-border));
  background: color-mix(in srgb, var(--ui-surface-raised) 92%, var(--work-accent));
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-card);
}

.works-grid .history-item:focus-visible {
  outline: 2px solid var(--work-accent);
  outline-offset: 3px;
}

.history-item-index {
  position: absolute;
  top: 22px;
  right: 24px;
  color: color-mix(in srgb, var(--work-accent) 50%, var(--ui-text-tertiary)) !important;
  font-family: var(--ui-font-serif);
  font-size: 11px !important;
  letter-spacing: 0.12em;
}

.history-item-head {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding-right: 46px;
}

.history-item-head b,
.history-item-head em {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.history-item-head b {
  color: var(--work-accent);
  background: color-mix(in srgb, var(--work-accent) 12%, transparent);
}

.history-item-head em {
  color: var(--ui-success);
  background: color-mix(in srgb, var(--ui-success) 12%, transparent);
}

.works-grid .history-item > strong {
  display: -webkit-box;
  max-width: 90%;
  margin: 0;
  overflow: hidden;
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: 25px;
  font-weight: 550;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-item-summary {
  display: -webkit-box !important;
  max-width: 92%;
  overflow: hidden;
  color: var(--ui-text-secondary) !important;
  font-size: 12px !important;
  line-height: 1.75 !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-item-footer {
  display: flex !important;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ui-border);
}

.history-item-footer small {
  color: var(--ui-text-tertiary);
  font-size: 10px;
  line-height: 1.5;
}

.history-item-footer > b {
  flex: 0 0 auto;
  color: var(--work-accent);
  font-size: 12px;
}

.history-item-footer > b i {
  margin-left: 6px;
  font-style: normal;
}

.works-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 320px;
  padding: 44px;
  border: 1px dashed var(--ui-border-strong);
  border-radius: 12px;
  color: var(--ui-text-secondary);
  background: color-mix(in srgb, var(--ui-surface) 70%, transparent);
  text-align: center;
}

.works-empty > span {
  color: var(--ui-primary);
  font-family: var(--ui-font-serif);
  font-size: 14px;
  letter-spacing: 0.16em;
}

.works-empty strong {
  margin: 18px 0 8px;
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: 24px;
  font-weight: 550;
}

.works-empty p {
  max-width: 420px;
  margin: 0;
  color: var(--ui-text-secondary);
  font-size: 13px;
  line-height: 1.75;
}

html[data-theme="dark"] .works-grid .history-item.is-story {
  --work-accent: #cf7a6f;
}

html[data-theme="dark"] .works-grid .history-item.is-drama {
  --work-accent: #8db6a4;
}

html[data-theme="dark"] .works-grid .history-item.is-localization {
  --work-accent: #d3a14e;
}

@media (max-width: 960px) {
  .works-page {
    width: min(calc(100% - 40px), 1240px);
  }

  .works-toolbar {
    grid-template-columns: 1fr;
  }

  .works-filters {
    justify-self: start;
  }
}

@media (max-width: 767px) {
  .brand-mark,
  .topbar .brand-mark {
    --brand-front: 40px;
    --brand-offset: 5px;
  }

  .brand-mark::before,
  .brand-mark-art {
    border-radius: 9px;
  }

  .mode-family {
    gap: 12px;
    padding: 14px;
  }

  .mode-family-label {
    grid-template-columns: auto 1fr;
    gap: 8px 10px;
  }

  .mode-family-label strong {
    font-size: 16px;
  }

  .mode-family-label em {
    grid-column: 1 / -1;
    font-size: 9px;
  }

  .works-page {
    width: calc(100% - 32px);
    padding: 40px 0 104px;
  }

  .works-page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 24px;
  }

  .works-page-head h2 {
    font-size: 38px;
  }

  .works-page-head .primary-btn {
    width: 100%;
  }

  .works-toolbar {
    margin-top: 24px;
  }

  .works-filters {
    width: 100%;
    overflow-x: auto;
  }

  .works-filters button {
    flex: 1 0 auto;
    min-height: 40px;
  }

  .works-list-meta {
    margin-top: 32px;
  }

  .history-list.works-grid {
    grid-template-columns: 1fr;
  }

  .works-grid .history-item {
    min-height: 224px;
    padding: 21px;
  }

  .works-grid .history-item > strong {
    font-size: 22px;
  }

  .history-item-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .history-item-footer > b {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .home-prompt-suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-prompt-suggestions button {
    text-align: left;
  }

  .prompt-brand-stamp {
    width: 36px;
    height: 42px;
  }

  .account-profile {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .account-profile > .account-avatar {
    width: 44px;
    height: 44px;
  }

  .account-profile .member-status-block .member-badge,
  .member-expiry {
    grid-column: 2;
    justify-self: start;
    margin-top: 6px;
  }

  .account-quick-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 2026-08 home view and theme-specific literary copy */

.topbar .brand-lockup {
  gap: 13px;
}

.topbar .brand-lockup h1 {
  font-family: var(--ui-font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.topbar .kicker {
  color: var(--ui-text-secondary);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.theme-copy-dark {
  display: none;
}

html[data-theme="dark"] .theme-copy-light {
  display: none;
}

html[data-theme="dark"] .theme-copy-dark {
  display: inline;
}

html[data-theme="dark"] .home-hero-copy h2 {
  max-width: 610px;
  letter-spacing: -0.025em;
}

html[data-theme="dark"] .hero-subtitle {
  max-width: 560px;
  color: var(--ui-text-secondary);
}

.app-shell[data-app-view="home"] > .pathway-section,
.app-shell[data-app-view="home"] > .creation-workspace-anchor,
.app-shell[data-app-view="home"] > .workspace-context-bar,
.app-shell[data-app-view="home"] > .skill-dock,
.app-shell[data-app-view="home"] > .workspace {
  display: none !important;
}

.app-shell[data-app-view="create"] > .home-hero {
  display: none !important;
}

.app-shell[data-app-view="create"] > .pathway-section {
  border-top: 0;
}

.mode-tab > strong {
  grid-row: 2;
}

.mode-tab > .path-index {
  grid-row: 1;
}

.mode-tab > small {
  grid-row: 3;
}

.mode-tab > b {
  grid-row: 4;
}

@media (max-width: 767px) {
  .topbar .brand-lockup {
    gap: 10px;
  }

  .topbar .brand-lockup h1 {
    font-size: 16px;
  }

  .topbar .kicker {
    font-size: 7px;
  }
}

@media (max-width: 420px) {
  .topbar .brand-lockup > div:last-child {
    display: none;
  }
}

/* Billing clarity pass ------------------------------------------------------
   Keep commerce behavior untouched while giving membership, word packs and
   the two existing payment providers a legible day/night hierarchy. */

.billing-modal {
  width: min(1180px, calc(100% - 32px));
  padding: clamp(28px, 3vw, 40px);
}

.billing-modal > header {
  padding: 0 54px 22px 0;
  border-bottom: 1px solid var(--ui-border);
}

.billing-modal > header p {
  margin-bottom: 5px;
  color: #a44339;
}

.billing-modal > header h2 {
  margin: 0 0 7px;
  font-size: clamp(32px, 3.6vw, 46px);
  line-height: 1.18;
}

.billing-product-groups {
  gap: 20px;
  margin-top: 22px;
}

.billing-product-group {
  gap: 14px;
  padding: 16px;
  border: 1px solid #ded3c4;
  border-radius: 12px;
  background: #fffdf8;
}

.billing-benefit {
  min-height: 78px;
  padding: 16px 20px;
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
}

.billing-benefit strong {
  font-size: 17px;
  line-height: 1.25;
}

.billing-benefit span {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.5;
}

.member-benefit {
  border-color: #8f332d;
  color: #fffaf2;
  background: #a94339;
}

.member-benefit strong,
.member-benefit span,
.member-benefit small,
.member-benefit .member-ai-label-benefit {
  color: #fffaf2;
}

.member-benefit span {
  color: #f4dcd5;
}

.word-benefit {
  border-color: #b88328;
  color: #2d2416;
  background: #d9aa4c;
}

.word-benefit strong,
.word-benefit span,
.word-benefit small {
  color: #2d2416;
}

.package-subgroup-heading {
  padding: 0 2px;
}

.package-subgroup-heading strong {
  color: #28211b;
  font-size: 16px;
}

.package-subgroup-heading span {
  color: #6e655a;
  font-size: 12px;
}

.package-card {
  min-height: 168px;
  padding: 18px;
  border: 1px solid #cfc2b2;
  border-radius: 10px;
  color: #241f1a;
  background: #fffdf8;
  box-shadow: 0 7px 18px rgba(43, 34, 25, 0.035);
}

.package-card:hover {
  border-color: #a94339;
  background: #fffaf1;
  box-shadow: 0 10px 24px rgba(52, 39, 27, 0.08);
}

.package-card > small {
  color: #9e443a;
  font-size: 13px;
}

.package-card > strong {
  color: #231e19;
  font-size: 21px;
  line-height: 1.35;
}

.package-card > span {
  color: #665e54;
  font-size: 13px;
}

.package-card.recurring {
  border-color: #9db1a8;
  background: #f2f8f4;
}

.package-card.recurring:hover {
  border-color: #527966;
  background: #edf6f0;
}

.package-card.recurring > small {
  color: #47715e;
}

.package-card.selected,
.package-card.selected:hover {
  border-color: #302821;
  background: #f3e6d3;
  box-shadow: inset 0 0 0 2px #302821, 0 9px 24px rgba(47, 37, 27, 0.12);
}

.package-card.selected::after {
  content: "已选择";
  color: #416d5b;
  font-size: 11px;
  font-weight: 800;
}

.package-price {
  color: #211c17;
}

.package-price b,
#wordPackageGrid .package-price b {
  color: #211c17;
  font-size: 29px;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.package-price del {
  color: #756c62;
  text-decoration-thickness: 1px;
}

.package-price em {
  color: #8e352f;
  background: #f4dfd9;
}

.recommendation-tag {
  border-color: #d3a14e;
  color: #fff7e5;
  background: #2a2118;
  box-shadow: 3px 3px 0 rgba(211, 161, 78, 0.7);
}

.payment-checkout {
  gap: 18px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #d8ccbc;
  border-radius: 12px;
  color: #28211b;
  background: #fffdf8;
}

.payment-selection > span {
  color: #9e443a;
}

.payment-selection strong {
  color: #211c17;
  font-size: 19px;
}

.payment-selection small {
  color: #6e655a;
}

/* Provider identity stays recognisable; selection and checkout logic remain
   exactly as before. */
.billing-modal .payment-method.wechat-pay,
.billing-modal .payment-method.wechat-pay:hover {
  border-color: #069b4d;
  color: #ffffff;
  background: #07c160;
}

.billing-modal .payment-method.alipay-pay,
.billing-modal .payment-method.alipay-pay:hover {
  border-color: #0d63d8;
  color: #ffffff;
  background: #1677ff;
}

.billing-modal .payment-method.wechat-pay:not(:disabled):hover,
.billing-modal .payment-method.alipay-pay:not(:disabled):hover {
  filter: brightness(1.04) saturate(1.05);
  transform: translateY(-1px);
}

.billing-modal .payment-method:disabled {
  filter: saturate(0.76);
  opacity: 0.66;
}

.billing-modal .payment-method strong,
.billing-modal .payment-method small {
  color: #ffffff;
}

.billing-modal .payment-method small {
  opacity: 0.84;
}

.billing-modal .payment-mark {
  border-color: rgba(255, 255, 255, 0.72);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

/* Night billing: carbon surfaces, warm-white type and restrained amber / red
   accents. Product names and prices stay readable even on lower-end screens. */
html[data-theme="dark"] .billing-modal {
  border-color: #5a4a30;
  color: #f3ead8;
  background: #0f1512;
  box-shadow: 0 32px 94px rgba(0, 0, 0, 0.58);
}

html[data-theme="dark"] .billing-modal > header {
  border-bottom-color: #3c392e;
}

html[data-theme="dark"] .billing-modal > header p {
  color: #d8aa58;
}

html[data-theme="dark"] .billing-modal > header h2 {
  color: #f4ebda;
}

html[data-theme="dark"] .billing-modal > header > span {
  color: #bfb5a3;
}

html[data-theme="dark"] .billing-modal .modal-close {
  border-color: #6a5836;
  color: #e7d7ba;
  background: #171e1a;
}

html[data-theme="dark"] .billing-modal .modal-close:hover {
  border-color: #d3a14e;
  color: #f5d998;
  background: #2b2418;
}

html[data-theme="dark"] .billing-product-group {
  border-color: #3d473f;
  color: #f0e6d3;
  background: #141b17;
}

html[data-theme="dark"] .billing-modal .member-benefit {
  border-color: #b75b50;
  color: #fff8e9;
  background: #8f3932;
}

html[data-theme="dark"] .billing-modal .member-benefit strong,
html[data-theme="dark"] .billing-modal .member-benefit span,
html[data-theme="dark"] .billing-modal .member-benefit small,
html[data-theme="dark"] .billing-modal .member-benefit .member-ai-label-benefit {
  color: #fff8e9;
}

html[data-theme="dark"] .billing-modal .member-benefit span {
  color: #f0d4cc;
}

html[data-theme="dark"] .billing-modal .word-benefit {
  border-color: #e0b25b;
  color: #21180c;
  background: #cf9f45;
}

html[data-theme="dark"] .billing-modal .word-benefit strong,
html[data-theme="dark"] .billing-modal .word-benefit span,
html[data-theme="dark"] .billing-modal .word-benefit small {
  color: #21180c;
}

html[data-theme="dark"] .package-subgroup-heading strong {
  color: #f0e6d3;
}

html[data-theme="dark"] .package-subgroup-heading span {
  color: #b8ad9a;
}

html[data-theme="dark"] .billing-modal .package-subgroup + .package-subgroup {
  border-top-color: #3d473f;
}

html[data-theme="dark"] .billing-modal .package-card {
  border-color: #5c5038;
  color: #f0e6d3;
  background: #19201c;
  box-shadow: none;
}

html[data-theme="dark"] .billing-modal .package-card:hover {
  border-color: #d3a14e;
  background: #1e251f;
}

html[data-theme="dark"] .billing-modal .package-card > small {
  color: #df9b89;
}

html[data-theme="dark"] .billing-modal .package-card > strong {
  color: #f5ecda;
}

html[data-theme="dark"] .billing-modal .package-card > span {
  color: #c5baa7;
}

html[data-theme="dark"] .billing-modal .package-card.recurring {
  border-color: #496553;
  background: #17231c;
}

html[data-theme="dark"] .billing-modal .package-card.recurring:hover {
  border-color: #7fa68c;
  background: #1b2a21;
}

html[data-theme="dark"] .billing-modal .package-card.recurring > small {
  color: #9cc0a8;
}

html[data-theme="dark"] .billing-modal .package-card.selected,
html[data-theme="dark"] .billing-modal .package-card.selected:hover {
  border-color: #d3a14e;
  background: #292317;
  box-shadow: inset 0 0 0 2px #d3a14e, 0 10px 26px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .billing-modal .package-card.selected::after {
  color: #e7c778;
}

html[data-theme="dark"] .billing-modal .package-price,
html[data-theme="dark"] .billing-modal .package-price b,
html[data-theme="dark"] .billing-modal #wordPackageGrid .package-price b {
  color: #fff2d6;
}

html[data-theme="dark"] .billing-modal .package-price del {
  color: #a99e8c;
}

html[data-theme="dark"] .billing-modal .package-price em {
  color: #f2c979;
  background: #342919;
}

html[data-theme="dark"] .billing-modal .recommendation-tag {
  border-color: #d3a14e;
  color: #ffedc2;
  background: #251d11;
  box-shadow: 3px 3px 0 rgba(211, 161, 78, 0.45);
}

html[data-theme="dark"] .billing-modal .payment-checkout {
  border-color: #56482f;
  color: #f0e6d3;
  background: #141b17;
}

html[data-theme="dark"] .billing-modal .payment-selection > span {
  color: #dc9c8f;
}

html[data-theme="dark"] .billing-modal .payment-selection strong {
  color: #fff1d4;
}

html[data-theme="dark"] .billing-modal .payment-selection small,
html[data-theme="dark"] .billing-modal .billing-note,
html[data-theme="dark"] .billing-modal .recurring-pricing-disclaimer,
html[data-theme="dark"] .billing-modal .billing-disclaimer {
  color: #b9ae9b;
}

html[data-theme="dark"] .billing-modal .wechat-native-checkout {
  border-color: rgba(7, 193, 96, 0.5);
  color: #edf8f0;
  background: #13251b;
}

html[data-theme="dark"] .billing-modal .wechat-native-checkout p {
  color: #b7cabc;
}

/* Every editable night-mode field carries an amber boundary at rest. Error
   states remain red and focus simply strengthens the already-visible edge. */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(:disabled):not([readonly]),
html[data-theme="dark"] textarea:not(:disabled):not([readonly]),
html[data-theme="dark"] select:not(:disabled) {
  border-color: #a97e36 !important;
  box-shadow: inset 0 0 0 1px rgba(211, 161, 78, 0.17);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(:disabled):not([readonly]):hover,
html[data-theme="dark"] textarea:not(:disabled):not([readonly]):hover,
html[data-theme="dark"] select:not(:disabled):hover,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(:disabled):not([readonly]):focus,
html[data-theme="dark"] textarea:not(:disabled):not([readonly]):focus,
html[data-theme="dark"] select:not(:disabled):focus {
  border-color: #e2b768 !important;
  box-shadow: 0 0 0 2px rgba(211, 161, 78, 0.14), inset 0 0 0 1px rgba(226, 183, 104, 0.22);
}

html[data-theme="dark"] input[aria-invalid="true"],
html[data-theme="dark"] textarea[aria-invalid="true"],
html[data-theme="dark"] select[aria-invalid="true"],
html[data-theme="dark"] input.invalid {
  border-color: var(--ui-error) !important;
}

/* The two script-generation calls to action now share one night treatment. */
html[data-theme="dark"] #dramaGenerateBtn,
html[data-theme="dark"] #localizationGenerateBtn {
  border-color: #efe6d3;
  color: #0c110f;
  background: #efe6d3;
}

html[data-theme="dark"] #dramaGenerateBtn:hover,
html[data-theme="dark"] #localizationGenerateBtn:hover {
  border-color: #fff2d8;
  color: #0c110f;
  background: #fff2d8;
  opacity: 1;
}

@media (max-width: 980px) {
  .billing-modal {
    width: calc(100% - 24px);
  }

  .billing-product-group {
    padding: 14px;
  }

  .package-grid,
  #wordPackageGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .billing-modal {
    width: calc(100% - 16px);
    padding: 22px 14px;
  }

  .billing-modal > header {
    padding-right: 44px;
  }

  .billing-modal > header h2 {
    font-size: 31px;
  }

  .billing-product-group {
    padding: 10px;
  }

  .billing-benefit {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 14px;
  }

  .billing-benefit small {
    align-self: flex-start;
  }

  .package-grid,
  #wordPackageGrid,
  .payment-checkout,
  .payment-methods {
    grid-template-columns: 1fr;
  }

  .package-card {
    min-height: 150px;
  }

  .payment-checkout {
    padding: 14px;
  }
}

/* Home writing desk -------------------------------------------------------- */

.home-writing-desk {
  padding: clamp(28px, 2.8vw, 42px);
}

.home-writing-desk .prompt-card-head {
  align-items: center;
  margin-bottom: 20px;
}

.home-writing-desk .prompt-card-head h3 {
  max-width: 520px;
  font-size: clamp(30px, 2.25vw, 38px);
}

.home-recent-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 20px;
  padding: 20px 22px;
  border: 1px solid color-mix(in srgb, var(--ui-primary) 28%, var(--ui-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--ui-primary-soft) 42%, var(--ui-surface-raised));
}

.home-recent-copy {
  min-width: 0;
}

.home-recent-overline {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  color: var(--ui-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.home-recent-overline b {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--ui-success) 48%, var(--ui-border));
  border-radius: 999px;
  color: var(--ui-success);
  background: var(--ui-success-soft);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0;
}

.home-recent-work h4 {
  overflow: hidden;
  margin: 0 0 7px;
  color: var(--ui-text);
  font-family: var(--ui-font-serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-recent-work p {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--ui-text-tertiary);
  font-size: 11px;
}

.home-recent-work p i {
  width: 3px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ui-border-strong);
}

.home-recent-work time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-continue-button,
.home-new-start-button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--ui-primary);
  border-radius: var(--ui-radius-input);
  color: var(--ui-on-primary);
  background: var(--ui-primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.home-continue-button:hover,
.home-new-start-button:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
}

.home-continue-button b,
.home-new-start-button b {
  margin-left: 10px;
}

.home-section-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 4px 0 16px;
  color: var(--ui-text-tertiary);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.home-section-divider::before,
.home-section-divider::after {
  content: "";
  height: 1px;
  background: var(--ui-border);
}

.home-writing-desk .home-prompt-field textarea {
  min-height: 122px;
  max-height: 220px;
  padding: 15px 16px;
}

.home-writing-desk .home-prompt-actions {
  margin-top: 16px;
  padding-top: 16px;
}

.home-writing-desk .home-prompt-actions > span {
  max-width: 360px;
  line-height: 1.6;
}

.home-writing-desk.has-recent-work .home-new-start-button {
  color: var(--ui-primary);
  background: transparent;
}

.home-writing-desk.has-recent-work .home-new-start-button:hover {
  color: var(--ui-on-primary);
  background: var(--ui-primary);
}

.home-desk-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.home-desk-links button {
  min-height: 32px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--ui-text-secondary);
  background: transparent;
  font-size: 11px;
}

.home-desk-links button:hover {
  border-bottom-color: var(--ui-primary);
  color: var(--ui-primary);
}

.home-desk-links button b {
  margin-left: 6px;
}

html[data-theme="dark"] .home-recent-work {
  border-color: color-mix(in srgb, var(--ui-primary) 36%, var(--ui-border));
  background: color-mix(in srgb, var(--ui-primary-soft) 60%, var(--ui-surface));
}

@media (max-width: 768px) {
  .home-writing-desk {
    padding: 26px 20px;
  }

  .home-recent-work {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
  }

  .home-continue-button,
  .home-new-start-button {
    width: 100%;
  }

  .home-writing-desk .home-prompt-field textarea {
    min-height: 112px;
  }

  .home-desk-links {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* Final membership benefit layout overrides ------------------------------ */

.billing-modal .member-benefit {
  align-items: flex-start;
  min-height: 0;
}

.billing-modal .member-benefit > div {
  width: 100%;
}

.billing-modal .member-benefit-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.billing-modal .member-benefit-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 2px 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 250, 242, 0.24);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.08);
}

.billing-modal .member-benefit-list li > span {
  grid-row: 1 / span 2;
  display: grid;
  width: 26px;
  height: 26px;
  margin: 0;
  place-items: center;
  border-radius: 7px;
  color: #5d3511;
  background: #e1b866;
  font-size: 10px;
  font-weight: 900;
}

.billing-modal .member-benefit-list b,
.billing-modal .member-benefit-list small {
  display: block;
  min-width: 0;
}

.billing-modal .member-benefit-list b {
  color: #fffaf2;
  font-size: 11px;
}

.billing-modal .member-benefit-list small,
.billing-modal .member-benefit-list .member-ai-label-benefit {
  margin: 0;
  color: #f4dcd5;
  font-size: 9px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .billing-modal .member-benefit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .billing-modal .member-benefit-list {
    grid-template-columns: 1fr;
  }
}

/* 2026-08 support home theme alignment ----------------------------------- */

/* Night brand returns to the original relationship: black paper and gold cat. */
html[data-theme="dark"] .brand-mark-art img {
  z-index: 1;
  filter: none;
  mix-blend-mode: multiply;
}

/* Day support home: beige header, ink greeting and ink close mark. */
html[data-theme="light"] .support-chat-panel.support-home-mode .support-chat-header {
  border-bottom: 0;
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: inset 0 -3px #a7473d;
}

html[data-theme="light"] .support-chat-panel.support-home-mode .support-chat-header strong {
  color: var(--ui-text);
}

html[data-theme="light"] .support-chat-panel.support-home-mode .support-chat-header small {
  color: var(--ui-text);
}

html[data-theme="light"] .support-chat-panel.support-home-mode .support-chat-header > button {
  border: 1px solid var(--ui-border-strong);
  color: var(--ui-text);
  background: #fffdf8;
}

/* Night support home: black header, gold greeting/logo and a beige close mark. */
html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-header {
  border-bottom: 0;
  color: var(--ui-text);
  background: #0c110f;
  box-shadow: inset 0 -3px #d3a14e;
}

html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-header strong {
  color: var(--ui-text);
}

html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-header small {
  color: var(--ui-text);
}

html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-mark {
  border: 1px solid #d3a14e;
  background: #151b18;
}

html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-mark .cat-face {
  --cat-bg: #d3a14e;
  --cat-ink: #151b18;
}

html[data-theme="dark"] .support-chat-panel.support-home-mode .support-chat-header > button {
  border: 2px solid #d3a14e;
  color: #e8dcc3;
  background: transparent;
}

/* Night creation paths: neutral ink paper with restrained type accents. */
html[data-theme="dark"] .short-story-family {
  --family-accent: #cc8070;
  --family-panel: #111513;
  --family-card: #181d1a;
}

html[data-theme="dark"] .drama-family {
  --family-accent: #91ad9f;
  --family-panel: #111513;
  --family-card: #181d1a;
}

html[data-theme="dark"] .mode-family {
  border-color: #2c3530;
  border-top-color: var(--family-accent);
  background: var(--family-panel);
  box-shadow: none;
}

html[data-theme="dark"] .mode-family-label strong {
  color: #efe6d3;
}

html[data-theme="dark"] .mode-family-label small,
html[data-theme="dark"] .mode-family-label em {
  color: var(--family-accent);
}

html[data-theme="dark"] .mode-family .mode-tab {
  border-color: #303a34;
  color: #efe6d3;
  background: var(--family-card);
  box-shadow: none;
}

html[data-theme="dark"] .mode-family .mode-tab .path-index {
  color: #7f857f;
}

html[data-theme="dark"] .mode-family .mode-tab small {
  color: #aaa99f;
}

html[data-theme="dark"] .mode-family .mode-tab:hover {
  border-color: color-mix(in srgb, var(--family-accent) 48%, #303a34);
  background: #1c221e;
  transform: translateY(-1px);
  box-shadow: none;
}

html[data-theme="dark"] .mode-family .mode-tab.active {
  border-color: color-mix(in srgb, var(--family-accent) 72%, #303a34);
  background: color-mix(in srgb, var(--family-card) 92%, var(--family-accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--family-accent) 16%, transparent);
}

html[data-theme="dark"] .mode-family .mode-tab::before {
  right: 22px;
  left: 22px;
  background: var(--family-accent);
}

html[data-theme="dark"] .mode-family .mode-tab b {
  color: var(--family-accent);
}

/* Keep the support header geometry identical between home and conversation. */
.support-chat-panel .support-chat-header,
.support-chat-panel.support-home-mode .support-chat-header {
  min-height: 96px;
  align-items: center;
  padding: 18px 20px;
}

.support-chat-panel .support-chat-header strong,
.support-chat-panel.support-home-mode .support-chat-header strong {
  font-size: 19px;
}

.support-chat-panel .support-chat-header small,
.support-chat-panel.support-home-mode .support-chat-header small {
  font-size: 12px;
}

/* Account records modal ---------------------------------------------------- */

.account-records-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 85;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(920px, calc(100% - 32px));
  max-height: min(820px, calc(100dvh - 40px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid var(--ui-border-strong, var(--line-dark));
  border-radius: 20px;
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--sheet));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.34);
}

.account-records-modal > .modal-close {
  top: 22px;
  right: 24px;
}

.account-records-head {
  padding: 28px 32px 22px;
  border-bottom: 1px solid var(--ui-border, var(--line));
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--ui-primary-soft, #f4e3df) 78%, transparent), transparent 54%),
    var(--ui-surface, var(--sheet));
}

.account-records-head > p {
  margin: 0 0 3px;
  color: var(--ui-primary, var(--red));
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.account-records-head > h2 {
  margin: 0;
  font-family: var(--ui-font-serif, serif);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.15;
}

.account-records-head > h2:focus {
  outline: none;
}

.account-records-head > span {
  display: block;
  margin-top: 5px;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 14px;
}

.account-records-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.account-records-summary article {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--ui-surface-raised, #fff) 88%, transparent);
}

.account-records-summary span,
.account-records-summary small {
  display: block;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 12px;
}

.account-records-summary strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ui-primary, var(--red));
  font-size: 24px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-records-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 32px;
  border-bottom: 1px solid var(--ui-border, var(--line));
  background: var(--ui-surface, var(--sheet));
}

.account-records-tabs button {
  position: relative;
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  color: var(--ui-text-secondary, var(--muted));
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.account-records-tabs button::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 3px;
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  background: var(--ui-primary, var(--red));
  transition: transform 170ms ease;
}

.account-records-tabs button.active {
  color: var(--ui-text, var(--ink));
}

.account-records-tabs button.active::after {
  transform: scaleX(1);
}

.account-records-tabs button span {
  font-size: 16px;
  font-weight: 900;
}

.account-records-tabs button small {
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ui-text-secondary, var(--muted));
  background: var(--ui-canvas-subtle, var(--paper-2));
  font-size: 11px;
}

.account-records-panel {
  min-height: 0;
  padding: 20px 28px 26px 32px;
  overflow: hidden;
}

.account-records-panel:not([hidden]) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.account-records-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px 14px 0;
}

.account-records-panel-head strong,
.account-records-panel-head span {
  display: block;
}

.account-records-panel-head strong {
  font-size: 15px;
}

.account-records-panel-head span {
  margin-top: 2px;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 12px;
}

.account-records-panel-head button {
  min-width: 72px;
  min-height: 36px;
  padding: 6px 14px;
}

.account-records-panel-head button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.account-records-list {
  min-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-primary, var(--red)) var(--ui-canvas-subtle, var(--paper-2));
}

.account-record-row {
  padding: 16px 2px;
  border-top: 1px solid var(--ui-border, var(--line));
}

.account-record-row:first-child {
  border-top: 0;
}

.account-record-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.account-record-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.account-record-title strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.record-kind,
.order-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.record-kind.income {
  border-color: color-mix(in srgb, var(--ui-success, var(--teal)) 36%, transparent);
  color: var(--ui-success, var(--teal));
  background: color-mix(in srgb, var(--ui-success-soft, #e8f2ed) 72%, transparent);
}

.record-kind.expense {
  border-color: color-mix(in srgb, var(--ui-primary, var(--red)) 34%, transparent);
  color: var(--ui-primary, var(--red));
  background: var(--ui-primary-soft, #f4e3df);
}

.record-kind.order {
  border-color: color-mix(in srgb, var(--gold) 52%, transparent);
  color: color-mix(in srgb, var(--gold) 76%, var(--ui-text, var(--ink)));
  background: color-mix(in srgb, var(--gold) 13%, transparent);
}

.record-amount,
.order-record-value > b {
  flex: 0 0 auto;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.record-amount.income {
  color: var(--ui-success, var(--teal));
}

.record-amount.expense {
  color: var(--ui-primary, var(--red));
}

.account-record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-top: 8px;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 12px;
}

.order-record-value {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.order-status.success {
  color: var(--ui-success, var(--teal));
  background: var(--ui-success-soft, #e8f2ed);
}

.order-status.pending,
.order-status.processing {
  color: #7d5b20;
  background: #f4ead5;
}

.order-status.failed,
.order-status.closed {
  color: var(--ui-error, var(--red));
  background: var(--ui-error-soft, #f6e4e1);
}

.order-record-id {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  color: var(--ui-text-tertiary, var(--muted));
  font-size: 11px;
}

.account-records-state {
  display: grid;
  min-height: 220px;
  place-content: center;
  justify-items: center;
  padding: 28px;
  color: var(--ui-text-secondary, var(--muted));
  text-align: center;
}

.account-records-state strong {
  color: var(--ui-text, var(--ink));
  font-size: 16px;
}

.account-records-state span {
  max-width: 440px;
  margin-top: 5px;
  font-size: 13px;
}

.account-records-state.loading i {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 3px solid var(--ui-border, var(--line));
  border-top-color: var(--ui-primary, var(--red));
  border-radius: 50%;
  animation: account-records-spin 780ms linear infinite;
}

.account-records-state.error strong {
  color: var(--ui-error, var(--red));
}

@keyframes account-records-spin {
  to { transform: rotate(360deg); }
}

html[data-theme="dark"] .account-records-modal,
html[data-theme="dark"] .account-records-head,
html[data-theme="dark"] .account-records-tabs {
  background-color: var(--ui-surface, #151a17);
  background-image: none;
}

html[data-theme="dark"] .account-records-summary article {
  background: var(--ui-surface-raised, #1c221e);
}

html[data-theme="dark"] .order-status.pending,
html[data-theme="dark"] .order-status.processing {
  color: #e6c483;
  background: rgba(199, 154, 85, 0.16);
}

@media (max-width: 680px) {
  .account-records-modal {
    top: auto;
    bottom: 10px;
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
    transform: translateX(-50%);
    border-radius: 18px;
  }

  .account-records-modal > .modal-close {
    top: 16px;
    right: 16px;
  }

  .account-records-head {
    padding: 22px 18px 16px;
  }

  .account-records-head > h2 {
    font-size: 34px;
  }

  .account-records-head > span {
    max-width: calc(100% - 48px);
    font-size: 12px;
  }

  .account-records-summary {
    gap: 8px;
    margin-top: 14px;
  }

  .account-records-summary article {
    padding: 10px 12px;
  }

  .account-records-summary strong {
    font-size: 18px;
  }

  .account-records-tabs {
    padding: 0 12px;
  }

  .account-records-tabs button {
    min-height: 54px;
    gap: 5px;
  }

  .account-records-tabs button small {
    display: none;
  }

  .account-records-panel {
    padding: 14px 14px 18px 18px;
  }

  .account-records-panel-head span {
    max-width: 230px;
  }

  .account-record-main {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .record-amount,
  .order-record-value {
    align-self: flex-start;
  }

  .account-record-meta {
    display: grid;
    gap: 3px;
  }

  .account-records-state {
    min-height: 180px;
  }
}

/* Prepared mobile download confirmation ---------------------------------- */

.download-ready-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 85;
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  transform: translate(-50%, -50%);
  overflow: auto;
  padding: clamp(24px, 4vw, 34px);
  border: 1px solid var(--ui-border, var(--line-dark));
  border-radius: var(--ui-radius-modal, 18px);
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--sheet));
  box-shadow: var(--ui-shadow-float, 0 34px 100px rgba(0, 0, 0, 0.34));
}

.download-ready-head {
  padding: 0 48px 20px 0;
  border-bottom: 1px solid var(--ui-border, var(--line));
}

.download-ready-head p {
  margin: 0 0 6px;
  color: var(--ui-primary, var(--red));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.download-ready-head h2 {
  margin: 0;
  font-family: var(--ui-font-serif, var(--serif));
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 550;
  line-height: 1.15;
}

.download-ready-head span {
  display: block;
  margin-top: 9px;
  color: var(--ui-text-secondary, var(--muted));
  line-height: 1.65;
}

.download-ready-file {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: var(--ui-radius-card, 12px);
  background: var(--ui-surface-raised, var(--paper-2));
}

.download-ready-file-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--ui-on-primary, var(--sheet));
  background: var(--ui-primary, var(--red));
  font-size: 28px;
  font-weight: 700;
}

.download-ready-file strong,
.download-ready-file small {
  display: block;
}

.download-ready-file strong {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.45;
}

.download-ready-file small {
  margin-top: 4px;
  color: var(--ui-text-secondary, var(--muted));
}

.download-ready-environment-note {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--ui-success, var(--teal));
  color: var(--ui-text-secondary, var(--muted));
  background: var(--ui-success-soft, rgba(35, 91, 77, 0.08));
  line-height: 1.65;
}

.download-ready-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}

.download-ready-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-primary, var(--red)) 40%, transparent);
  outline-offset: 3px;
}

.download-ready-retry-note {
  margin: 12px 0 0;
  color: var(--ui-text-secondary, var(--muted));
  font-size: 12px;
  line-height: 1.65;
}

@media (max-width: 680px) {
  .download-ready-modal {
    top: auto;
    bottom: 10px;
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
    transform: translateX(-50%);
    padding: 24px 18px;
    border-radius: 18px;
  }

  .download-ready-head {
    padding-right: 44px;
  }

  .download-ready-link {
    min-height: 56px;
    font-size: 17px;
  }
}
