:root {
  --forest: #17251f;
  --forest-2: #23382e;
  --forest-3: #315041;
  --paper: #f4efe5;
  --paper-2: #e8dfcf;
  --cream: #fffdf7;
  --ink: #14211b;
  --muted: #66736c;
  --coral: #e76f51;
  --coral-dark: #b94b35;
  --lime: #dce66e;
  --sage: #91a17f;
  --line: rgba(20, 33, 27, 0.12);
  --line-dark: rgba(255, 250, 240, 0.13);
  --shadow: 0 28px 80px rgba(18, 32, 24, 0.14);
  --shadow-soft: 0 14px 38px rgba(18, 32, 24, 0.08);
  --surface: rgba(255, 253, 247, 0.68);
  --dialogue-warm: #a5660b;
  --serif: "Iowan Old Style", "Baskerville", "Noto Serif SC", "Songti SC", serif;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; color-scheme: light; }
body { margin: 0; min-height: 100dvh; overflow-x: hidden; background: radial-gradient(circle at 86% 4%, rgba(231,111,81,.09), transparent 25rem), radial-gradient(circle at 28% 80%, rgba(127,157,82,.08), transparent 30rem), var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.modal-open, body.chat-open { overflow: hidden; }

.username-migration-layer { z-index: 190; }
.username-migration-dialog { position: relative; width: min(100%, 570px); max-height: calc(100dvh - 40px); overflow: auto; padding: clamp(28px,4vw,46px); border: 1px solid rgba(255,250,240,.2); border-radius: 12px 42px 12px 12px; background: radial-gradient(circle at 90% 8%, rgba(231,111,81,.18), transparent 18rem), linear-gradient(145deg, #20382d, #13221a); color: var(--cream); box-shadow: 0 36px 100px rgba(7,15,11,.48), 10px 10px 0 rgba(220,230,110,.14); }
.username-migration-dialog::before { position: absolute; top: 0; left: 42px; width: 88px; height: 4px; background: var(--lime); content: ""; }
.username-migration-dialog .eyebrow { color: var(--lime); }
.username-migration-dialog h2 { margin: 12px 0 14px; font-family: var(--serif); font-size: clamp(2rem,5vw,3.2rem); font-weight: 500; line-height: 1.05; letter-spacing: -.04em; }
.username-migration-dialog > p:not(.eyebrow) { margin: 0; color: rgba(255,250,240,.72); font-size: .84rem; line-height: 1.85; }
.username-migration-dialog > p strong { color: var(--lime); }
.username-migration-badge { display: inline-flex; margin-top: 10px; padding: 7px 11px; border: 1px solid rgba(231,111,81,.44); border-radius: 999px; background: rgba(231,111,81,.12); color: #ffad97; font-size: .62rem; font-weight: 800; letter-spacing: .05em; }
.username-migration-identity { display: grid; grid-template-columns: .72fr 1.28fr; gap: 10px; margin: 25px 0 20px; }
.username-migration-identity span { min-width: 0; padding: 14px 16px; border: 1px solid rgba(255,250,240,.13); border-radius: 7px 18px 7px 7px; background: rgba(255,255,255,.055); }
.username-migration-identity small { display: block; margin-bottom: 6px; color: rgba(255,250,240,.48); font-size: .57rem; letter-spacing: .08em; }
.username-migration-identity strong { display: block; overflow: hidden; color: var(--cream); font-family: var(--serif); font-size: 1.08rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.username-migration-dialog form { display: grid; gap: 14px; }
.username-migration-dialog .field > span { color: rgba(255,250,240,.74); }
.username-migration-dialog .field input { border-color: rgba(255,250,240,.2); background: rgba(255,253,247,.96); color: var(--ink); font-size: 1.02rem; letter-spacing: .08em; }
.username-migration-dialog .field small { color: rgba(255,250,240,.48); }
.username-migration-dialog .form-error { color: #ffad97; }
.username-migration-logout { display: block; margin: 16px auto 0; border: 0; background: transparent; color: rgba(255,250,240,.56); font-size: .68rem; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.username-migration-logout:hover { color: var(--cream); }
.hydration-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 24px; background: radial-gradient(circle at 68% 24%, rgba(220,230,110,.12), transparent 26rem), linear-gradient(135deg, var(--forest-2), var(--forest)); color: var(--cream); text-align: center; }
.hydration-gate strong { margin-top: 8px; font-family: var(--serif); font-size: clamp(1.45rem,4vw,2.2rem); font-weight: 500; }
.hydration-gate small { color: rgba(255,250,240,.58); font-size: .67rem; }
.hydration-mark { width: 48px; height: 48px; border: 2px solid rgba(255,250,240,.18); border-top-color: var(--lime); border-radius: 50%; animation: hydration-spin 900ms linear infinite; }
body.app-hydrating > :is(.auth-view,.product-shell,.chat-screen,.modal-layer,.chat-transition) { visibility: hidden !important; }
button, input, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.028;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.eyebrow, .tiny-label {
  margin: 0 0 9px;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid currentColor;
  border-radius: 50% 50% 43% 57%;
  background: var(--coral) url('/assets/icon-192.png') center / cover no-repeat;
  color: transparent;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  transform: rotate(-7deg);
}

.auth-view { display: grid; grid-template-columns: minmax(540px, 1.16fr) minmax(430px, .84fr); min-height: 100dvh; background: var(--paper); }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100dvh; padding: clamp(34px, 4.7vw, 72px); overflow: hidden; background: radial-gradient(circle at 84% 82%, rgba(220,230,110,.07), transparent 28rem), linear-gradient(148deg, #20362c 0%, var(--forest) 64%, #132019 100%); color: var(--cream); }
.auth-story::before { content: ""; position: absolute; inset: 0; opacity: .16; background: linear-gradient(90deg, transparent 63px, rgba(255,255,255,.12) 64px, transparent 65px) 0 0/128px 128px, linear-gradient(transparent 63px, rgba(255,255,255,.12) 64px, transparent 65px) 0 0/128px 128px; mask-image: linear-gradient(135deg, #000, transparent 72%); }
.auth-story::after { position: absolute; top: 0; right: 0; width: 1px; height: 100%; background: rgba(255,255,255,.16); content: ""; }
.brand-lockup, .side-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-lockup > span:last-child, .side-brand > span:last-child { display: flex; flex-direction: column; }
.brand-lockup strong { font-family: var(--serif); font-size: 1.08rem; font-weight: 500; }
.brand-lockup small { margin-top: 2px; color: rgba(255,250,240,.52); font-size: .57rem; letter-spacing: .13em; text-transform: uppercase; }
.auth-headline { position: relative; z-index: 2; max-width: 690px; margin: clamp(66px, 10vh, 132px) 0 auto; }
.auth-headline .eyebrow { color: var(--lime); }
.auth-headline h1 { margin: 0; font-family: var(--serif); font-size: clamp(3.55rem, 5.25vw, 6.15rem); font-weight: 500; line-height: 1.02; letter-spacing: -.055em; }
.auth-headline h1 em { color: var(--coral); font-weight: 500; }
.auth-headline > p:not(.eyebrow) { max-width: 550px; margin: 25px 0 0; color: rgba(255,250,240,.68); font-size: .92rem; line-height: 1.9; }
.auth-signals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: min(100%, 550px); margin: 36px 0 0; padding: 18px 0 0; border-top: 1px solid rgba(255,250,240,.14); list-style: none; }
.auth-signals li { display: flex; align-items: baseline; gap: 10px; color: rgba(255,250,240,.74); font-size: .72rem; letter-spacing: .08em; }
.auth-signals b { color: var(--coral); font-family: var(--serif); font-size: .76rem; font-weight: 500; }
.auth-orbit { position: absolute; right: -9%; bottom: -21%; width: min(39vw, 560px); aspect-ratio: 1; opacity: .9; }
.orbit-line { position: absolute; inset: 8%; border: 1px solid rgba(255,250,240,.13); border-radius: 50%; }
.line-a { transform: rotate(18deg) scaleY(.58); }
.line-b { transform: rotate(-31deg) scaleY(.42); }
.orbit-core { position: absolute; inset: 29%; border-radius: 50%; background: var(--lime); box-shadow: 0 0 90px rgba(220,230,110,.12); }
.orbit-core::after { content: ""; position: absolute; top: -5%; right: -11%; width: 94%; height: 94%; border-radius: 50%; background: #14221b; box-shadow: inset 1px 0 rgba(255,250,240,.04); }
.auth-manifesto { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; width: fit-content; margin: 0; color: rgba(255,250,240,.46); font-size: .6rem; letter-spacing: .06em; }
.auth-manifesto strong { color: var(--lime); font-size: .57rem; letter-spacing: .18em; white-space: nowrap; }
.auth-manifesto strong::after { display: inline-block; width: 34px; height: 1px; margin-left: 16px; vertical-align: middle; background: rgba(255,250,240,.24); content: ""; }

.auth-panel { position: relative; display: grid; place-items: center; padding: 48px clamp(30px, 5.2vw, 78px); overflow: hidden; background: radial-gradient(circle at 92% 5%, rgba(231,111,81,.12), transparent 25rem), radial-gradient(circle at 8% 90%, rgba(145,161,127,.11), transparent 26rem), var(--paper); }
.auth-panel::before { position: absolute; inset: 27px; border: 1px solid rgba(20,33,27,.06); pointer-events: none; content: ""; }
.auth-card { position: relative; width: min(100%, 455px); padding: clamp(27px,3vw,37px); border: 1px solid rgba(20,33,27,.14); border-radius: 10px 34px 10px 10px; background: rgba(255,253,247,.91); box-shadow: 0 30px 80px rgba(18,32,24,.12), 8px 8px 0 rgba(231,111,81,.11); backdrop-filter: blur(12px); }
.auth-card::before { position: absolute; top: -1px; left: 34px; width: 72px; height: 3px; background: var(--coral); content: ""; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 38px; padding: 4px; border: 1px solid var(--line); border-radius: 9px 19px 9px 9px; background: rgba(232,223,207,.48); }
.auth-tab { min-height: 44px; padding: 10px; border: 0; border-radius: 6px 14px 6px 6px; background: transparent; color: var(--muted); font-size: .76rem; font-weight: 700; cursor: pointer; transition: background 160ms ease, color 160ms ease, transform 160ms ease; }
.auth-tab.active { background: var(--forest); color: var(--cream); box-shadow: 0 8px 20px rgba(23,37,31,.14); }
.auth-tab:disabled { opacity: .4; cursor: not-allowed; }
.auth-form { display: flex; flex-direction: column; gap: 17px; }
.form-heading { margin-bottom: 15px; }
.form-heading .eyebrow { color: var(--coral-dark); }
.form-heading h2 { margin: 0 0 11px; font-family: var(--serif); font-size: 2.55rem; font-weight: 500; letter-spacing: -.04em; }
.form-heading > span { color: var(--muted); font-size: .8rem; line-height: 1.65; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: .77rem; font-weight: 700; }
.field input, .field textarea, .search-box input {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  background: rgba(255,255,255,.44);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.field input { height: 50px; padding: 0 15px; border-radius: 8px 18px 8px 8px; }
.field textarea { min-height: 116px; padding: 14px 15px; border-radius: 8px 22px 8px 8px; line-height: 1.65; resize: vertical; }
.field input:focus, .field textarea:focus, .search-box input:focus { border-color: var(--coral); background: var(--cream); box-shadow: 0 0 0 4px rgba(231,111,81,.1); }
.password-input { position: relative; width: 100%; }
.password-input input { padding-right: 72px; }
.password-input button { position: absolute; top: 50%; right: 8px; min-width: 54px; height: 34px; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(23,37,31,.07); color: var(--forest-3); font-size: .68rem; font-weight: 750; cursor: pointer; transform: translateY(-50%); transition: background 160ms ease, color 160ms ease; }
.password-input button:hover, .password-input button:focus-visible { outline: 0; background: var(--forest); color: var(--cream); }
.password-input button[aria-pressed="true"] { background: rgba(231,111,81,.12); color: var(--coral-dark); }
.field small { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.field code { padding: 1px 4px; border-radius: 4px; background: var(--paper-2); }
.form-error { min-height: 18px; margin: -3px 0 0; color: #b64232; font-size: .75rem; }
.auth-card .field input { background: rgba(255,255,255,.58); border-radius: 6px 17px 6px 6px; }
.auth-footnote { position: relative; margin: 25px 0 0; color: var(--muted); font-size: .62rem; letter-spacing: .035em; text-align: center; }

.brand-lockup, .auth-headline, .auth-manifesto, .auth-card, .auth-footnote { animation: auth-reveal 700ms cubic-bezier(.22,1,.36,1) both; }
.auth-headline { animation-delay: 80ms; }
.auth-manifesto { animation-delay: 150ms; }
.auth-card { animation-delay: 120ms; }
.auth-footnote { animation-delay: 190ms; }
@keyframes auth-reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.primary-button, .secondary-button, .text-button {
  border: 0;
  cursor: pointer;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 50px; padding: 0 19px; border: 1px solid var(--forest); border-radius: 14px; background: linear-gradient(135deg, var(--forest-2), var(--forest)); color: var(--cream); box-shadow: 0 10px 24px rgba(23,37,31,.16), 4px 4px 0 var(--coral); transition: transform 170ms ease, box-shadow 170ms ease, filter 170ms ease; }
.primary-button:hover { filter: brightness(1.05); transform: translateY(-2px); box-shadow: 0 15px 30px rgba(23,37,31,.2), 5px 6px 0 var(--coral); }
.primary-button:disabled { opacity: .58; cursor: wait; transform: none; box-shadow: 4px 4px 0 rgba(231,111,81,.5); }
.primary-button b { color: var(--lime); font-size: 1.05rem; }
.primary-button.full, .secondary-button.full { width: 100%; }
.secondary-button { min-height: 45px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.3); transition: border-color 160ms ease, background 160ms ease; }
.secondary-button:hover, .secondary-button:focus-visible { border-color: rgba(23,37,31,.32); outline: 0; background: rgba(255,255,255,.65); }
.text-button { padding: 8px 2px; background: transparent; color: var(--muted); }

.product-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100dvh; opacity: 0; }
.product-shell.arrive { animation: product-arrive 520ms cubic-bezier(.22,1,.36,1) forwards; }
@keyframes product-arrive { from { opacity: 0; } to { opacity: 1; } }
.sidebar { position: sticky; top: 0; z-index: 20; display: flex; height: 100dvh; flex-direction: column; overflow: hidden; padding: 28px 20px 22px; background: radial-gradient(circle at 18% 10%, rgba(220,230,110,.08), transparent 18rem), linear-gradient(155deg, #1c3027, var(--forest) 58%); color: var(--cream); box-shadow: 12px 0 38px rgba(17,29,23,.08); }
.sidebar::after { position: absolute; right: -110px; bottom: 12%; width: 240px; height: 240px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.sidebar > * { position: relative; z-index: 1; }
.side-brand { padding: 0 8px; }
.side-brand .brand-mark { width: 40px; height: 40px; font-size: 1.15rem; }
.side-brand strong { font-family: var(--serif); font-size: 1.03rem; font-weight: 500; }
.side-brand small { color: rgba(255,250,240,.46); font-size: .59rem; letter-spacing: .15em; text-transform: uppercase; }
.side-nav { display: flex; flex: 1; flex-direction: column; gap: 9px; margin-top: 52px; }
.side-link { display: grid; grid-template-columns: 38px 1fr; gap: 11px; align-items: center; width: 100%; min-height: 64px; padding: 11px 12px; border: 1px solid transparent; border-radius: 18px; background: transparent; color: rgba(255,250,240,.58); text-align: left; text-decoration: none; cursor: pointer; transition: color 170ms ease, background 170ms ease, border-color 170ms ease, transform 170ms ease; }
.side-link:hover, .side-link:focus-visible { border-color: rgba(255,255,255,.08); outline: 0; background: rgba(255,255,255,.055); color: var(--cream); transform: translateX(2px); }
.side-link > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.side-link strong { font-size: .79rem; }
.side-link small { font-size: .62rem; color: rgba(255,250,240,.32); }
.side-link.active { border-color: rgba(220,230,110,.16); background: linear-gradient(135deg, rgba(220,230,110,.14), rgba(255,255,255,.06)); color: var(--lime); box-shadow: inset 3px 0 0 var(--lime); }
.side-link.active small { color: rgba(255,250,240,.58); }
.side-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.09); border-radius: 11px; background: rgba(255,255,255,.04); font-size: 1.08rem; text-align: center; }
.studio-side-button { display: grid; grid-template-columns: 34px minmax(0,1fr) 22px; gap: 10px; align-items: center; min-height: 58px; margin: 8px 4px 5px; padding: 9px 11px; border: 1px solid rgba(220,230,110,.2); border-radius: 15px; background: rgba(255,255,255,.055); color: var(--cream); text-align: left; cursor: pointer; transition: transform 170ms ease, border-color 170ms ease, background 170ms ease; }
.studio-side-button:hover, .studio-side-button:focus-visible { border-color: rgba(220,230,110,.48); outline: 0; background: rgba(220,230,110,.11); transform: translateY(-2px); }
.studio-side-button > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--coral); color: white; font-size: 1rem; }
.studio-side-button > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.studio-side-button strong { color: var(--lime); font-size: .75rem; }
.studio-side-button small { color: rgba(255,250,240,.42); font-size: .58rem; }
.studio-side-button b { color: var(--lime); font-size: .82rem; font-weight: 500; }
.create-side-button { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; margin: 10px 4px 22px; border: 1px solid rgba(220,230,110,.34); border-radius: 15px; background: linear-gradient(135deg, #e7ef82, var(--lime)); color: var(--forest); font-weight: 750; cursor: pointer; box-shadow: 0 12px 28px rgba(10,20,14,.18); transition: transform 170ms ease, box-shadow 170ms ease; }
.create-side-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(10,20,14,.23); }
.create-side-button span { font-family: var(--serif); font-size: 1.35rem; }
.side-account { display: grid; grid-template-columns: 39px minmax(0,1fr) 30px; gap: 10px; align-items: center; padding: 14px 8px 0; border-top: 1px solid var(--line-dark); }
.side-account > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.side-account strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.side-account small { color: rgba(255,250,240,.4); font-size: .61rem; }
.account-avatar { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid rgba(255,250,240,.24); border-radius: 50%; background: var(--coral); background-position: center; background-size: cover; color: white; }
.account-avatar.has-avatar { color: transparent; }
.icon-button { display: grid; place-items: center; width: 31px; height: 31px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.1); }
.mobile-header, .bottom-nav { display: none; }

.workspace { position: relative; width: 100%; max-width: 1480px; min-width: 0; margin: 0 auto; padding: 0 clamp(30px, 4.6vw, 70px) 90px; }
.view-section:not(.hidden) > .workspace-header { animation: ui-rise-in 380ms cubic-bezier(.22,1,.36,1) both; }
.view-section:not(.hidden) > :is(.welcome-strip, .service-notice, .shelf-tools, .privacy-banner, .chat-list, .usage-section-heading, .usage-summary, .usage-toolbar, .usage-board, .credit-wallet, .credit-history-heading, .credit-history, .player-profile-hero, .profile-card-grid) { animation: ui-rise-in 420ms 70ms cubic-bezier(.22,1,.36,1) both; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; min-height: 132px; padding: 36px 0 24px; border-bottom: 1px solid var(--line); }
.workspace-header .eyebrow { margin-bottom: 7px; color: var(--coral-dark); }
.workspace-header h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.5rem, 4vw, 4.4rem); font-weight: 500; letter-spacing: -.045em; }
.workspace-header > div:first-child > p:last-child:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); font-size: .85rem; }
.provider-pill { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.42); color: var(--muted); font-size: .68rem; box-shadow: 0 8px 20px rgba(23,37,31,.04); white-space: nowrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #7f9d52; box-shadow: 0 0 0 5px rgba(127,157,82,.13); }

.welcome-strip { position: relative; display: grid; grid-template-columns: minmax(260px, .78fr) minmax(460px, 1.22fr); gap: clamp(28px, 5vw, 70px); align-items: center; margin: 30px 0 58px; padding: clamp(28px, 4vw, 48px); overflow: hidden; border: 1px solid rgba(255,255,255,.07); border-radius: 30px; background: radial-gradient(circle at 90% 10%, rgba(220,230,110,.12), transparent 23rem), linear-gradient(125deg, var(--forest-2), var(--forest)); color: var(--cream); box-shadow: var(--shadow); }
.welcome-scene { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); margin: 26px 0 24px; isolation: isolate; }
.welcome-figure-stage { position: relative; grid-area: 1 / 1; height: clamp(290px, 26vw, 370px); pointer-events: none; user-select: none; }
.welcome-deer { position: absolute; right: auto; bottom: clamp(-76px, -5.3vw, -58px); left: 50%; z-index: 0; width: clamp(440px, 38vw, 560px); aspect-ratio: 1496 / 1184; transform: translateX(-50%); }
.welcome-deer img { display: block; width: 100%; max-width: none; }
.welcome-deer-hand { z-index: 2; clip-path: polygon(22% 74%, 33% 74%, 34.8% 79.4%, 36.8% 81.9%, 38.3% 84%, 39% 88%, 36% 92%, 23% 92%, 22.4% 86.2%, 21.5% 84%, 21% 82.8%, 21.7% 81%); }
.hide-home-whale .welcome-figure-stage { display: none; }
.hide-home-whale .welcome-scene .welcome-strip { grid-area: 1 / 1; margin-top: 0; }
.hide-chat-whale :is(.chat-mascot, .chat-mascot-fin) { display: none; }
.whale-appearance-settings { margin: 24px 0; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,247,.6); }
.whale-appearance-settings h2 { margin: 0 0 16px; font-size: 1.1rem; }
.whale-appearance-settings label { display: flex; justify-content: space-between; align-items: center; gap: 16px; cursor: pointer; }
.whale-appearance-settings small { display: block; margin-top: 6px; color: var(--muted); font-size: .7rem; }
.whale-appearance-settings input { flex: 0 0 auto; width: 22px; height: 22px; accent-color: var(--forest); }
.welcome-scene .welcome-strip { grid-area: 2 / 1; z-index: 1; margin: -3px 0 0; padding-top: clamp(40px, 5vw, 60px); }
.welcome-strip::after { position: absolute; right: -85px; bottom: -130px; width: 290px; height: 290px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; content: ""; }
.welcome-copy, .three-steps { position: relative; z-index: 1; min-width: 0; }
.welcome-copy .tiny-label { color: var(--lime); }
.welcome-copy h2 { margin: 0; font-family: var(--serif); font-size: clamp(2rem, 3.2vw, 3.4rem); font-weight: 500; line-height: 1.08; letter-spacing: -.035em; overflow-wrap: anywhere; }
.welcome-copy p { max-width: 560px; margin: 13px 0 0; color: rgba(255,250,240,.6); font-size: .8rem; line-height: 1.75; }
.service-notice { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr) minmax(120px, 168px); gap: 16px; align-items: center; margin: -30px 0 46px; padding: 18px 20px; overflow: hidden; border: 1px solid rgba(190,75,50,.2); border-left: 4px solid var(--coral); border-radius: 18px; background: linear-gradient(110deg, rgba(231,111,81,.11), rgba(255,255,255,.34)); box-shadow: 0 12px 32px rgba(73,37,27,.06); }
.service-notice[hidden], .service-notice[data-temporarily-hidden="true"] { display: none !important; }
.service-notice::after { position: absolute; right: -36px; top: -58px; width: 150px; height: 150px; border: 1px solid rgba(231,111,81,.1); border-radius: 50%; content: ""; pointer-events: none; }
.service-notice-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--coral); color: white; font-family: var(--serif); font-size: 1.45rem; box-shadow: 0 8px 20px rgba(190,75,50,.22); }
.service-notice-copy { position: relative; z-index: 1; min-width: 0; }
.service-notice-copy .eyebrow { margin: 1px 0 4px; color: var(--coral-dark); font-size: .72rem; }
.service-notice-copy h2 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; }
.service-notice-copy > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: .96rem; line-height: 1.72; }
.service-notice-copy strong { color: var(--coral-dark); font-weight: 800; }
.service-notice-meme { position: relative; z-index: 1; display: block; width: 100%; max-height: 168px; object-fit: cover; border: 1px solid rgba(190,75,50,.18); border-radius: 12px; box-shadow: 0 8px 18px rgba(73,37,27,.12); }
.three-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
.three-steps li { display: flex; min-width: 0; min-height: 116px; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.04); backdrop-filter: blur(8px); }
.three-steps b { color: var(--coral); font-family: var(--serif); font-size: 1.4rem; font-weight: 500; }
.three-steps span { font-size: .76rem; }

.shelf-tools { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.shelf-tools .eyebrow { margin-bottom: 6px; color: var(--muted); }
.shelf-tools h2 { margin: 0; font-family: var(--serif); font-size: 2.2rem; font-weight: 500; }
.search-box { position: relative; width: min(100%, 340px); }
.search-box span { position: absolute; left: 14px; top: 50%; color: var(--muted); font-size: 1.2rem; transform: translateY(-50%); }
.search-box input { height: 48px; padding: 0 16px 0 42px; border-radius: 16px; background: rgba(255,255,255,.5); box-shadow: 0 8px 24px rgba(23,37,31,.04); }

.character-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.character-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid rgba(20,33,27,.1); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-soft); cursor: pointer; animation: card-arrive 480ms cubic-bezier(.22,1,.36,1) both; transition: transform 190ms ease, box-shadow 190ms ease, border-color 190ms ease; backdrop-filter: blur(10px); }
.character-card:nth-child(2) { animation-delay: 55ms; }.character-card:nth-child(3) { animation-delay: 110ms; }
@keyframes card-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.character-card:hover, .character-card:focus-visible { border-color: rgba(231,111,81,.42); outline: none; box-shadow: 0 24px 56px rgba(22,36,28,.14); transform: translateY(-6px); }
.card-visual { position: relative; height: clamp(220px, 23vw, 350px); overflow: hidden; background: linear-gradient(145deg, var(--forest-3), var(--forest)); }
.card-visual::after { content: ""; position: absolute; inset: auto 0 0; height: 38%; background: linear-gradient(transparent, rgba(18,30,24,.35)); }
.card-visual img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.character-card:hover .card-visual img { transform: scale(1.025); }
.avatar-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--lime); font-family: var(--serif); font-size: 7rem; }
.avatar-fallback.large { min-height: 500px; }
.card-badges { position: absolute; z-index: 2; left: 14px; top: 14px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 28px); }
.visibility-badge, .interaction-card-badge { padding: 6px 9px; border-radius: 999px; color: white; font-size: .6rem; line-height: 1; backdrop-filter: blur(8px); }
.visibility-badge { background: rgba(23,37,31,.78); }
.visibility-badge.private { background: rgba(185,75,53,.85); }
.interaction-card-badge { background: rgba(38,134,88,.92); box-shadow: 0 4px 14px rgba(17,94,60,.22); }
.card-body { padding: 20px 20px 18px; }
.card-meta { margin: 0 0 7px; overflow: hidden; color: var(--coral-dark); font-size: .58rem; font-weight: 700; letter-spacing: .11em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.card-body h3 { margin: 0; overflow: hidden; font-family: var(--serif); font-size: 1.72rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.card-tagline { display: -webkit-box; min-height: 39px; margin: 8px 0 15px; overflow: hidden; color: var(--muted); font-size: .73rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .64rem; }
.card-arrow { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: var(--forest); color: var(--lime); font-size: .82rem; }
.loading-card { min-height: 420px; padding: 0; pointer-events: none; }
.loading-card div { height: 68%; background: linear-gradient(90deg,var(--paper-2),rgba(255,255,255,.5),var(--paper-2)); background-size: 220% 100%; animation: shimmer 1.2s infinite linear; }
.loading-card span { display: block; width: 65%; height: 14px; margin: 20px 18px 0; border-radius: 8px; background: var(--paper-2); }
.loading-card span:last-child { width: 42%; margin-top: 10px; }
@keyframes shimmer { to { background-position: -220% 0; } }

.studio-mine-button { display: none; text-decoration: none; }
.privacy-banner { display: flex; gap: 16px; align-items: center; margin: 34px 0; padding: 18px 20px; border: 1px solid rgba(127,157,82,.25); border-radius: 8px 26px 8px 8px; background: rgba(220,230,110,.13); }
.privacy-banner > span { font-family: var(--serif); font-size: 2rem; color: var(--forest-3); }
.privacy-banner strong { font-size: .78rem; }
.privacy-banner p { margin: 4px 0 0; color: var(--muted); font-size: .7rem; }
.empty-state { display: grid; place-items: center; min-height: 390px; padding: 50px 20px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid var(--line); border-radius: 50%; color: var(--coral-dark); font-family: var(--serif); font-size: 2.2rem; }
.empty-state h3 { margin: 19px 0 6px; font-family: var(--serif); font-size: 1.9rem; font-weight: 500; }
.empty-state p { margin: 0 0 22px; color: var(--muted); font-size: .78rem; }

.chat-list { display: flex; flex-direction: column; margin-top: 32px; border-top: 1px solid var(--line); }
.chat-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; min-height: 90px; padding: 0 6px; border-bottom: 1px solid var(--line); animation: ui-row-enter 360ms cubic-bezier(.22,1,.36,1) both; }
.chat-row:nth-child(2) { animation-delay: 35ms; }
.chat-row:nth-child(3) { animation-delay: 70ms; }
.chat-row:nth-child(4) { animation-delay: 105ms; }
.chat-row:nth-child(n+5) { animation-delay: 140ms; }
.chat-row-main { display: grid; grid-template-columns: 58px minmax(0,1fr) 36px; gap: 15px; align-items: center; width: 100%; min-height: 90px; padding: 14px 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.chat-row-main:hover, .chat-row-main:focus-visible { outline: 0; background: rgba(255,255,255,.28); }
.chat-row-avatar { display: grid; place-items: center; width: 56px; height: 56px; overflow: hidden; border-radius: 50% 50% 38% 62%; background: var(--forest); color: var(--lime); font-family: var(--serif); font-size: 1.5rem; }
.chat-row-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-row-body { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.chat-row-body > span { display: flex; justify-content: space-between; gap: 14px; }
.chat-row-body strong { font-family: var(--serif); font-size: 1.16rem; font-weight: 500; }
.chat-row-body time, .chat-row-body small { color: var(--muted); font-size: .66rem; }
.chat-row-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-main > b { color: var(--coral-dark); font-weight: 400; }
.chat-row-delete { min-width: 54px; min-height: 34px; padding: 0 10px; border: 1px solid rgba(185,75,53,.22); border-radius: 999px; background: rgba(231,111,81,.06); color: var(--coral-dark); font-size: .64rem; cursor: pointer; }
.chat-row-delete:hover, .chat-row-delete:focus-visible { outline: 0; border-color: var(--coral); background: rgba(231,111,81,.14); }
.chat-row-delete:disabled { cursor: wait; opacity: .48; }

.usage-header { align-items: center; }
.usage-live-pill { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 10px 14px; border: 1px solid rgba(127,157,82,.25); border-radius: 999px; background: rgba(220,230,110,.12); color: var(--forest-3); font-size: .66rem; white-space: nowrap; }
.usage-live-pill span { width: 8px; height: 8px; border-radius: 50%; background: #7f9d52; box-shadow: 0 0 0 5px rgba(127,157,82,.13); }
.usage-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin: 0 0 17px; }
.usage-section-heading .eyebrow { margin-bottom: 6px; color: var(--coral-dark); }
.usage-section-heading h2 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.usage-section-heading > p { max-width: 500px; margin: 0; color: var(--muted); font-size: .64rem; line-height: 1.65; text-align: right; }
.usage-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 42px; }
.usage-summary article { min-width: 0; padding: 19px 20px; border: 1px solid var(--line); border-radius: 8px 22px 8px 8px; background: rgba(255,255,255,.34); box-shadow: 0 10px 24px rgba(23,37,31,.04); }
.usage-summary small, .usage-summary span { display: block; color: var(--muted); font-size: .59rem; }
.usage-summary strong { display: block; margin: 8px 0 5px; overflow: hidden; color: var(--forest); font-family: var(--serif); font-size: 1.65rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.usage-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 17px; }
.usage-toolbar .eyebrow { margin-bottom: 6px; color: var(--coral-dark); }
.usage-toolbar h2 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.usage-date-controls { display: flex; align-items: flex-end; gap: 8px; }
.usage-date-controls label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .55rem; }
.usage-date-controls input, .usage-date-controls button { height: 42px; border: 1px solid var(--line); background: rgba(255,255,255,.48); color: var(--forest); }
.usage-date-controls input { min-width: 152px; padding: 0 11px; border-radius: 12px; }
.usage-date-controls button { min-width: 42px; padding: 0 12px; border-radius: 12px; font-size: .68rem; font-weight: 700; cursor: pointer; }
.usage-date-controls button:hover, .usage-date-controls button:focus-visible { outline: 0; border-color: var(--coral); background: var(--cream); }
.usage-date-controls button:disabled { cursor: not-allowed; opacity: .4; }
.usage-board { overflow: hidden; border: 1px solid var(--line); border-radius: 10px 28px 10px 10px; background: rgba(255,255,255,.3); box-shadow: var(--shadow-soft); }
.usage-board-head, .usage-row { display: grid; grid-template-columns: minmax(210px,2fr) minmax(120px,1fr) minmax(80px,.7fr) minmax(110px,1fr); gap: 18px; align-items: center; }
.usage-board-head { min-height: 48px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(23,37,31,.055); color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.usage-row { min-height: 76px; padding: 13px 22px; border-bottom: 1px solid var(--line); }
.usage-row:last-child { border-bottom: 0; }
.usage-row.current { background: linear-gradient(90deg, rgba(220,230,110,.18), transparent 64%); }
.usage-player { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 12px; align-items: center; min-width: 0; }
.usage-rank { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--coral-dark); font-family: var(--serif); font-size: .85rem; }
.usage-player strong { overflow: hidden; font-family: var(--serif); font-size: 1.06rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.usage-player small { display: block; margin-top: 3px; color: var(--muted); font-size: .57rem; }
.usage-metric { min-width: 0; }
.usage-metric strong { display: block; color: var(--forest); font-size: .78rem; }
.usage-metric small { display: block; margin-top: 4px; color: var(--muted); font-size: .57rem; }
.usage-empty { display: grid; place-items: center; min-height: 230px; padding: 34px; text-align: center; }
.usage-empty > span { color: var(--coral-dark); font-family: var(--serif); font-size: 2rem; }
.usage-empty strong { margin: 9px 0 5px; font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.usage-empty small, .usage-footnote { color: var(--muted); font-size: .62rem; }
.usage-footnote { margin: 12px 4px 0; line-height: 1.6; }

.credit-header { align-items: center; }
.credit-private-pill { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 10px 14px; border: 1px solid rgba(127,157,82,.25); border-radius: 999px; background: rgba(220,230,110,.12); color: var(--forest-3); font-size: .66rem; white-space: nowrap; }
.credit-private-pill span { width: 8px; height: 8px; border-radius: 50%; background: #7f9d52; box-shadow: 0 0 0 5px rgba(127,157,82,.13); }
.credit-wallet { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 28px 42px; align-items: end; margin: 34px 0 42px; padding: 32px clamp(26px,4vw,46px) 28px; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 10px 36px 10px 10px; background: radial-gradient(circle at 84% 11%, rgba(220,230,110,.16), transparent 19rem), linear-gradient(128deg, #29483d, var(--forest)); color: var(--cream); box-shadow: var(--shadow); }
.credit-wallet::before { position: absolute; top: -105px; right: 13%; width: 230px; height: 230px; border: 1px solid rgba(255,255,255,.075); border-radius: 50%; content: ""; }
.credit-wallet::after { position: absolute; right: -55px; bottom: -115px; width: 230px; height: 230px; border: 1px solid rgba(255,255,255,.075); border-radius: 50%; content: ""; }
.credit-wallet-copy, .credit-wallet-amount, .credit-wallet-rule { position: relative; z-index: 1; }
.credit-wallet-copy .eyebrow { margin-bottom: 8px; color: var(--lime); }
.credit-wallet-copy h2 { margin: 0; font-family: var(--serif); font-size: 2.25rem; font-weight: 500; }
.credit-wallet-copy > p:last-child { max-width: 610px; margin: 10px 0 0; color: rgba(255,250,240,.54); font-size: .67rem; line-height: 1.65; }
.credit-wallet-amount { display: flex; align-items: flex-end; min-width: 205px; flex-direction: column; }
.credit-wallet-amount small { color: rgba(255,250,240,.52); font-size: .62rem; }
.credit-wallet-amount strong { margin: 3px 0 4px; color: var(--lime); font-family: var(--serif); font-size: clamp(3rem,6vw,4.8rem); font-weight: 500; line-height: .95; letter-spacing: -.035em; }
.credit-wallet-amount span { color: rgba(255,250,240,.58); font-size: .64rem; }
.credit-wallet-rule { grid-column: 1/-1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.08); }
.credit-wallet-rule > span { min-width: 0; padding: 14px 17px; background: rgba(11,28,22,.34); }
.credit-wallet-rule small, .credit-wallet-rule strong { display: block; }
.credit-wallet-rule small { color: rgba(255,250,240,.45); font-size: .57rem; }
.credit-wallet-rule strong { margin-top: 6px; overflow: hidden; color: var(--cream); font-family: var(--serif); font-size: 1.08rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.credit-history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 17px; }
.credit-history-heading .eyebrow { margin-bottom: 6px; color: var(--coral-dark); }
.credit-history-heading h2 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.credit-history-heading > p { max-width: 480px; margin: 0; color: var(--muted); font-size: .64rem; line-height: 1.65; text-align: right; }
.credit-history { overflow: hidden; border: 1px solid var(--line); border-radius: 10px 28px 10px 10px; background: rgba(255,255,255,.3); box-shadow: var(--shadow-soft); }
.credit-call-row { display: grid; grid-template-columns: 40px minmax(0,1fr) minmax(170px,.48fr); gap: 15px; align-items: center; min-height: 78px; padding: 13px 22px; border-bottom: 1px solid var(--line); }
.credit-call-row:last-child { border-bottom: 0; }
.credit-call-row.is-pending { background: linear-gradient(90deg, rgba(220,230,110,.18), transparent 58%); }
.credit-call-marker { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: var(--forest-3); font-family: var(--serif); font-size: 1.2rem; }
.credit-call-row.is-charged .credit-call-marker { border-color: rgba(231,111,81,.24); background: rgba(231,111,81,.08); color: var(--coral-dark); }
.credit-call-model, .credit-call-status { min-width: 0; }
.credit-call-model strong, .credit-call-model small, .credit-call-status strong, .credit-call-status small { display: block; }
.credit-call-model strong { overflow: hidden; font-family: var(--serif); font-size: 1.06rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.credit-call-model small { margin-top: 5px; color: var(--muted); font-size: .59rem; }
.credit-call-status { text-align: right; }
.credit-call-status strong { color: var(--forest); font-size: .76rem; }
.credit-call-row.is-charged .credit-call-status strong { color: var(--coral-dark); }
.credit-call-row.is-pending .credit-call-status strong { color: var(--forest-3); }
.credit-call-status small { margin-top: 5px; color: var(--muted); font-size: .57rem; }
.credit-empty { display: grid; place-items: center; min-height: 230px; padding: 34px; text-align: center; }
.credit-empty > span { color: var(--coral-dark); font-family: var(--serif); font-size: 2rem; }
.credit-empty strong { margin: 9px 0 5px; font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.credit-empty small { color: var(--muted); font-size: .62rem; }
.credit-loading { min-height: 120px; color: var(--muted); font-size: .68rem; }
.credit-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 40px; }
.credit-pagination button, .credit-pagination span { min-height: 40px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.42); color: var(--forest); }
.credit-pagination button { min-width: 104px; padding: 0 14px; font-size: .65rem; font-weight: 750; cursor: pointer; }
.credit-pagination button:hover, .credit-pagination button:focus-visible { outline: 0; border-color: var(--coral); background: var(--cream); }
.credit-pagination button:disabled { cursor: not-allowed; opacity: .38; }
.credit-pagination span { display: inline-flex; min-width: 150px; align-items: center; justify-content: center; padding: 0 14px; color: var(--muted); font-size: .62rem; }

.profile-header { align-items: center; }
.profile-private-pill { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 10px 14px; border: 1px solid rgba(127,157,82,.25); border-radius: 999px; background: rgba(220,230,110,.12); color: var(--forest-3); font-size: .66rem; white-space: nowrap; }
.profile-private-pill i { width: 8px; height: 8px; border-radius: 50%; background: #7f9d52; box-shadow: 0 0 0 5px rgba(127,157,82,.13); }
.player-profile-hero { position: relative; display: flex; min-height: 390px; align-items: center; flex-direction: column; justify-content: center; margin: 34px 0 24px; padding: 54px 28px 32px; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 10px 42px 10px 10px; background: radial-gradient(circle at 50% 18%, rgba(220,230,110,.14), transparent 20rem), linear-gradient(145deg, #29483d, var(--forest)); color: var(--cream); box-shadow: var(--shadow); text-align: center; }
.player-profile-hero::before, .player-profile-hero::after { position: absolute; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; content: ""; }
.player-profile-hero::before { left: -120px; top: -210px; width: 410px; height: 410px; }
.player-profile-hero::after { right: -165px; bottom: -240px; width: 440px; height: 440px; }
.profile-geometry { position: absolute; left: 50%; top: 48%; width: 260px; height: 260px; transform: translate(-50%,-50%); }
.profile-geometry i { position: absolute; inset: 0; border: 1px solid rgba(231,111,81,.3); transform: rotate(45deg); }
.profile-geometry i:nth-child(2) { inset: 34px; border-color: rgba(220,230,110,.16); }
.profile-geometry i:nth-child(3) { inset: 68px; border-color: rgba(255,255,255,.13); }
.profile-avatar { position: relative; z-index: 1; display: grid; place-items: center; width: 112px; height: 112px; padding: 0; overflow: visible; border: 6px solid rgba(255,250,240,.88); border-radius: 50%; background: linear-gradient(145deg, var(--coral), #b94f3b); background-position: center; background-size: cover; color: white; box-shadow: 0 18px 42px rgba(7,19,14,.34), 0 0 0 10px rgba(220,230,110,.08); font-family: var(--serif); font-size: 3.1rem; cursor: pointer; transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease; }
.profile-avatar:hover, .profile-avatar:focus-visible { outline: 0; box-shadow: 0 20px 48px rgba(7,19,14,.4), 0 0 0 10px rgba(220,230,110,.14); transform: translateY(-2px); }
.profile-avatar:disabled { cursor: wait; opacity: .68; }
.profile-avatar.has-avatar .profile-avatar-fallback { visibility: hidden; }
.profile-avatar-edit { position: absolute; right: -12px; bottom: -5px; display: grid; place-items: center; min-width: 42px; height: 27px; padding: 0 8px; border: 2px solid var(--cream); border-radius: 999px; background: var(--lime); color: var(--forest); box-shadow: 0 7px 18px rgba(7,19,14,.25); font-family: var(--sans); font-size: .52rem; font-weight: 800; }
.profile-avatar-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.profile-identity { position: relative; z-index: 1; width: 100%; max-width: 36rem; min-width: 0; margin-top: 18px; }
.profile-identity p { margin: 0 0 6px; color: var(--lime); font-size: .55rem; font-weight: 800; letter-spacing: .16em; }
.profile-identity h2 { margin: 0; font-family: var(--serif); font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 500; line-height: 1.3; letter-spacing: -.02em; overflow-wrap: anywhere; }
.profile-identity span { display: block; margin-top: 10px; color: rgba(255,250,240,.53); font-size: .7rem; }
.profile-actions { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; width: min(100%,470px); margin-top: 24px; }
.profile-actions button { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px 17px 8px 8px; color: var(--cream); font-size: .7rem; font-weight: 750; cursor: pointer; }
.profile-actions b { font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.profile-edit-button { background: rgba(220,230,110,.13); }
.profile-edit-button b { color: var(--lime); }
.profile-logout-button { background: rgba(255,255,255,.055); }
.profile-actions button:hover, .profile-actions button:focus-visible { outline: 0; border-color: rgba(220,230,110,.45); background: rgba(255,255,255,.12); }
.profile-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; padding-bottom: 30px; }
.profile-card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px 24px 8px 8px; background: rgba(255,255,255,.34); box-shadow: 0 10px 24px rgba(23,37,31,.04); }
.profile-card small, .profile-card > span { display: block; color: var(--muted); font-size: .59rem; }
.profile-card strong { display: block; margin: 10px 0 7px; overflow-wrap: anywhere; color: var(--forest); font-family: var(--serif); font-size: 1.42rem; font-weight: 500; }
.profile-persona-card { grid-column: 1/-1; display: grid; grid-template-columns: minmax(190px,.34fr) minmax(300px,1fr) auto; gap: 28px; align-items: center; background: linear-gradient(115deg, rgba(255,255,255,.42), rgba(220,230,110,.08)); }
.profile-persona-card > div > small { color: var(--coral-dark); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.profile-persona-card > div > span { display: block; margin-top: 8px; color: var(--muted); font-size: .59rem; line-height: 1.55; }
.profile-summary { display: -webkit-box; margin: 0; overflow: hidden; color: var(--forest-3); font-size: .72rem; line-height: 1.7; white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.profile-persona-card button { display: inline-flex; min-height: 42px; align-items: center; gap: 14px; padding: 0 14px; border: 1px solid var(--forest); border-radius: 7px 15px 7px 7px; background: var(--forest); color: var(--cream); font-size: .65rem; font-weight: 750; white-space: nowrap; cursor: pointer; }
.profile-persona-card button b { color: var(--lime); font-family: var(--serif); font-size: .9rem; }
.profile-persona-card button:hover, .profile-persona-card button:focus-visible { outline: 0; filter: brightness(1.08); }

.worldbooks-header { align-items: center; }
.worldbook-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.worldbook-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 17px; margin-top: 32px; }
.worldbook-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px 34px 10px 10px; background: rgba(255,255,255,.26); box-shadow: 0 12px 24px rgba(32,36,25,.05); transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.worldbook-card:hover { transform: translateY(-3px); border-color: rgba(47,94,75,.42); box-shadow: 0 18px 30px rgba(32,36,25,.09); }
.worldbook-card-open { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; width: 100%; min-height: 142px; padding: 22px; border: 0; border-radius: inherit; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.worldbook-card-open strong { overflow: hidden; align-self: end; font-family: var(--serif); font-size: 1.45rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.worldbook-card-open > span { grid-column: 1; color: var(--muted); font-size: .68rem; }
.worldbook-card-arrow { grid-column: 2 !important; grid-row: 1 / span 2; align-self: center; color: var(--coral-dark) !important; font-size: .68rem !important; font-weight: 700; white-space: nowrap; }
.worldbook-card-open:focus-visible { outline: 3px solid rgba(231,111,81,.3); outline-offset: -3px; }
.worldbook-loading { margin: 0; padding: 25px 0; color: var(--muted); font-size: .75rem; }

.modal-layer { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12,22,17,.7); backdrop-filter: blur(14px) saturate(.8); }
.modal-layer:not(.hidden) .modal-backdrop { animation: ui-fade-in 220ms ease-out both; }
.modal-layer:not(.hidden) > :not(.modal-backdrop) { animation: ui-dialog-in 300ms cubic-bezier(.22,1,.36,1) both; }
.character-dialog { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(320px,.9fr) minmax(380px,1.1fr); width: min(100%, 960px); height: min(780px, calc(100dvh - 48px)); max-height: calc(100dvh - 48px); overflow: hidden; border: 1px solid rgba(255,255,255,.45); border-radius: 32px; background: var(--paper); box-shadow: 0 38px 110px rgba(0,0,0,.34); }
.modal-close { position: absolute; z-index: 4; right: 18px; top: 16px; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: rgba(243,237,223,.86); font-size: 1.45rem; cursor: pointer; backdrop-filter: blur(8px); }
.detail-image { min-height: 0; overflow: hidden; background: var(--forest); }
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { display: flex; min-height: 0; flex-direction: column; padding: clamp(34px,5vw,68px); overflow: hidden; }
.detail-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding-right: 8px; scrollbar-gutter: stable; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-badges span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--coral-dark); font-size: .6rem; }
.detail-body h2 { margin: 22px 0 9px; font-family: var(--serif); font-size: clamp(3rem,5vw,5rem); font-weight: 500; line-height: .94; letter-spacing: -.05em; }
.detail-tagline { margin: 0; color: var(--coral-dark); font-family: var(--serif); font-size: 1.15rem; font-style: italic; line-height: 1.5; }
.detail-description { margin: 24px 0; color: var(--muted); font-size: .8rem; line-height: 1.8; white-space: pre-wrap; }
.detail-worldbooks { margin: 0 0 24px; padding: 15px; border: 1px solid var(--line); border-radius: 8px 26px 8px 8px; background: rgba(255,255,255,.24); }
.detail-worldbooks-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--forest); font-size: .7rem; font-weight: 700; }
.detail-worldbooks-heading small { color: var(--muted); font-size: .61rem; font-weight: 400; }
.detail-worldbook-list { display: flex; flex-direction: column; gap: 9px; margin-top: 11px; }
.detail-worldbook { overflow: hidden; border: 1px solid var(--line); border-radius: 6px 18px 6px 6px; background: rgba(255,255,255,.28); }
.detail-worldbook summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; cursor: pointer; list-style: none; }
.detail-worldbook summary::-webkit-details-marker { display: none; }
.detail-worldbook summary span { overflow: hidden; font-size: .69rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.detail-worldbook summary small { flex: 0 0 auto; color: var(--muted); font-size: .59rem; }
.detail-worldbook-content { display: flex; flex-direction: column; gap: 9px; padding: 0 12px 12px; }
.detail-worldbook-content > p { margin: 0; color: var(--muted); font-size: .65rem; }
.detail-worldbook-entry { padding: 10px; border-radius: 5px 15px 5px 5px; background: rgba(47,94,75,.06); }
.detail-worldbook-entry > div { display: flex; justify-content: space-between; gap: 10px; }
.detail-worldbook-entry strong { font-size: .66rem; }
.detail-worldbook-entry small { color: var(--coral-dark); font-size: .56rem; white-space: nowrap; }
.detail-worldbook-keys, .detail-worldbook-text { margin: 7px 0 0; font-size: .62rem; line-height: 1.55; white-space: pre-wrap; }
.detail-worldbook-keys { color: var(--coral-dark); }
.detail-worldbook-text { color: var(--muted); }
.detail-worldbook-warning { margin: 11px 0 0; color: var(--coral-dark); font-size: .61rem; line-height: 1.5; }
.detail-owner { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .69rem; }
.detail-owner span { color: var(--muted); }
.detail-actions { display: flex; flex: 0 0 auto; flex-direction: column; gap: 11px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); background: var(--paper); }
.detail-secondary-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.detail-safety { flex: 0 0 auto; margin: 12px 0 0; color: var(--muted); font-size: .64rem; text-align: center; }

.create-choice-dialog { position: relative; z-index: 1; width: min(100%, 820px); overflow: hidden; border: 1px solid rgba(255,255,255,.48); border-radius: 14px 54px 14px 14px; background: radial-gradient(circle at 92% 5%,rgba(220,230,110,.2),transparent 16rem),var(--paper); box-shadow: 0 38px 110px rgba(0,0,0,.34); }
.create-choice-header { padding: 42px 48px 28px; }
.create-choice-header .eyebrow { margin: 0 0 8px; color: var(--coral-dark); }
.create-choice-header h2 { margin: 0; font-family: var(--serif); font-size: clamp(2.2rem,5vw,3.8rem); font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.create-choice-header > p:last-child { max-width: 560px; margin: 16px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.7; }
.create-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 0 48px 48px; }
.create-choice-card { display: grid; min-width: 0; min-height: 230px; grid-template-rows: auto 1fr auto; gap: 19px; padding: 24px; border: 1px solid var(--line); border-radius: 10px 34px 10px 10px; background: rgba(255,255,255,.42); color: var(--forest); text-align: left; cursor: pointer; transition: border-color 180ms ease,box-shadow 180ms ease,transform 180ms ease; }
.create-choice-card:hover { border-color: rgba(31,76,59,.48); box-shadow: 0 18px 38px rgba(21,39,30,.11); transform: translateY(-3px); }
.create-choice-card:focus-visible { outline: 3px solid rgba(231,111,81,.3); outline-offset: 3px; }
.create-choice-card.studio { background: linear-gradient(145deg,var(--forest),var(--forest-2)); color: var(--cream); }
.create-choice-card.studio:hover { border-color: var(--lime); }
.create-choice-mark { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-size: 1.35rem; }
.create-choice-card > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; align-self: end; }
.create-choice-card small { color: var(--coral-dark); font-size: .55rem; font-weight: 700; letter-spacing: .13em; }
.create-choice-card.studio small { color: var(--lime); }
.create-choice-card strong { margin-top: 7px; font-family: var(--serif); font-size: 1.55rem; font-weight: 500; }
.create-choice-card em { margin-top: 10px; color: var(--muted); font-size: .65rem; font-style: normal; line-height: 1.6; }
.create-choice-card.studio em { color: rgba(255,250,240,.68); }
.create-choice-card > b { justify-self: end; color: var(--coral-dark); font-size: .62rem; font-weight: 700; }
.create-choice-card.studio > b { color: var(--lime); }

.creator-dialog { position: relative; z-index: 1; width: min(100%, 860px); max-height: calc(100dvh - 48px); overflow-y: auto; border-radius: 12px 58px 12px 12px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.34); }
.creator-header { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; min-height: 96px; padding: 24px 34px 18px; border-bottom: 1px solid var(--line); background: rgba(243,237,223,.94); backdrop-filter: blur(14px); }
.creator-header .eyebrow { margin-bottom: 4px; color: var(--coral-dark); }
.creator-header h2 { margin: 0; font-family: var(--serif); font-size: 1.8rem; font-weight: 500; }
.creator-header .modal-close { position: static; flex: 0 0 auto; }
.creator-mode-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 22px 34px 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.creator-mode-tabs.editing { grid-template-columns: repeat(3,minmax(0,1fr)); }
.creator-mode { display: flex; min-width: 0; min-height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.creator-mode strong { font-size: .76rem; }
.creator-mode small { overflow: hidden; font-size: .57rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.creator-mode.active { background: var(--forest); color: var(--cream); }
#creatorForm, .free-creator-panel, .import-panel { padding: 24px 34px 32px; }
.creator-profile-fields { display: flex; flex-direction: column; gap: 18px; }
.creator-field-grid { display: grid; gap: 14px; }
.creator-field-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.creator-field-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.free-creator-panel { display: flex; flex-direction: column; gap: 18px; }
.free-creator-panel > .step-heading { margin-bottom: 4px; }
.free-creator-panel > .primary-button { margin-top: 4px; }
.step-heading { margin-bottom: 7px; text-align: center; }
.step-heading > span { color: var(--coral-dark); font-size: .62rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.step-heading h3 { margin: 8px 0 7px; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.step-heading p { margin: 0; color: var(--muted); font-size: .72rem; }
.advanced-fields { padding: 15px; border: 1px solid var(--line); border-radius: 8px 22px 8px 8px; }
.advanced-fields summary { color: var(--muted); font-size: .75rem; cursor: pointer; }
.advanced-fields[open] summary { margin-bottom: 18px; }
.memory-summary-hero { display: grid; gap: 16px; padding: 18px; border: 1px solid rgba(31,76,59,.16); border-radius: 9px 24px 9px 9px; background: linear-gradient(145deg,rgba(238,247,238,.92),rgba(255,252,242,.78)); }
.memory-summary-hero h3 { margin: 4px 0 6px; color: var(--forest); font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.memory-summary-hero p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.65; }
#chatMemorySummaryForm { display: grid; gap: 18px; }
.memory-summary-model-field,.memory-summary-event-limit-field { gap: 9px; }
.memory-summary-select { position: relative; }
.memory-summary-select select { width: 100%; height: 56px; appearance: none; border: 1px solid rgba(31,76,59,.2); border-radius: 8px 20px 8px 8px; outline: none; padding: 0 58px 0 16px; background: linear-gradient(135deg,rgba(255,255,255,.7),rgba(238,247,238,.72)); color: var(--forest); font: inherit; font-family: var(--serif); font-size: .86rem; cursor: pointer; box-shadow: 0 9px 20px rgba(23,37,31,.045); transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.memory-summary-select i { position: absolute; top: 50%; right: 12px; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--forest); pointer-events: none; transform: translateY(-50%); }
.memory-summary-select i::before { width: 7px; height: 7px; border-right: 2px solid var(--lime); border-bottom: 2px solid var(--lime); content: ""; transform: translateY(-2px) rotate(45deg); }
.memory-summary-select select:hover { border-color: rgba(31,76,59,.42); background: rgba(255,255,255,.88); }
.memory-summary-select select:focus-visible { border-color: var(--coral); background: var(--cream); box-shadow: 0 0 0 4px rgba(231,111,81,.1), 0 12px 26px rgba(23,37,31,.08); }
.memory-summary-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.memory-summary-stats article { padding: 13px; border: 1px solid var(--line); border-radius: 8px 17px 8px 8px; background: rgba(255,255,255,.45); }
.memory-summary-stats small,.memory-summary-stats strong { display: block; }
.memory-summary-stats small { color: var(--muted); font-size: .58rem; }
.memory-summary-stats strong { margin-top: 5px; color: var(--forest); font-family: var(--serif); font-size: 1.02rem; font-weight: 600; }
.memory-summary-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 9px 24px 9px 9px; background: rgba(255,255,255,.4); }
.memory-summary-preview > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.memory-summary-header-actions { display: flex; align-items: center; gap: 8px; }
.memory-summary-header-actions .quiet-button { padding: 9px 12px; border: 0; background: transparent; color: var(--forest-2); font: inherit; font-size: .64rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.memory-summary-header-actions .memory-clear-button { color: var(--coral-dark); text-decoration-color: rgba(185,75,53,.42); }
.memory-summary-header-actions button:disabled { opacity: .42; cursor: not-allowed; }
.memory-summary-preview > header small,.memory-summary-preview > header strong { display: block; }
.memory-summary-preview > header small { color: var(--muted); font-size: .58rem; text-transform: uppercase; letter-spacing: .12em; }
.memory-summary-preview > header strong { margin-top: 4px; color: var(--forest); font-size: .72rem; }
#memorySummaryContent { display: grid; gap: 18px; max-height: 480px; padding: 18px; overflow-y: auto; scrollbar-gutter: stable; }
#memorySummaryContent section { padding: 2px 4px 2px 14px; border-left: 2px solid rgba(231,111,81,.56); }
#memorySummaryContent h4 { margin: 0 0 8px; color: var(--forest); font-size: .72rem; letter-spacing: .02em; }
#memorySummaryContent p,#memorySummaryContent ul { margin: 0; color: var(--forest-3); font-size: .69rem; line-height: 1.78; }
#memorySummaryContent ul { display: grid; gap: 6px; padding-left: 19px; }
#memorySummaryContent li::marker { color: var(--coral); }
.memory-longterm-section { padding: 0 !important; border-left: 0 !important; }
.memory-longterm-section h4 { padding-left: 14px; border-left: 2px solid rgba(231,111,81,.56); }
#memorySummaryContent .memory-event-cards { gap: 10px; padding: 0; list-style: none; }
.memory-event-cards li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; min-height: 58px; padding: 13px 13px 13px 16px; border: 1px solid rgba(31,76,59,.15); border-radius: 8px 18px 8px 8px; background: linear-gradient(135deg,rgba(255,255,255,.76),rgba(238,247,238,.48)); box-shadow: 0 7px 18px rgba(23,37,31,.045); }
.memory-event-cards li > span { min-width: 0; overflow-wrap: anywhere; color: var(--forest-3); font-size: .69rem; line-height: 1.68; }
.memory-event-delete { min-width: 54px; min-height: 34px; border: 1px solid rgba(185,75,53,.24); border-radius: 7px 14px 7px 7px; background: rgba(255,252,242,.82); color: var(--coral-dark); font: inherit; font-size: .6rem; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.memory-event-delete:hover { border-color: var(--coral-dark); background: rgba(231,111,81,.1); transform: translateY(-1px); }
.memory-event-delete:focus-visible { outline: 3px solid rgba(231,111,81,.18); outline-offset: 2px; }
.memory-event-delete:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.memory-summary-empty { color: var(--muted) !important; }
.memory-editor-panel { padding-bottom: 0; }
.memory-editor-intro { padding: 2px 2px 14px; border-bottom: 1px solid var(--line); }
.memory-editor-intro h3 { margin: 5px 0 7px; color: var(--forest); font-family: var(--serif); font-size: 1.35rem; font-weight: 500; }
.memory-editor-intro p:last-child { margin: 0; max-width: 680px; color: var(--muted); font-size: .68rem; line-height: 1.7; }
.memory-editor-fields { display: grid; gap: 14px; padding: 18px 0 96px; }
.memory-editor-field { display: grid; gap: 7px; padding: 16px; border: 1px solid var(--line); border-radius: 10px 22px 10px 10px; background: rgba(255,255,255,.42); }
.memory-editor-field > span { color: var(--forest); font-family: var(--serif); font-size: .88rem; }
.memory-editor-field > small { color: var(--muted); font-size: .6rem; line-height: 1.55; }
.memory-editor-field textarea { box-sizing: border-box; width: 100%; min-height: 118px; resize: vertical; border: 0; border-top: 1px solid rgba(31,76,59,.1); padding: 12px 0 0; outline: none; background: transparent; color: var(--forest-3); font: inherit; font-size: .72rem; line-height: 1.75; }
.memory-editor-field:nth-child(2) textarea { min-height: 170px; }
.memory-editor-field-longterm textarea { min-height: 260px; }
.memory-editor-actions { position: sticky; z-index: 3; bottom: 0; margin: 0 -2px; padding: 14px 2px 16px; background: linear-gradient(180deg,rgba(250,247,239,0),var(--paper) 28%); }
.advanced-fields .field + .field { margin-top: 17px; }
.avatar-picker { display: grid; grid-template-columns: 94px 1fr; gap: 18px; align-items: center; padding: 14px; border: 1px dashed rgba(24,33,27,.25); border-radius: 9px 28px 9px 9px; cursor: pointer; }
.avatar-picker input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-picker > span:last-child { display: flex; flex-direction: column; gap: 6px; }
.avatar-picker strong { font-size: .8rem; }
.avatar-picker small { color: var(--muted); font-size: .66rem; }
.avatar-preview { display: grid; place-items: center; width: 94px; height: 116px; overflow: hidden; border-radius: 6px 30px 6px 6px; background: var(--forest); color: var(--lime); font-family: var(--serif); font-size: 2.2rem; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.visibility-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 0; border: 0; }
.visibility-picker legend { grid-column: 1/-1; margin-bottom: 7px; font-size: .76rem; font-weight: 700; }
.visibility-picker label { position: relative; }
.visibility-picker input { position: absolute; opacity: 0; }
.visibility-picker label > span { display: flex; min-height: 82px; flex-direction: column; justify-content: center; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 8px 24px 8px 8px; cursor: pointer; }
.visibility-picker label > span b { font-size: .75rem; }
.visibility-picker label > span small { color: var(--muted); font-size: .62rem; line-height: 1.4; }
.visibility-picker input:checked + span { border-color: var(--forest); background: rgba(220,230,110,.13); box-shadow: inset 0 0 0 1px var(--forest); }
.visibility-picker.compact label > span { min-height: 58px; }
.interaction-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px 20px; padding: 18px 20px; border: 1px solid rgba(69,101,76,.28); border-radius: 10px 30px 10px 10px; background: linear-gradient(135deg, rgba(220,230,110,.16), rgba(255,255,255,.52)); }
.interaction-setting > div > span { color: var(--coral-dark); font-size: .57rem; font-weight: 700; letter-spacing: .13em; }
.interaction-setting h4 { margin: 4px 0 0; font-family: var(--serif); font-size: 1.22rem; font-weight: 500; }
.interaction-setting p, .interaction-setting > small { grid-column: 1/-1; margin: 0; line-height: 1.55; }
.interaction-setting p { color: var(--ink); font-size: .7rem; }
.interaction-setting > small { color: var(--muted); font-size: .61rem; }
.interaction-setting.compact { margin: 16px 0; }
.interaction-switch { display: inline-flex; align-items: center; gap: 9px; align-self: center; cursor: pointer; }
.interaction-switch input { position: absolute; opacity: 0; pointer-events: none; }
.interaction-switch > span { position: relative; width: 42px; height: 23px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: rgba(23,37,31,.12); transition: background .2s ease, border-color .2s ease; }
.interaction-switch > span::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--paper); box-shadow: 0 2px 6px rgba(23,37,31,.2); content: ''; transition: transform .2s ease; }
.interaction-switch input:checked + span { border-color: var(--forest); background: var(--forest); }
.interaction-switch input:checked + span::after { transform: translateX(19px); }
.interaction-switch input:focus-visible + span { outline: 3px solid rgba(194,99,73,.25); outline-offset: 3px; }
.interaction-switch strong { font-size: .69rem; white-space: nowrap; }
.detail-badges .interaction-badge { border-color: rgba(69,101,76,.35); background: rgba(220,230,110,.18); color: var(--forest-3); }
.character-worldbook-selector { margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 8px 24px 8px 8px; background: rgba(255,255,255,.2); }
.character-worldbook-selector > legend { padding: 0 4px; font-size: .76rem; font-weight: 700; }
.character-worldbook-selector > p { margin: 0 0 12px; color: var(--muted); font-size: .65rem; line-height: 1.55; }
.character-worldbook-options { display: flex; flex-direction: column; gap: 8px; }
.character-worldbook-options > span { color: var(--muted); font-size: .65rem; line-height: 1.5; }
.character-worldbook-options label { position: relative; }
.character-worldbook-options input { position: absolute; opacity: 0; }
.character-worldbook-options label > span { display: flex; min-height: 58px; flex-direction: column; justify-content: center; gap: 3px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 6px 17px 6px 6px; cursor: pointer; }
.character-worldbook-options label strong { font-size: .7rem; }
.character-worldbook-options label small { color: var(--muted); font-size: .58rem; }
.character-worldbook-options input:checked + span { border-color: var(--forest); background: rgba(220,230,110,.13); box-shadow: inset 0 0 0 1px var(--forest); }
.character-worldbook-options input:focus-visible + span { outline: 3px solid rgba(231,111,81,.25); outline-offset: 2px; }
.character-worldbook-warning { margin: 11px 0 0 !important; color: var(--coral-dark) !important; }
.creator-error { margin: 14px 0 0; }
.creator-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.creator-footer .primary-button { justify-self: end; }
.creator-footer .text-button { justify-self: start; }
.drop-zone { display: grid; place-items: center; min-height: 220px; margin: 22px 0; padding: 25px; border: 1px dashed rgba(24,33,27,.3); border-radius: 10px 38px 10px 10px; background: rgba(255,255,255,.24); text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone > span { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 13px; border-radius: 50%; background: var(--forest); color: var(--lime); font-size: 1.5rem; }
.drop-zone strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.drop-zone small { margin-top: 7px; color: var(--muted); font-size: .68rem; }

.chat-screen { position: fixed; top: var(--chat-viewport-offset-top, 0); right: 0; bottom: auto; left: 0; z-index: 80; display: grid; isolation: isolate; width: 100%; height: var(--chat-viewport-height, 100dvh); grid-template-rows: 72px minmax(0,1fr) auto; overflow: hidden; background: radial-gradient(circle at 10% 10%, rgba(231,111,81,.07), transparent 24rem), radial-gradient(circle at 90% 75%, rgba(127,157,82,.08), transparent 28rem), #e9e2d5; }
.chat-screen { --chat-whale-width: clamp(760px, 66vw, 1120px); }
.chat-mascot, .chat-mascot-fin { position: absolute; grid-row: 3; grid-column: 1; top: 0; left: 50%; width: var(--chat-whale-width); aspect-ratio: 2.55; pointer-events: none; user-select: none; transform: translate(-50%, -100%) scaleX(-1); }
.chat-mascot { z-index: 0; overflow: hidden; }
.chat-mascot-fin { z-index: 0; }
.chat-mascot img, .chat-mascot-fin img { position: absolute; top: 0; left: 0; display: block; width: 100%; max-width: none; }
.chat-header { grid-row: 1; grid-column: 1; }
.message-stage { grid-row: 2; grid-column: 1; }
.composer-wrap { grid-row: 3; grid-column: 1; }
body.chat-open .modal-layer { z-index: 90; }
.chat-transition { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; overflow: hidden; pointer-events: auto; isolation: isolate; }
.chat-transition::before { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 70% 28%, rgba(220,230,110,.12), transparent 24rem), linear-gradient(135deg, var(--forest-2), var(--forest)); content: ""; transform: translateX(-101%); }
.chat-transition::after { position: absolute; top: 0; bottom: 0; left: 0; width: 5px; background: var(--coral); content: ""; opacity: 0; }
.chat-transition.active::before { animation: ui-chat-curtain 520ms cubic-bezier(.76,0,.24,1) both; }
.chat-transition.active::after { animation: ui-chat-curtain-edge 520ms cubic-bezier(.76,0,.24,1) both; }
.chat-transition.reverse::before { transform: translateX(101%); }
.chat-transition.reverse::after { right: 0; left: auto; }
.chat-transition.reverse.active::before { animation-name: ui-chat-curtain-reverse; }
.chat-transition.reverse.active::after { animation-name: ui-chat-curtain-edge-reverse; }
.chat-screen:not(.hidden) .chat-header { animation: ui-chat-header-in 300ms cubic-bezier(.22,1,.36,1) both; }
.chat-screen:not(.hidden) .composer-wrap { animation: ui-composer-in 320ms 35ms cubic-bezier(.22,1,.36,1) both; }
.chat-header { position: relative; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(16px,3vw,38px); border-bottom: 1px solid rgba(255,255,255,.12); background: linear-gradient(135deg, var(--forest-2), var(--forest)); color: var(--cream); box-shadow: 0 10px 28px rgba(13,24,18,.14); }
.chat-back { justify-self: start; border: 0; background: transparent; color: rgba(255,250,240,.72); cursor: pointer; }
.chat-back span { margin-left: 7px; }
.chat-character { display: flex; align-items: center; gap: 11px; }
.chat-character > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.chat-character strong { font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.chat-character small { display: flex; align-items: center; gap: 7px; color: rgba(255,250,240,.45); font-size: .58rem; }
.chat-character .status-dot { width: 6px; height: 6px; box-shadow: none; }
.chat-cache-status { flex: 0 0 auto; padding: 2px 7px; border: 1px solid rgba(255,250,240,.22); border-radius: 999px; color: rgba(255,250,240,.82); background: rgba(255,250,240,.08); white-space: nowrap; }
.cached-chat-offline .chat-cache-status { border-color: rgba(246,203,118,.45); color: #ffe0a0; background: rgba(91,58,24,.35); }
.cached-chat-readonly .message-stage { box-shadow: inset 0 3px 0 rgba(194,139,57,.18); }
.cached-chat-offline .composer { border-color: rgba(174,113,39,.35); }
.mini-avatar { display: grid; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: 50%; background: var(--forest-3); color: var(--lime); font-family: var(--serif); }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-header .icon-button { justify-self: end; }
.chat-menu-anchor { position: relative; justify-self: end; }
.chat-menu { position: absolute; top: calc(100% + 13px); right: 0; display: flex; width: min(330px,calc(100vw - 28px)); max-height: calc(var(--chat-viewport-height,100dvh) - 96px); flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 7px; border: 1px solid rgba(24,33,27,.12); border-radius: 22px; background: rgba(255,253,247,.96); color: var(--ink); box-shadow: 0 28px 72px rgba(8,18,12,.28); scrollbar-gutter: stable; backdrop-filter: blur(18px); }
.chat-menu::before { display: none; }
.chat-menu button { display: flex; min-height: 58px; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 13px; border: 0; border-radius: 13px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.chat-menu button:hover, .chat-menu button:focus-visible { outline: 0; background: rgba(220,230,110,.18); }
.chat-menu button:disabled { color: var(--muted); cursor: wait; opacity: .48; }
.chat-menu button > span { font-size: .74rem; font-weight: 700; }
.chat-menu button > small { color: var(--muted); font-size: .6rem; }

.settings-dialog { position: relative; z-index: 1; width: min(100%, 640px); max-height: calc(100dvh - 48px); overflow-y: auto; border: 1px solid rgba(255,255,255,.45); border-radius: 28px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.34); }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 27px 30px 22px; border-bottom: 1px solid var(--line); }
.settings-header .eyebrow { margin-bottom: 5px; color: var(--coral-dark); }
.settings-header h2 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.settings-header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }
.settings-header .modal-close { position: static; flex: 0 0 auto; }
.settings-panel { padding: 24px 30px 30px; }
.settings-panel > .field textarea { min-height: 220px; }
.persona-settings { display: flex; flex-direction: column; gap: 17px; }
.persona-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid rgba(47,94,75,.18); border-radius: 8px 22px 8px 8px; background: rgba(47,94,75,.07); }
.persona-settings-heading > div { min-width: 0; }
.persona-settings-heading p { margin: 3px 0 0; color: var(--forest); font-size: .68rem; line-height: 1.55; }
.persona-settings-heading .persona-settings-kicker { margin: 0; color: var(--coral-dark); font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.persona-clear-button { flex: 0 0 auto; padding: 2px 0; color: var(--coral-dark); font-size: .7rem; font-weight: 700; }
.persona-clear-button:hover, .persona-clear-button:focus-visible { color: var(--coral); outline: 0; text-decoration: underline; }
.persona-clear-button:disabled { color: var(--muted); cursor: wait; text-decoration: none; }
.persona-settings .field > small { margin-top: 6px; color: var(--muted); font-size: .61rem; line-height: 1.5; }
.persona-settings .field textarea { min-height: 168px; }
.persona-gender-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 0; padding: 0; border: 0; }
.persona-gender-picker legend { grid-column: 1/-1; margin-bottom: 1px; font-size: .77rem; font-weight: 700; }
.persona-gender-picker label { position: relative; }
.persona-gender-picker input { position: absolute; opacity: 0; }
.persona-gender-picker span { display: flex; min-height: 74px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px 17px 7px 7px; background: rgba(255,255,255,.25); color: var(--muted); cursor: pointer; transition: border-color 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.persona-gender-picker i { color: var(--coral-dark); font-family: Georgia, serif; font-size: 1.72rem; font-style: normal; font-weight: 400; line-height: 1; }
.persona-gender-picker strong { font-size: .68rem; font-weight: 700; }
.persona-gender-picker input:checked + span { border-color: var(--forest); background: rgba(220,230,110,.15); color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.persona-gender-picker input:checked + span i { color: var(--forest); }
.persona-gender-picker input:focus-visible + span { outline: 3px solid rgba(231,111,81,.25); outline-offset: 2px; }
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 13px; margin-top: 17px; padding-top: 18px; border-top: 1px solid var(--line); }
.model-picker { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0 0 24px; padding: 0; border: 0; }
.model-picker legend { grid-column: 1/-1; margin-bottom: 2px; font-size: .77rem; font-weight: 700; }
.model-picker label { position: relative; }
.model-picker input { position: absolute; opacity: 0; }
.model-picker label > span { display: flex; min-height: 92px; flex-direction: column; justify-content: center; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.34); cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.model-picker label strong { font-family: var(--serif); font-size: 1.08rem; font-weight: 500; }
.model-picker label small { color: var(--muted); font-size: .63rem; }
.model-picker input:checked + span { border-color: rgba(23,37,31,.5); background: rgba(220,230,110,.17); box-shadow: inset 0 0 0 1px var(--forest), 0 10px 24px rgba(23,37,31,.07); transform: translateY(-2px); }
.model-picker input:focus-visible + span { outline: 3px solid rgba(231,111,81,.25); outline-offset: 2px; }
.model-picker-empty { grid-column: 1/-1; margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.model-picker--grouped { grid-template-columns: minmax(0,1fr); gap: 22px; min-width: 0; }
.model-picker-group { --model-group-accent: var(--forest-3); display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; }
.model-picker-group[data-model-group="claude"] { --model-group-accent: var(--coral-dark); }
.model-picker-group[data-model-group="domestic"] { --model-group-accent: #51623d; }
.model-picker-group[data-model-group="grok"] { --model-group-accent: #4d5c68; }
.model-picker-group-heading { display: flex; grid-column: 1/-1; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin: 0; padding: 10px 0 10px 12px; border-left: 3px solid var(--model-group-accent); border-bottom: 1px solid var(--line); color: var(--model-group-accent); }
.model-picker-group-heading strong { font-size: .95rem; font-weight: 700; }
.model-picker-group-heading small { color: var(--muted); font-size: .64rem; font-weight: 400; }
.model-picker-group-count { margin-left: auto; padding: 3px 8px; border-radius: 999px; background: rgba(20,33,27,.05); color: var(--muted); font-size: .6rem; font-weight: 400; white-space: nowrap; }
.model-picker-group label { min-width: 0; }
.model-picker-group label > span { height: 100%; overflow-wrap: anywhere; }
.response-length-picker { grid-template-columns: repeat(3,minmax(0,1fr)); }
.response-length-picker label > span { min-height: 132px; }
.temperature-control { display: flex; flex-direction: column; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 8px 24px 8px 8px; background: rgba(255,255,255,.24); }
.temperature-control > span { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: .77rem; }
.temperature-control output { min-width: 48px; padding: 5px 9px; border-radius: 999px; background: var(--forest); color: var(--lime); text-align: center; }
.temperature-control input { width: 100%; accent-color: var(--coral); cursor: pointer; }
.temperature-control small { display: flex; justify-content: space-between; color: var(--muted); font-size: .61rem; }
.preset-switch { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 8px 20px 8px 8px; background: rgba(255,255,255,.24); cursor: pointer; }
.preset-switch > span { display: grid; gap: 5px; min-width: 0; }
.preset-switch strong { color: var(--ink); font-size: .76rem; }
.preset-switch small { color: var(--muted); font-size: .62rem; line-height: 1.5; }
.preset-switch input { position: absolute; opacity: 0; pointer-events: none; }
.preset-switch i { position: relative; width: 48px; height: 28px; border: 1px solid rgba(23,37,31,.28); border-radius: 999px; background: rgba(23,37,31,.12); box-shadow: inset 0 1px 4px rgba(23,37,31,.12); transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.preset-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fffdf7; box-shadow: 0 2px 7px rgba(23,37,31,.25); transition: transform .22s cubic-bezier(.2,.8,.2,1), background .2s ease; }
.preset-switch input:checked + i { border-color: var(--forest); background: var(--forest); box-shadow: 0 0 0 3px rgba(220,230,110,.18); }
.preset-switch input:checked + i::after { transform: translateX(20px); background: var(--lime); }
.preset-switch input:focus-visible + i { outline: 3px solid rgba(231,111,81,.28); outline-offset: 3px; }
.model-preset-note { display: flex; gap: 5px; margin: 16px 0 0; padding: 13px 15px; border: 1px solid rgba(47,94,75,.2); border-radius: 7px 20px 7px 7px; background: rgba(47,94,75,.08); color: var(--forest); flex-direction: column; }
.model-preset-note strong { font-size: .7rem; }
.model-preset-note span { font-size: .63rem; line-height: 1.5; }
.model-demo-note { display: flex; gap: 5px; margin: 16px 0 0; padding: 13px 15px; border: 1px solid rgba(185,75,53,.2); border-radius: 7px 20px 7px 7px; background: rgba(231,111,81,.08); color: var(--coral-dark); flex-direction: column; }
.model-demo-note strong { font-size: .7rem; }
.model-demo-note span { font-size: .63rem; line-height: 1.5; }
.worldbook-dialog { position: relative; z-index: 1; width: min(100%, 780px); max-height: calc(100dvh - 48px); overflow-y: auto; border-radius: 12px 52px 12px 12px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.34); }
.worldbook-editor { display: flex; flex-direction: column; gap: 17px; padding: 24px 30px 30px; }
.worldbook-editor-tools { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-top: 3px; }
.worldbook-editor-tools > div { display: flex; flex-direction: column; gap: 4px; }
.worldbook-editor-tools strong { font-size: .77rem; }
.worldbook-editor-tools small { color: var(--muted); font-size: .63rem; line-height: 1.45; }
.worldbook-editor-tools .text-button { flex: 0 0 auto; color: var(--coral-dark); font-size: .68rem; font-weight: 700; }
.worldbook-editor-tools .text-button:disabled { color: var(--muted); cursor: not-allowed; }
.character-worldbook-import { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px dashed rgba(47,94,75,.28); border-radius: 8px 24px 8px 8px; background: rgba(255,255,255,.22); }
.character-worldbook-import > span { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: var(--muted); font-size: .62rem; line-height: 1.45; }
.character-worldbook-import strong { color: var(--ink); font-size: .72rem; }
.worldbook-entry-list { display: flex; flex-direction: column; gap: 14px; }
.worldbook-entry { display: flex; flex-direction: column; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: 9px 30px 9px 9px; background: rgba(255,255,255,.22); }
.worldbook-entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.worldbook-entry-heading strong { font-family: var(--serif); font-size: 1.08rem; font-weight: 500; }
.worldbook-entry-remove { padding: 3px 0; color: var(--coral-dark); font-size: .66rem; }
.worldbook-entry-remove:hover, .worldbook-entry-remove:focus-visible { color: var(--coral); outline: 0; text-decoration: underline; }
.worldbook-entry .field { gap: 6px; }
.worldbook-entry .field > span { font-size: .68rem; }
.worldbook-entry .field input { height: 44px; }
.worldbook-entry .field textarea { min-height: 132px; }
.worldbook-entry-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.worldbook-toggle { position: relative; }
.worldbook-toggle input { position: absolute; opacity: 0; }
.worldbook-toggle span { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .62rem; cursor: pointer; }
.worldbook-toggle input:checked + span { border-color: var(--forest); background: rgba(220,230,110,.15); color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.worldbook-toggle input:focus-visible + span { outline: 3px solid rgba(231,111,81,.25); outline-offset: 2px; }
.worldbook-entry-empty { display: grid; place-items: center; gap: 8px; min-height: 114px; padding: 17px; border: 1px dashed rgba(47,94,75,.26); border-radius: 8px 24px 8px 8px; color: var(--muted); text-align: center; }
.worldbook-entry-empty span { color: var(--coral-dark); font-family: var(--serif); font-size: 1.6rem; }
.worldbook-entry-empty p { margin: 0; font-size: .68rem; }
.worldbook-editor-actions { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 13px; margin-top: 2px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-text-button { color: var(--coral-dark); font-size: .69rem; }
.danger-text-button:hover, .danger-text-button:focus-visible { color: var(--coral); outline: 0; text-decoration: underline; }
.archive-dialog, .message-editor-dialog { position: relative; z-index: 1; width: min(100%, 680px); max-height: calc(100dvh - 48px); overflow-y: auto; border-radius: 12px 52px 12px 12px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.34); }
.archive-panel { padding: 24px 30px 30px; }
.archive-create-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: end; }
.archive-create-form .primary-button { min-height: 45px; box-shadow: 4px 4px 0 var(--coral); }
.archive-create-form .primary-button:hover { box-shadow: 6px 6px 0 var(--coral); }
.archive-safety { margin: 18px 0 0; padding: 12px 14px; border: 1px solid rgba(185,75,53,.18); border-radius: 7px 20px 7px 7px; background: rgba(231,111,81,.07); color: var(--coral-dark); font-size: .67rem; line-height: 1.55; }
.archive-panel > .form-error { min-height: 19px; margin: 9px 0 0; }
.archive-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 18px 0 9px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .74rem; font-weight: 700; }
.archive-list-heading small { color: var(--muted); font-size: .62rem; font-weight: 400; }
.archive-list { display: flex; flex-direction: column; gap: 10px; }
.archive-loading { margin: 0; padding: 20px; border: 1px dashed var(--line); border-radius: 8px 22px 8px 8px; color: var(--muted); font-size: .7rem; text-align: center; }
.archive-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 15px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px 28px 8px 8px; background: rgba(255,255,255,.26); }
.archive-item-copy { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.archive-item-copy strong { overflow: hidden; font-family: var(--serif); font-size: 1.08rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.archive-item-copy small { color: var(--muted); font-size: .62rem; }
.archive-item-actions { display: flex; align-items: center; gap: 7px; }
.archive-item-actions .secondary-button { min-height: 34px; padding: 0 12px; font-size: .66rem; cursor: pointer; }
.archive-delete { min-height: 34px; padding: 0 5px; border: 0; background: transparent; color: var(--coral-dark); font-size: .62rem; cursor: pointer; }
.archive-delete:hover, .archive-delete:focus-visible { outline: 0; color: var(--coral); text-decoration: underline; }
.archive-delete:disabled, .archive-item-actions button:disabled { cursor: wait; opacity: .48; }
.archive-empty { display: grid; place-items: center; min-height: 160px; padding: 22px; border: 1px dashed var(--line); border-radius: 8px 28px 8px 8px; color: var(--muted); text-align: center; }
.archive-empty > span { color: var(--coral-dark); font-family: var(--serif); font-size: 1.5rem; }
.archive-empty strong { margin-top: 7px; color: var(--ink); font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.archive-empty p { margin: 6px 0 0; font-size: .66rem; }
.confirmation-dialog { position: relative; z-index: 1; width: min(100%, 460px); padding: 32px; border-radius: 12px 44px 12px 12px; background: var(--paper); box-shadow: 0 35px 100px rgba(0,0,0,.38); }
.confirmation-dialog .modal-close { position: absolute; }
.confirmation-content { padding-right: 42px; }
.confirmation-content .eyebrow { margin: 0 0 7px; color: var(--coral-dark); }
.confirmation-content h2 { margin: 0; font-family: var(--serif); font-size: 1.95rem; font-weight: 500; line-height: 1.08; }
.confirmation-content p:last-child { margin: 13px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.65; }
.confirmation-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-button { border-color: var(--coral-dark); background: var(--coral-dark); box-shadow: 5px 5px 0 rgba(185,75,53,.22); }
.danger-button:hover { box-shadow: 7px 7px 0 rgba(185,75,53,.25); }
#confirmationModal { z-index: 110; }
.message-stage { position: relative; z-index: 1; overflow-y: auto; padding: 38px 20px 25px; background-image: linear-gradient(rgba(23,37,31,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(23,37,31,.025) 1px, transparent 1px); background-size: 42px 42px; }
.message-stage.message-actions-open { z-index: 6; }
.chat-history-status { position: sticky; z-index: 4; top: 10px; width: max-content; max-width: calc(100% - 24px); margin: -24px auto 2px; padding: 8px 13px; border: 1px solid rgba(42,75,57,.16); border-radius: 999px; background: rgba(255,253,247,.94); color: var(--forest); box-shadow: 0 7px 20px rgba(24,49,37,.1); font-size: .65rem; letter-spacing: .04em; backdrop-filter: blur(10px); transform: translateY(24px); }
.chat-history-status span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border: 2px solid rgba(42,75,57,.22); border-top-color: var(--coral-dark); border-radius: 50%; animation: history-spin .75s linear infinite; }
@keyframes history-spin { to { transform: rotate(360deg); } }
.message-column { width: min(100%, 840px); margin: 0 auto; }
.message { display: flex; max-width: 78%; flex-direction: column; gap: 6px; margin-bottom: 25px; }
.message.user { align-items: flex-end; margin-left: auto; }
.message-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 27px; }
.message.user .message-meta { flex-direction: row-reverse; }
.message-label { padding: 0 6px; color: var(--muted); font-size: .6rem; }
.message-menu-anchor { position: relative; flex: 0 0 auto; }
.message-action-trigger { display: grid; place-items: center; width: 31px; height: 27px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; letter-spacing: .05em; line-height: 1; cursor: pointer; }
.message-action-trigger:hover, .message-action-trigger:focus-visible, .message-menu-anchor:focus-within .message-action-trigger { outline: 0; background: rgba(24,33,27,.08); color: var(--coral-dark); }
.message-action-trigger:disabled { cursor: wait; opacity: .42; }
.message-menu { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; display: flex; min-width: 155px; overflow: hidden; border: 1px solid rgba(24,33,27,.13); border-radius: 7px 18px 7px 7px; background: var(--cream); box-shadow: 0 16px 34px rgba(10,21,14,.2); }
.message.user .message-menu { right: auto; left: 0; }
.message .message-menu.message-menu-floating { position: fixed; z-index: 90; inset: auto; display: inline-flex; width: 210px; min-width: 210px; max-width: calc(100vw - 24px); height: 44px; min-height: 44px; max-height: 44px; flex: none; align-items: stretch; overflow: hidden; padding: 0; border-radius: 10px 18px 10px 10px; background: rgba(23,37,31,.98); box-shadow: 0 18px 46px rgba(7,15,11,.34); backdrop-filter: none; contain: layout paint; }
.message .message-menu.message-menu-floating button { width: 70px; min-width: 0; height: 44px; min-height: 44px; flex: 0 0 70px; color: var(--cream); font-size: .72rem; }
.message .message-menu.message-menu-floating .message-menu-delete { color: #ffb39f; }
.message .message-menu.message-menu-floating button:hover, .message .message-menu.message-menu-floating button:focus-visible { background: rgba(255,255,255,.1); }
.message-menu button { flex: 1 1 0; min-height: 36px; padding: 0 10px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink); font-size: .63rem; cursor: pointer; }
.message-menu button:last-child { border-right: 0; }
.message-menu button:hover, .message-menu button:focus-visible { outline: 0; background: rgba(220,230,110,.2); }
.message-menu button:disabled { cursor: not-allowed; opacity: .42; }
.message-menu .message-menu-delete { color: var(--coral-dark); }
.message-bubble { padding: 17px 19px; border: 1px solid rgba(24,33,27,.09); border-radius: 8px 24px 24px 24px; background: rgba(255,253,247,.92); box-shadow: 0 12px 28px rgba(23,37,31,.07); font-family: var(--sans); font-size: .98rem; line-height: 1.36; touch-action: pan-y; user-select: text; -webkit-user-select: text; white-space: pre-wrap; word-break: break-word; backdrop-filter: blur(9px); -webkit-touch-callout: default; }
.message.user .message-bubble { border-radius: 24px 8px 24px 24px; background: linear-gradient(135deg, var(--forest-2), var(--forest)); color: var(--cream); font-family: var(--sans); font-size: .9rem; line-height: 1.36; }
.message.stream-error .message-bubble { max-width: min(760px,88%); padding: 12px 15px; border: 1px solid rgba(190,78,58,.24); border-radius: 8px 18px 18px 18px; background: rgba(255,245,238,.86); color: #984a39; font-size: .72rem; line-height: 1.55; }
.message.stream-draft-error .message-bubble { border-color: rgba(190,78,58,.24); box-shadow: 0 12px 28px rgba(190,78,58,.08); }
.message.stream-draft-error .message-meta { flex-wrap: wrap; justify-content: flex-start; padding: 0 6px; }
.stream-draft-status { flex: 1 1 240px; color: #984a39; font-size: .62rem; line-height: 1.45; }
.stream-draft-copy { min-height: 28px; padding: 0 10px; border: 1px solid rgba(190,78,58,.25); border-radius: 999px; background: rgba(255,245,238,.86); color: #984a39; font: inherit; font-size: .61rem; cursor: pointer; }
.stream-draft-copy:hover, .stream-draft-copy:focus-visible { outline: 0; border-color: var(--coral-dark); background: #fff8f3; }
.dialogue-quote { color: var(--dialogue-warm); font-weight: 700; }
.rich-message { white-space: normal; }
.rich-message > :first-child { margin-top: 0; }
.rich-message > :last-child { margin-bottom: 0; }
.rich-paragraph { margin: .48em 0; }
.rich-heading { margin: .9em 0 .38em; color: var(--forest); font-family: var(--serif); font-weight: 650; line-height: 1.22; letter-spacing: -.015em; }
.rich-message h3.rich-heading { font-size: 1.27em; }
.rich-message h4.rich-heading { font-size: 1.16em; }
.rich-message h5.rich-heading, .rich-message h6.rich-heading { font-size: 1.06em; }
.rich-message hr { height: 1px; margin: .8em 0; border: 0; background: linear-gradient(90deg, rgba(23,37,31,.5), rgba(23,37,31,.13)); }
.rich-message blockquote { margin: .6em 0; padding: .56em .75em .58em .82em; border-left: 4px solid var(--sage); border-radius: 0 10px 10px 0; background: linear-gradient(90deg, rgba(220,230,110,.17), rgba(255,255,255,.14)); color: #34463d; }
.rich-message blockquote > :first-child { margin-top: 0; }
.rich-message blockquote > :last-child { margin-bottom: 0; }
.rich-message ol, .rich-message ul { margin: .58em 0; padding-left: 1.65em; }
.rich-message li { padding-left: .18em; }
.rich-message li + li { margin-top: .34em; }
.rich-message li::marker { color: var(--coral-dark); font-weight: 750; }
.rich-message strong { color: #24372e; font-weight: 780; }
.rich-message em { color: #4f6258; }
.rich-message del { color: var(--muted); text-decoration-thickness: 1px; }
.rich-message code { padding: .1em .34em; border: 1px solid rgba(23,37,31,.1); border-radius: 5px; background: rgba(23,37,31,.075); color: #8d432f; font-family: Consolas, "Cascadia Code", monospace; font-size: .86em; }
.rich-message pre { max-width: 100%; margin: .72em 0; overflow-x: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 8px 15px 8px 8px; background: #1d2b25; color: #f3eedf; box-shadow: inset 4px 0 0 var(--coral); }
.rich-message pre code { display: block; min-width: max-content; padding: .8em .95em; border: 0; background: transparent; color: inherit; font-size: .8em; line-height: 1.5; white-space: pre; }
.thinking-block { display: block; margin: .75rem 0; border: 1px solid rgba(165,102,11,.28); border-radius: 8px 18px 8px 8px; background: rgba(235,190,95,.11); color: var(--muted); font-family: var(--sans); font-size: .82rem; line-height: 1.65; white-space: normal; }
.thinking-summary { display: flex; align-items: center; min-height: 38px; padding: 8px 12px; color: #765215; cursor: pointer; font-weight: 700; list-style: none; user-select: none; }
.thinking-summary::-webkit-details-marker { display: none; }
.thinking-summary::marker { content: ""; }
.thinking-summary::before { display: grid; place-items: center; width: 17px; height: 17px; margin-right: 8px; border-radius: 50%; background: rgba(165,102,11,.14); color: var(--dialogue-warm); content: "+"; font-size: .95rem; line-height: 1; }
.thinking-block[open] .thinking-summary { border-bottom: 1px solid rgba(165,102,11,.2); }
.thinking-block[open] .thinking-summary::before { content: "−"; }
.thinking-summary:focus-visible { outline: 2px solid rgba(231,111,81,.65); outline-offset: -3px; }
.thinking-content { padding: 11px 12px 13px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.thinking-pending { border-style: dashed; }
.thinking-status { cursor: default; }
.thinking-status::before { content: "..."; font-size: .55rem; letter-spacing: -.08em; }
.typing-dots { display: flex; gap: 5px; padding: 5px 3px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); opacity: .38; animation: typing 1.65s infinite ease-in-out both; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%,65%,100% { opacity: .38; } 32% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: .58; } }
.composer-wrap { position: relative; z-index: 4; padding: 13px 20px calc(13px + env(safe-area-inset-bottom)); background: rgba(243,237,223,.94); backdrop-filter: blur(14px); }
.memory-summary-chat-status { box-sizing: border-box; width: min(100%,840px); margin: 0 auto 10px; display: flex; align-items: center; gap: 11px; padding: 10px 14px; border: 1px solid rgba(151,126,55,.25); border-radius: 8px 18px 8px 8px; background: linear-gradient(135deg,rgba(248,242,205,.92),rgba(238,247,238,.9)); color: var(--forest); box-shadow: 0 9px 24px rgba(23,37,31,.07); }
.memory-summary-chat-status.hidden { display: none; }
.memory-summary-chat-status > span { flex: 0 0 auto; width: 10px; height: 10px; border: 2px solid rgba(23,37,31,.22); border-top-color: var(--coral); border-radius: 50%; animation: memory-summary-spin 850ms linear infinite; }
.memory-summary-chat-status strong, .memory-summary-chat-status small { display: block; }
.memory-summary-chat-status strong { font-family: var(--serif); font-size: .72rem; }
.memory-summary-chat-status small { margin-top: 2px; color: var(--muted); font-size: .57rem; }
.regenerate-wrap { display: flex; justify-content: center; width: min(100%,840px); margin: -3px auto 9px; }
.regenerate-button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 14px; border: 1px solid rgba(23,37,31,.16); border-radius: 999px; background: rgba(255,253,247,.78); color: var(--forest); box-shadow: 0 6px 18px rgba(23,37,31,.07); font-size: .67rem; font-weight: 700; cursor: pointer; backdrop-filter: blur(10px); }
.regenerate-button b { color: var(--coral-dark); font-size: 1rem; font-weight: 500; transition: transform 180ms ease; }
.regenerate-button:hover, .regenerate-button:focus-visible { outline: 0; border-color: rgba(231,111,81,.55); background: var(--cream); box-shadow: 0 8px 22px rgba(23,37,31,.11); }
.regenerate-button:hover b { transform: rotate(-35deg); }
.regenerate-button:disabled { cursor: wait; opacity: .48; }
.composer { position: relative; display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 10px; align-items: end; width: min(100%, 840px); margin: 0 auto; padding: 7px 7px 7px 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,247,.9); box-shadow: 0 14px 34px rgba(23,37,31,.09); backdrop-filter: blur(16px); }
.composer textarea { min-height: 28px; max-height: min(160px,30dvh); overflow-y: hidden; padding: 8px 0; border: 0; outline: 0; background: transparent; color: var(--ink); line-height: 1.45; resize: none; }
.composer button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--coral); color: white; font-size: 1.2rem; cursor: pointer; }
.composer button:disabled { opacity: .45; }
.composer .stop-generation { background: var(--forest); }
.stop-generation span { width: 13px; height: 13px; border-radius: 3px; background: currentColor; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.composer .stop-generation:disabled { cursor: wait; }
.composer-wrap > p { margin: 7px auto 0; width: min(100%,840px); color: var(--muted); font-size: .57rem; text-align: center; }
.composer-wrap > :is(.composer, .regenerate-wrap, .memory-summary-chat-status, p) { position: relative; z-index: 1; }

.toast-stack { position: fixed; z-index: 120; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { max-width: min(360px,calc(100vw - 40px)); padding: 13px 16px; border-left: 4px solid var(--lime); border-radius: 6px 18px 6px 6px; background: var(--forest); color: var(--cream); box-shadow: var(--shadow); font-size: .74rem; opacity: 0; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.error { border-left-color: var(--coral); }
.toast.visible { opacity: 1; transform: none; }

@keyframes ui-rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ui-row-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes ui-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-dialog-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ui-chat-header-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes ui-composer-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes memory-summary-spin { to { transform: rotate(360deg); } }
@keyframes ui-chat-curtain { 0% { transform: translateX(-101%); } 40%,60% { transform: translateX(0); } 100% { transform: translateX(101%); } }
@keyframes ui-chat-curtain-edge { 0% { left: 0; opacity: 0; } 8% { opacity: 1; } 40%,60% { left: calc(100% - 5px); opacity: 1; } 92% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes ui-chat-curtain-reverse { 0% { transform: translateX(101%); } 40%,60% { transform: translateX(0); } 100% { transform: translateX(-101%); } }
@keyframes ui-chat-curtain-edge-reverse { 0% { right: 0; opacity: 0; } 8% { opacity: 1; } 40%,60% { right: calc(100% - 5px); opacity: 1; } 92% { opacity: 1; } 100% { right: 100%; opacity: 0; } }
@keyframes hydration-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .username-migration-layer { align-items: end; padding: 0; }
  .username-migration-dialog { width: 100%; max-height: 92dvh; padding: 28px 20px calc(24px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 28px 28px 0 0; box-shadow: 0 -24px 70px rgba(7,15,11,.42); }
  .username-migration-dialog h2 { font-size: 2.2rem; }
  .username-migration-identity { grid-template-columns: 1fr; }
}

@media (max-width: 1350px) {
  .usage-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .usage-board-head, .usage-row { grid-template-columns: minmax(190px,1.7fr) minmax(100px,.9fr) minmax(70px,.6fr) minmax(90px,.8fr); }
}

@media (max-width: 1150px) {
  .character-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .worldbook-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .welcome-strip { grid-template-columns: 1fr; }
  .three-steps li { min-height: 90px; }
}

@media (max-width: 900px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-story { min-height: 450px; padding: 30px; }
  .auth-headline { margin: 58px 0 34px; }
  .auth-headline h1 { font-size: clamp(3.15rem,9vw,5.5rem); }
  .auth-orbit { right: -9%; bottom: -48%; width: 65vw; opacity: .48; }
  .auth-manifesto { display: none; }
  .auth-panel { min-height: 560px; padding: 52px 24px 64px; }
  .auth-panel::before { inset: 20px; }
  .product-shell { display: block; }
  .sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(244,239,229,.9); box-shadow: 0 8px 24px rgba(23,37,31,.05); backdrop-filter: blur(18px); }
  .mobile-header .side-brand { color: var(--ink); }
  .mobile-header .brand-mark { width: 36px; height: 36px; font-size: 1rem; }
  .mobile-header .account-avatar { border-color: var(--line); }
  .workspace { padding: 0 22px 116px; }
  .bottom-nav { position: fixed; z-index: 30; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); align-items: end; min-height: 72px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(23,37,31,.95); color: rgba(255,250,240,.55); box-shadow: 0 20px 50px rgba(9,18,13,.3); backdrop-filter: blur(18px); }
  .bottom-link { min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 1px; border: 0; border-radius: 14px; background: transparent; color: inherit; }
  .bottom-link span { font-size: 1.18rem; line-height: 1; }
  .bottom-link small { font-size: .62rem; font-weight: 700; line-height: 1; }
  .bottom-link.active { color: var(--lime); }
  .bottom-chat-main { align-self: center; justify-self: center; width: 66px; height: 66px; min-height: 66px; margin-top: -30px; border: 5px solid var(--paper); border-radius: 21px; background: linear-gradient(145deg, #ef8064, var(--coral)); color: white; box-shadow: 0 12px 28px rgba(231,111,81,.38); transform: rotate(2deg); }
  .bottom-chat-main span { font-size: 1.38rem; }
  .bottom-chat-main small { font-size: .6rem; }
  .bottom-chat-main.active { color: white; box-shadow: 0 12px 28px rgba(231,111,81,.44), 0 0 0 3px rgba(220,230,110,.2); }
  .workspace-header { min-height: 112px; padding-top: 28px; }
  .workspace-header h1 { font-size: clamp(2.3rem,8vw,3.6rem); }
  .welcome-figure-stage { height: 40vw; }
  .welcome-deer { bottom: -10.7vw; width: 64vw; }
  .welcome-strip { margin-top: 24px; }
  .profile-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-persona-card { grid-column: 1/-1; grid-template-columns: 1fr; gap: 17px; }
  .profile-persona-card button { justify-self: start; }
}

@media (max-width: 620px) {
  .memory-summary-stats { grid-template-columns: 1fr; }
  .memory-summary-preview > header { align-items: flex-start; }
  .memory-summary-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .memory-summary-header-actions .memory-clear-button { order: 3; width: 100%; text-align: right; }
  .memory-event-cards li { align-items: start; }
  #memorySummaryContent { max-height: 56vh; padding: 15px 13px; }
  .memory-editor-fields { padding-bottom: 88px; }
  .memory-editor-field { padding: 14px; border-radius: 9px 18px 9px 9px; }
  .memory-editor-field textarea { font-size: .76rem; }
  .grain { opacity: .03; }
  .auth-story { min-height: 350px; padding: 22px 22px 24px; }
  .brand-lockup .brand-mark { width: 39px; height: 39px; font-size: 1.1rem; }
  .auth-headline { margin: 38px 0 0; }
  .auth-headline .eyebrow { margin-bottom: 8px; font-size: .57rem; }
  .auth-headline h1 { font-size: clamp(2.55rem,11.5vw,3.4rem); line-height: 1.03; }
  .auth-headline > p:not(.eyebrow) { margin-top: 14px; font-size: .73rem; line-height: 1.68; }
  .auth-signals { margin-top: 18px; padding-top: 12px; }
  .auth-signals li { gap: 5px; font-size: .6rem; letter-spacing: .02em; }
  .auth-signals b { font-size: .62rem; }
  .auth-orbit { display: none; }
  .auth-panel { min-height: 0; place-items: start center; padding: 36px 16px 48px; }
  .auth-panel::before { display: none; }
  .auth-card { padding: 24px 19px; border-radius: 8px 28px 8px 8px; }
  .auth-tabs { margin-bottom: 30px; }
  .form-heading h2 { font-size: 2.1rem; }
  .auth-footnote { line-height: 1.6; }
  .password-input button { min-width: 58px; height: 38px; }
  .workspace { width: 100%; padding-left: 18px; padding-right: 18px; }
  .chat-row { gap: 7px; padding: 0 2px; }
  .chat-row-main { grid-template-columns: 48px minmax(0,1fr) 20px; gap: 10px; min-height: 82px; }
  .chat-row-avatar { width: 46px; height: 46px; font-size: 1.25rem; }
  .chat-row-delete { min-width: 48px; min-height: 36px; padding: 0 8px; }
  .workspace-header { min-width: 0; align-items: flex-start; flex-direction: column; gap: 13px; padding: 26px 0 22px; }
  .workspace-header .primary-button { width: 100%; }
  .bottom-nav { left: 10px; right: 10px; min-height: 70px; padding: 8px 4px; }
  .bottom-link { min-height: 50px; padding-right: 0; padding-left: 0; }
  .bottom-link span { font-size: 1.12rem; }
  .bottom-link small { font-size: .58rem; }
  .bottom-chat-main { width: 62px; height: 62px; min-height: 62px; margin-top: -27px; border-width: 4px; border-radius: 19px; }
  .credit-pagination { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 6px; }
  .credit-pagination button { min-width: 0; padding: 0 8px; }
  .credit-pagination span { min-width: 0; padding: 0 9px; white-space: nowrap; }
  .usage-section-heading, .credit-history-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .usage-section-heading > p, .credit-history-heading > p { text-align: left; }
  .player-profile-hero { min-height: 360px; margin-top: 24px; padding-right: 20px; padding-left: 20px; border-radius: 8px 30px 8px 8px; }
  .profile-actions { grid-template-columns: 1fr; width: min(100%,330px); }
  .profile-card-grid { grid-template-columns: 1fr; }
  .profile-persona-card { grid-column: auto; }
  .worldbooks-header .worldbook-header-actions { width: 100%; }
  .worldbooks-header .worldbook-header-actions .primary-button, .worldbooks-header .worldbook-header-actions .secondary-button { flex: 1 1 160px; }
  .provider-pill { margin: 0; }
  .welcome-scene { margin-top: 14px; }
  .welcome-figure-stage { height: 50vw; }
  .welcome-deer { bottom: -10.2vw; width: 76vw; }
  .welcome-strip { width: 100%; min-width: 0; gap: 16px; margin: 16px 0 32px; padding: 18px 16px; border-radius: 22px; }
  .welcome-copy h2 { max-width: 100%; font-size: clamp(1.7rem,8.8vw,2.05rem); line-height: 1.06; }
  .welcome-copy p { margin-top: 8px; font-size: .72rem; line-height: 1.55; }
  .service-notice { grid-template-columns: auto minmax(0,1fr); gap: 12px; margin: -18px 0 30px; padding: 15px 15px 16px; border-radius: 16px; }
  .service-notice-mark { width: 36px; height: 36px; border-radius: 12px; font-size: 1.2rem; }
  .service-notice-copy h2 { font-size: 1.25rem; }
  .service-notice-copy > p:last-child { font-size: .88rem; line-height: 1.68; }
  .service-notice-meme { grid-column: 1 / -1; width: min(100%, 132px); max-height: 132px; justify-self: center; border-radius: 10px; }
  .three-steps { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 0; }
  .three-steps li { display: flex; min-height: 66px; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 10px 9px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; }
  .three-steps b { font-size: .95rem; }
  .three-steps span { font-size: .66rem; line-height: 1.35; }
  .shelf-tools { min-width: 0; align-items: stretch; flex-direction: column; gap: 16px; }
  .search-box { width: 100%; }
  .studio-mine-button { display: grid; grid-template-columns: 38px minmax(0,1fr) 24px; gap: 12px; align-items: center; width: 100%; min-height: 64px; margin: 18px 0 0; padding: 11px 15px; border: 0; border-radius: 10px 24px 10px 10px; background: linear-gradient(130deg, var(--forest), var(--forest-2)); color: var(--cream); text-align: left; box-shadow: 0 10px 25px rgba(23,37,31,.14); cursor: pointer; }
  .studio-mine-button > span:first-child { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--coral); color: white; }
  .studio-mine-button > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
  .studio-mine-button strong { color: var(--lime); font-size: .83rem; }
  .studio-mine-button small { overflow: hidden; color: rgba(255,250,240,.56); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
  .studio-mine-button b { color: var(--lime); font-size: .9rem; font-weight: 500; }
  .character-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .character-card { border-radius: 14px; box-shadow: 0 8px 18px rgba(23,37,31,.08); }
  .character-card:hover, .character-card:focus-visible { transform: translateY(-2px); }
  .card-visual { height: auto; aspect-ratio: 4 / 5; }
  .avatar-fallback { font-size: 2.5rem; }
  .card-badges { left: 7px; top: 7px; gap: 4px; max-width: calc(100% - 14px); }
  .visibility-badge, .interaction-card-badge { padding: 4px 6px; font-size: .48rem; }
  .card-body { display: block; min-height: 0; padding: 9px 8px 8px; }
  .card-meta {
    display: block;
    margin: 0 0 4px;
    overflow: hidden;
    font-size: .52rem;
    line-height: 1.3;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card-body h3 {
    display: block;
    min-height: 0;
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.25;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card-tagline {
    display: -webkit-box;
    min-height: 0;
    margin: 4px 0 6px;
    overflow: hidden;
    font-size: .62rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .card-footer { justify-content: flex-end; margin-top: 5px; padding-top: 0; border-top: 0; }
  .card-footer > span:first-child { display: none; }
  .card-arrow { width: 25px; height: 25px; border-radius: 8px; font-size: .68rem; }
  .loading-card { min-height: 190px; }
  .loading-card div { height: 132px; }
  .loading-card span { width: 70%; height: 10px; margin: 12px 8px 0; }
  .loading-card span:last-child { width: 42%; margin-top: 7px; }
  .worldbook-list { grid-template-columns: 1fr; }
  .privacy-banner { align-items: flex-start; }

  .modal-layer { align-items: end; padding: 0; }
  .character-dialog, .create-choice-dialog, .creator-dialog, .settings-dialog, .worldbook-dialog, .archive-dialog, .message-editor-dialog, .confirmation-dialog { width: 100%; max-height: 94dvh; border-radius: 28px 28px 0 0; }
  .create-choice-dialog { overflow-y: auto; }
  .create-choice-header { padding: 34px 24px 22px; }
  .create-choice-header h2 { padding-right: 34px; font-size: 2.35rem; }
  .create-choice-grid { grid-template-columns: 1fr; padding: 0 24px 28px; }
  .create-choice-card { min-height: 178px; padding: 19px; }
  .character-dialog { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(210px,42dvh) minmax(0,1fr); height: 94dvh; overflow: hidden; }
  .detail-image { height: auto; min-height: 0; }
  .avatar-fallback.large { min-height: 0; }
  .detail-body { min-height: 0; padding: 24px 22px 20px; overflow: hidden; }
  .detail-scroll { padding-right: 5px; }
  .detail-body h2 { font-size: 3.3rem; }
  .creator-header { padding: 19px 20px 15px; }
  .creator-mode-tabs { margin: 17px 20px 0; }
  .creator-mode-tabs.editing { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .creator-mode { min-height: 50px; padding: 7px 4px; }
  .creator-mode strong { font-size: .69rem; }
  .creator-mode small { font-size: .52rem; }
  #creatorForm, .free-creator-panel, .import-panel { padding: 22px 20px 28px; }
  .creator-field-grid.two, .creator-field-grid.three { grid-template-columns: 1fr; }
  .visibility-picker { grid-template-columns: 1fr; }
  .visibility-picker label > span { min-height: 66px; }
  .interaction-setting { grid-template-columns: 1fr; }
  .interaction-switch { justify-self: start; }
  .avatar-picker { grid-template-columns: 76px 1fr; }
  .avatar-preview { width: 76px; height: 96px; }
  .creator-footer { grid-template-columns: auto 1fr auto; }

  .chat-screen { grid-template-rows: 68px minmax(0,1fr) auto; }
  .chat-screen { --chat-whale-width: max(440px, 110vw); }
  .chat-screen.keyboard-open :is(.chat-mascot, .chat-mascot-fin) { display: none; }
  .chat-header { grid-template-columns: 54px minmax(0,1fr) 42px; padding: 0 12px; }
  .chat-menu { position: absolute; top: calc(100% + 8px); right: 0; bottom: auto; left: auto; display: flex; width: min(330px,calc(100vw - 24px)); max-height: calc(var(--chat-viewport-height,100dvh) - 84px); gap: 0; padding: 7px; border-radius: 22px; }
  .chat-back span { display: none; }
  .chat-character { min-width: 0; justify-self: center; }
  .chat-character > span:last-child { min-width: 0; }
  .chat-character small > span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-character small { gap: 5px; }
  .chat-character small > #chatModeLabel { max-width: 92px; }
  .chat-cache-status { max-width: 124px !important; padding-inline: 6px; }
  .chat-menu button { min-width: 0; min-height: 58px; padding: 10px 13px; }
  .message-menu:not(.message-menu-floating) { position: fixed; z-index: 100; top: auto; right: 12px !important; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px !important; min-width: 0; padding: 8px; border-radius: 18px 34px 18px 18px; background: rgba(255,250,240,.98); box-shadow: 0 24px 60px rgba(10,21,14,.32); backdrop-filter: blur(16px); }
  .message-menu button { min-height: 50px; border-right: 1px solid var(--line); font-size: .72rem; }
  .settings-header { padding: 22px 20px 18px; }
  .settings-header h2 { font-size: 1.75rem; }
  .settings-panel, .archive-panel { padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
  .settings-panel > .field textarea { min-height: 190px; }
  .worldbook-editor { padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
  .character-worldbook-import { align-items: stretch; flex-direction: column; }
  .character-worldbook-import .secondary-button { width: 100%; }
  .worldbook-entry { padding: 14px; }
  .worldbook-entry-controls { display: grid; grid-template-columns: 1fr; }
  .worldbook-toggle span { min-height: 38px; display: flex; align-items: center; }
  .worldbook-editor-actions { grid-template-columns: 1fr 1fr; }
  .worldbook-editor-actions > span { display: none; }
  .worldbook-editor-actions .danger-text-button { grid-column: 1 / -1; justify-self: start; }
  .worldbook-editor-actions .primary-button, .worldbook-editor-actions .secondary-button { width: 100%; }
  .archive-create-form { grid-template-columns: 1fr; gap: 10px; }
  .archive-create-form .primary-button { width: 100%; }
  .archive-item { grid-template-columns: 1fr; gap: 11px; }
  .archive-item-actions { justify-content: flex-end; }
  .confirmation-dialog { padding: 25px 20px calc(24px + env(safe-area-inset-bottom)); }
  .confirmation-content h2 { font-size: 1.7rem; }
  .confirmation-actions { align-items: stretch; flex-direction: column-reverse; }
  .confirmation-actions .primary-button, .confirmation-actions .secondary-button { width: 100%; }
  .model-picker { grid-template-columns: 1fr; }
  .model-picker-group { grid-template-columns: minmax(0,1fr); }
  .model-picker label > span { min-height: 76px; }
  .response-length-picker label > span { min-height: 82px; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; }
  .settings-actions .primary-button, .settings-actions .secondary-button { width: 100%; }
  .message-stage { padding: 24px 12px 18px; background-size: 34px 34px; }
  .message { max-width: 94%; margin-bottom: 20px; }
  .message-action-trigger { width: 36px; height: 31px; font-size: .82rem; }
  .message-menu { min-width: 172px; }
  .message-menu button { min-height: 42px; font-size: .68rem; }
  .message-bubble { padding: 15px 16px; border-radius: 7px 20px 20px 20px; font-size: .98rem; line-height: 1.36; backdrop-filter: none; }
  .usage-header { align-items: flex-start; }
  .usage-live-pill { margin-top: 8px; }
  .usage-summary { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 34px; }
  .usage-summary article { padding: 16px; }
  .usage-toolbar { align-items: stretch; flex-direction: column; }
  .usage-date-controls { display: grid; grid-template-columns: 42px minmax(0,1fr) 42px auto; align-items: end; }
  .usage-date-controls input { width: 100%; min-width: 0; }
  .usage-board-head { display: none; }
  .usage-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 17px; }
  .usage-player { grid-column: 1/-1; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .usage-row .usage-metric:last-child { grid-column: 1/-1; }
  .credit-header { align-items: flex-start; }
  .credit-private-pill { margin-top: 8px; }
  .credit-wallet { grid-template-columns: minmax(0,1fr); gap: 23px; padding: 26px 22px 22px; }
  .credit-wallet-amount { align-items: flex-start; min-width: 0; }
  .credit-wallet-rule { grid-column: 1; }
  .credit-wallet-rule > span { padding: 13px 11px; }
  .credit-wallet-rule strong { font-size: .92rem; }
  .credit-history-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .credit-history-heading > p { text-align: left; }
  .credit-call-row { grid-template-columns: 36px minmax(0,1fr); gap: 12px; padding: 15px; }
  .credit-call-status { grid-column: 2; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: left; }
  .credit-call-status small { margin-top: 0; text-align: right; }
  .composer-wrap { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .chat-screen.keyboard-open { grid-template-rows: minmax(0,1fr) auto; }
  .chat-screen.keyboard-open .chat-header { display: none; }
  .chat-screen.keyboard-open .message-stage { grid-row: 1; }
  .chat-screen.keyboard-open .composer-wrap { grid-row: 2; }
  .chat-screen.keyboard-open .composer-wrap { padding: 4px 8px; }
  .chat-screen.keyboard-open .regenerate-wrap { display: none; }
  .chat-screen.keyboard-open .composer { grid-template-columns: minmax(0,1fr) 40px; padding: 4px 5px 4px 12px; border-radius: 16px; }
  .chat-screen.keyboard-open .composer textarea { max-height: min(120px,max(28px,calc(var(--chat-viewport-height) - 72px))); padding: 5px 0; }
  .chat-screen.keyboard-open .composer button { width: 40px; height: 40px; }
  .regenerate-wrap { margin-top: -1px; margin-bottom: 8px; }
  .regenerate-button { min-height: 34px; padding: 0 15px; font-size: .7rem; }
  .composer { border-radius: 18px; }
  .composer-wrap > p { display: none; }
  .toast-stack { right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
}

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

.memory-event-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.memory-event-edit { min-width: 54px; min-height: 34px; border: 1px solid rgba(31,76,59,.2); border-radius: 7px 14px 7px 7px; background: rgba(238,247,238,.72); color: var(--forest-2); font: inherit; font-size: .6rem; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.memory-event-edit:hover { border-color: var(--forest-2); background: rgba(238,247,238,.95); transform: translateY(-1px); }
.memory-event-edit:focus-visible { outline: 3px solid rgba(31,76,59,.16); outline-offset: 2px; }
.memory-event-edit:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.memory-digest-cards li { align-items: start; }
.memory-digest-cards li > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
/* Interactive card documents remain isolated from the surrounding chat page. */
.tavern-toolbar { max-width: 840px; margin: 12px auto; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 12px; background: #e7ead6; color: #253e30; font-size: 13px; }
.tavern-toolbar[hidden] { display: none; }
.tavern-toolbar button { border: 1px solid #718162; border-radius: 8px; padding: 6px 10px; background: #f8faef; color: inherit; white-space: nowrap; cursor: pointer; }
.message:has(.tavern-message) { width: 100%; max-width: 100%; }
.message-bubble.tavern-message { width: 100%; max-width: 100%; padding: 0; overflow: hidden; background: transparent; }
.message-bubble.tavern-format-pending { min-height: 110px; max-height: 160px; display: grid; place-items: center; overflow: hidden; color: transparent; }
.message-bubble.tavern-format-pending > * { display: none !important; }
.message-bubble.tavern-format-pending::after { content: '正在载入互动界面…'; color: var(--muted); font-size: .78rem; letter-spacing: .04em; }
.tavern-frame { display: block; width: 100%; height: 360px; min-height: 360px; overflow: hidden; border: 0; border-radius: 12px; }
.tavern-notice { padding: 10px 14px; color: #863d20; background: #fff2dd; font-size: 13px; }

.tavern-toolbar { flex-wrap: wrap; }
.tavern-script-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.tavern-script-frame[hidden] { display: none; }
.tavern-manager { width: min(800px, 94vw); max-height: 90dvh; overflow: auto; padding: 24px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.tavern-manager::backdrop { background: rgba(0,0,0,.6); }
.tavern-manager-heading, .tavern-editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.tavern-manager textarea { width: 100%; min-height: 300px; box-sizing: border-box; font-family: Consolas, monospace; font-size: 13px; }
.tavern-manager label { display: block; margin: 12px 0; }
.tavern-manager select { margin-left: 12px; }
.tavern-manager button, .tavern-manager select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; color: var(--ink); background: var(--paper); font: inherit; cursor: pointer; }
.tavern-manager button:disabled { opacity: .45; cursor: default; }
.tavern-manager #tavernSaveDocument, .tavern-manager #tavernSavePermissions { color: var(--paper); background: var(--ink); }
.tavern-manager textarea { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fffdf6; color: var(--ink); }
.tavern-manager-heading { position: sticky; top: -24px; margin-top: -24px; padding: 16px 0; background: var(--paper); z-index: 1; }
.tavern-manager-heading h2 { margin: 0; }
.tavern-manager select { max-width: 100%; }
.tavern-manager .tavern-permission { display: flex; align-items: center; gap: 8px; }
.tavern-manager .tavern-permission input { width: auto; }
.tavern-notice { overflow-wrap: anywhere; }
.tavern-script-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.tavern-script-row label { flex: 1; min-width: 150px; overflow-wrap: anywhere; }
.tavern-script-row input { width: auto; margin-right: 8px; }
.tavern-script-row button { padding: 4px 8px; }
/* Site metadata controls do not change character bodies or the chat renderer. */
.site-quick-links,.discovery-filters,.site-pagination,.site-tags { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.site-quick-links { margin:16px 0; }
.site-quick-links a,.site-tags button,.site-pagination button,.discovery-filters button { color:var(--forest); background:var(--surface); border:1px solid var(--line); border-radius:7px 15px 7px 7px; padding:9px 13px; text-decoration:none; cursor:pointer; }
.site-quick-links a { display:inline-flex; align-items:center; min-height:44px; font-size:13px; font-weight:700; }
.site-quick-links a:hover,.site-pagination button:hover:not(:disabled) { background:var(--cream); border-color:var(--forest-3); }
.discovery-filters { margin:16px 0; }
.discovery-filters form { display:flex; gap:8px; flex-wrap:wrap; }
.discovery-filters input,.discovery-filters select { max-width:100%; min-width:0; border:1px solid #d9d5ca; border-radius:10px; padding:10px; background:white; color:#34342e; }
.discovery-filters label { display:flex; align-items:center; gap:8px; }
.site-pagination { justify-content:center; margin:24px 0; }
.site-pagination button:disabled { opacity:.45; cursor:default; }
.site-tags { margin:8px 0; font-size:12px; overflow-wrap:anywhere; }
.site-tags button { padding:4px 9px; }
.site-tag-editor { display:grid; gap:10px; margin:12px 0; }
.site-tag-editor label { display:grid; gap:8px; }
.site-tag-editor textarea { width:100%; max-width:100%; resize:vertical; border:1px solid #d9d5ca; border-radius:10px; padding:10px; background:white; color:#34342e; }
.site-tag-editor small { line-height:1.7; }
.image-unavailable,.private-image-pending { visibility:hidden; }
.card-visual .image-fallback { position:absolute; inset:0; }
.card-visual img { position:relative; }
.card-footer > .card-heat:first-child { display:block; margin-right:auto; font-variant-numeric:tabular-nums; }
.discovery-revalidating { visibility:hidden; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.home-announcement { margin:18px 0; padding:16px; border-radius:14px; background:#fff5d9; overflow-wrap:anywhere; }
.home-announcement a { color:inherit; }
.announcement-page { width:min(900px,100%); margin:0 auto; padding:24px; }
.announcement-article { padding:28px; margin:22px 0; background:var(--surface); border:1px solid var(--line); border-radius:9px 28px 9px 9px; overflow-wrap:anywhere; }
.announcement-article h2 { font:500 26px/1.4 var(--serif); color:var(--forest); margin:0 0 12px; }
.announcement-article time { font-size:12px; color:var(--muted); }
.announcement-body { white-space:pre-wrap; line-height:1.85; margin:20px 0; }
.announcement-images { display:grid; gap:16px; }
.announcement-images img { max-width:100%; height:auto; border-radius:10px; }
.announcement-popup { width:min(680px,calc(100vw - 28px)); max-height:85dvh; overflow:auto; border:1px solid var(--line); border-radius:10px 32px 10px 10px; padding:20px; color:var(--ink); background:var(--paper); box-shadow:var(--shadow); }
.announcement-popup::backdrop { background:rgba(20,33,27,.45); }
.announcement-popup .announcement-article { margin-top:0; }
@media(max-width:600px) { .announcement-page { padding:16px; }.announcement-article { padding:18px; }.discovery-filters { align-items:stretch; }.discovery-filters form { width:100%; }.discovery-filters input { flex:1; width:130px; }.site-pagination { gap:8px; font-size:13px; }.site-tags button { min-height:30px; } }
