:root,
html[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #06182b;
  --bg-soft: #0a2138;
  --panel: #0d2a44;
  --panel-2: #112f4d;
  --panel-3: #183b5b;
  --line: rgba(120, 190, 255, 0.14);
  --line-strong: rgba(120, 190, 255, 0.26);
  --text: #e8f4ff;
  --muted: #a7c5df;
  --faint: #82a7c6;
  --amber: #58c8ff;
  --amber-soft: #9fdcff;
  --amber-dim: #0d2a44;
  --green: #59d6a4;
  --danger: #ff8f9d;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
}

html[data-theme="warm"] {
  --bg: #0f0e0c;
  --bg-soft: #14120f;
  --panel: #181511;
  --panel-2: #1f1b16;
  --panel-3: #26211b;
  --line: rgba(255, 243, 224, 0.08);
  --line-strong: rgba(255, 243, 224, 0.14);
  --text: #f1ebe2;
  --muted: #bdb1a1;
  --faint: #9b8d7c;
  --amber: #e6a45c;
  --amber-soft: #f0c48d;
  --amber-dim: #35261a;
  --green: #9dbd8f;
  --danger: #c47a73;
}

html[data-theme="ocean"] body {
  background:
    radial-gradient(900px 600px at 78% -12%, rgba(54, 150, 235, 0.3), transparent 62%),
    radial-gradient(700px 500px at 8% 100%, rgba(11, 61, 103, 0.52), transparent 64%),
    linear-gradient(160deg, #06182b 0%, #071d33 55%, #041321 100%);
}

html[data-theme="warm"] body {
  background:
    radial-gradient(900px 600px at 78% -10%, rgba(230, 164, 92, 0.12), transparent 62%),
    radial-gradient(700px 500px at 12% 100%, rgba(90, 69, 46, 0.16), transparent 64%),
    var(--bg);
}

html[data-theme="dawn"] {
  --bg: #f4efe6;
  --bg-soft: #ebe3d7;
  --panel: #fbf7f0;
  --panel-2: #f0e8dc;
  --panel-3: #e5dacb;
  --line: rgba(74, 54, 34, 0.12);
  --line-strong: rgba(74, 54, 34, 0.2);
  --text: #2f261d;
  --muted: #665541;
  --faint: #78644f;
  --amber: #b9702a;
  --amber-soft: #8f521c;
  --amber-dim: #f1deca;
  --green: #5f7d54;
  --danger: #a34f46;
}

html[data-theme="minimal"] {
  --bg: #111214;
  --bg-soft: #17181b;
  --panel: #1c1d21;
  --panel-2: #23252a;
  --panel-3: #2b2d33;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #e7e7e4;
  --muted: #b8b9b5;
  --faint: #9a9c9f;
  --amber: #b8b6ae;
  --amber-soft: #dedbd2;
  --amber-dim: #303238;
  --green: #8fa88a;
  --danger: #c47a73;
}

html[data-theme="dawn"] body {
  background:
    radial-gradient(900px 600px at 78% -10%, rgba(185, 112, 42, 0.1), transparent 62%),
    radial-gradient(700px 500px at 12% 100%, rgba(160, 130, 90, 0.12), transparent 64%),
    var(--bg);
}

html[data-theme="minimal"] body {
  background: var(--bg);
}

* { box-sizing: border-box; }

.app-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 1000;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  background-size: 200% 100%; animation: progress-slide 1.1s linear infinite;
}
@keyframes progress-slide { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.update-banner {
  position: fixed; top: 94px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid rgba(220,170,100,.45); border-radius: 999px;
  background: rgba(31,24,18,.96); color: var(--amber-soft);
  box-shadow: 0 8px 30px rgba(0,0,0,.35); font-size: 11px; white-space: nowrap;
}
.update-banner button {
  border: 0; border-radius: 999px; padding: 5px 9px; font-size: 10px;
  background: var(--amber); color: #24170c; cursor: pointer;
}
.update-banner button#updateLater { background: transparent; color: var(--faint); }
.update-banner[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 82% -8%, rgba(86, 174, 255, 0.26), transparent 62%),
    radial-gradient(700px 500px at 8% 100%, rgba(156, 205, 255, 0.3), transparent 64%),
    var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 304px;
  height: 100vh;
  height: 100dvh;
}

/* ---------- sidebar ---------- */
.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 17, 13, 0.92), rgba(15, 14, 12, 0.98));
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px 24px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--amber);
  background: radial-gradient(circle at 50% 30%, rgba(230, 164, 92, .22), rgba(230, 164, 92, .04));
  border: 1px solid rgba(230, 164, 92, .3);
  box-shadow: 0 0 28px rgba(230, 164, 92, .1);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand strong { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: 3px; }
.brand span { display: block; color: var(--faint); font-size: 10px; letter-spacing: .3px; margin-top: 3px; }

.side-label, .eyebrow {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.side-label { padding: 0 8px 10px; }

.persona-list { display: grid; gap: 4px; }
.persona-card {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 11px;
  border: 1px solid transparent; border-radius: 14px;
  background: transparent; text-align: left;
  transition: .2s ease; cursor: pointer;
}
.persona-card:hover { background: rgba(255,255,255,.025); }
.persona-card.active { border-color: var(--line); background: var(--panel); }
.persona-edit {
  border: 0; background: transparent; color: var(--faint); font-size: 12px;
  padding: 4px; border-radius: 6px; flex: 0 0 auto;
}
.persona-edit:hover { color: var(--amber-soft); background: rgba(255,255,255,.04); }
.avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); color: #2b1c0f;
  background: radial-gradient(circle at 35% 25%, #f4cf9b, #c98a47 68%, #7d4d25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 4px 14px rgba(0,0,0,.25);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar.small { width: 36px; height: 36px; flex-basis: 36px; font-size: 14px; }
.avatar.tiny { width: 26px; height: 26px; flex-basis: 26px; font-size: 11px; }
.persona-copy { flex: 1; min-width: 0; }
.persona-copy strong { display: block; font-size: 13px; font-weight: 500; }
.persona-copy small { display: block; color: var(--faint); font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(157,189,143,.5); }

.persona-add {
  width: 100%; margin-top: 6px; padding: 9px 12px;
  border: 1px dashed var(--line-strong); border-radius: 12px;
  background: transparent; color: var(--faint); font-size: 11px; text-align: left;
  transition: .2s;
}
.persona-add:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.35); }

.main-nav { margin-top: 26px; display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted); text-align: left; font-size: 12.5px;
  transition: .18s;
}
.nav-item:hover { background: rgba(255,255,255,.03); color: var(--text); }
.nav-item.active { background: var(--amber-dim); color: var(--amber-soft); }
.nav-icon { width: 16px; text-align: center; color: var(--amber); font-size: 13px; }

.side-bottom { margin-top: auto; padding: 16px 6px 0; border-top: 1px solid var(--line); }
.quota { display: flex; justify-content: space-between; align-items: baseline; color: var(--faint); font-size: 10px; letter-spacing: .5px; }
.quota strong { color: var(--muted); font-size: 11px; font-weight: 500; }
.quota-track { height: 3px; background: rgba(255,255,255,.06); border-radius: 99px; margin: 8px 0 12px; overflow: hidden; }
.quota-track span { display: block; height: 100%; background: linear-gradient(90deg, #8a5a2e, var(--amber)); border-radius: inherit; transition: width .4s; }
.text-button { border: 0; background: transparent; color: var(--faint); font-size: 11px; padding: 2px 0; }
.text-button:hover { color: var(--amber-soft); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-header {
  height: 78px; flex: 0 0 78px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line);
  background: rgba(15, 14, 12, .55); backdrop-filter: blur(16px);
}
.header-persona { display: flex; align-items: center; gap: 12px; cursor: pointer; border-radius: 12px; }
.header-persona:hover { background: rgba(255,255,255,.025); }
.persona-picker { display: grid; gap: 6px; margin-top: 14px; }
.persona-picker-item {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); border-radius: 12px;
  text-align: left; color: var(--text);
}
.persona-picker-item:hover { border-color: rgba(230,164,92,.3); }
.persona-picker-item strong { display: block; font-size: 12.5px; font-weight: 500; }
.persona-picker-item small { display: block; color: var(--faint); font-size: 10px; margin-top: 3px; }
.header-persona h1 { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: 1px; }
.header-persona p { margin: 4px 0 0; color: var(--faint); font-size: 10.5px; display: flex; align-items: center; gap: 6px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px rgba(157,189,143,.6); }
.header-actions { display: flex; gap: 6px; }
.icon-button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: .18s;
}
.icon-button:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

.chat-view { padding: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 22px 28px 10px; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.day-divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 9px; letter-spacing: 2px; margin: 4px 0 22px; }
.day-divider::before, .day-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.messages { display: flex; flex-direction: column; gap: 14px; max-width: 760px; margin: 0 auto; }
.message { display: flex; gap: 9px; align-items: flex-end; animation: rise .32s ease both; }
.message.user { justify-content: flex-end; }
.bubble {
  max-width: min(72%, 560px); padding: 11px 15px;
  border-radius: 17px 17px 17px 5px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.75; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.message.user .bubble {
  background: linear-gradient(145deg, #3b2b1b, #2b2118);
  border-color: rgba(230,164,92,.18);
  border-radius: 17px 17px 5px 17px;
  color: #f2dfc7;
}
.bubble.sticker { background: transparent; border: 0; padding: 0; box-shadow: none; }
.bubble.sticker img { width: 148px; max-width: 100%; display: block; border-radius: 20px; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.sticker-item {
  border: 1px solid var(--line); background: var(--bg-soft); border-radius: 16px;
  padding: 0; overflow: hidden; aspect-ratio: 1;
}
.sticker-item:hover { border-color: rgba(230,164,92,.35); }
.sticker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-entry { border-style: dashed; }
.message .avatar { margin-bottom: 1px; }
.message-voice {
  align-self: flex-end; flex: 0 0 auto; width: 30px; height: 30px;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--panel-2); color: var(--amber-soft); font-size: 12px;
  display: grid; place-items: center; margin-bottom: 2px;
}
.message-voice:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.3); }
.message-voice:disabled { opacity: .4; }
.message-meta { font-size: 9px; color: var(--faint); letter-spacing: .5px; padding: 0 3px 4px; }

.typing { display: flex; gap: 9px; align-items: center; max-width: 760px; margin: 15px auto 0; }
.typing[hidden] { display: none; }
.typing-dots { display: flex; gap: 4px; padding: 12px 14px; border-radius: 16px 16px 16px 5px; background: var(--panel-2); border: 1px solid var(--line); }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }

.quick-row { display: flex; gap: 7px; flex-wrap: wrap; padding: 12px 28px 0; max-width: 816px; margin: 0 auto; width: 100%; }
.quick-chip {
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
  color: var(--muted); border-radius: 99px; padding: 7px 12px; font-size: 11px;
  transition: .18s;
}
.quick-chip:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.3); background: rgba(230,164,92,.05); }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  margin: 13px auto 0; width: min(760px, calc(100% - 56px));
  padding: 8px 8px 8px 17px;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.composer:focus-within { border-color: rgba(230,164,92,.35); box-shadow: 0 12px 40px rgba(0,0,0,.3), 0 0 0 3px rgba(230,164,92,.05); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 13px; line-height: 1.65;
  min-height: 26px; max-height: 132px; padding: 5px 0;
}
.composer textarea::placeholder { color: var(--faint); }
.send-button {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--amber); color: #2a1a0d;
  transition: .2s;
}
.send-button:hover { background: var(--amber-soft); transform: translateY(-1px); }
.send-button svg { width: 16px; height: 16px; }
.composer-icon {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; transition: .18s;
}
.composer-icon:hover { color: var(--amber-soft); background: rgba(255,255,255,.04); }
.composer-icon svg { width: 18px; height: 18px; }
#voiceEntry {
  color: var(--amber-soft);
  background: rgba(88, 200, 255, .14);
  border: 1px solid var(--line-strong);
}
#voiceEntry:hover { background: rgba(88, 200, 255, .24); }
#plusEntry { font-size: 23px; font-weight: 300; }
.composer-panel {
  width: min(760px, calc(100% - 56px)); margin: 8px auto 0;
  border: 1px solid var(--line); border-radius: 18px;
  background: rgba(24,21,17,.92); padding: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.composer-panel[hidden] { display: none; }
.composer-panel-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.panel-item {
  display: grid; place-items: center; gap: 6px; padding: 11px 4px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-soft); color: var(--muted);
}
.panel-item:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.28); }
.panel-item span { font-size: 19px; line-height: 1; }
.panel-item small { font-size: 10px; }
.composer-panel-hint { color: var(--faint); font-size: 10px; text-align: center; margin: 10px 0 0; }
.composer-note { color: var(--faint); font-size: 9px; text-align: center; margin: 8px 0 14px; letter-spacing: .3px; }

/* ---------- rail ---------- */
.rail { border-left: 1px solid var(--line); padding: 24px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.rail-card { border: 1px solid var(--line); background: rgba(24,21,17,.68); border-radius: var(--radius); padding: 18px; }
.lamp-card { text-align: center; background: radial-gradient(circle at 50% 0%, rgba(230,164,92,.12), transparent 62%), var(--panel); }
.lamp { position: relative; width: 58px; height: 58px; margin: 2px auto 14px; display: grid; place-items: center; }
.lamp-glow { position: absolute; inset: 10px; border-radius: 50%; background: rgba(230,164,92,.22); filter: blur(14px); }
.lamp-body { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); color: var(--amber-soft); border: 1px solid rgba(230,164,92,.38); background: rgba(230,164,92,.07); }
.rail-card h3 { font-family: var(--serif); font-size: 15px; font-weight: 500; margin: 7px 0 7px; letter-spacing: .7px; }
.rail-card p { color: var(--faint); font-size: 11px; line-height: 1.8; margin: 0; }
.rail-title { display: flex; justify-content: space-between; align-items: baseline; }
.rail-title h3 { margin-top: 0; }
.mini-memory { list-style: none; margin: 13px 0 0; padding: 0; display: grid; gap: 10px; }
.mini-memory li { color: var(--muted); font-size: 11px; line-height: 1.6; padding-left: 11px; position: relative; }
.mini-memory li::before { content: ""; position: absolute; left: 0; top: .6em; width: 3px; height: 3px; border-radius: 50%; background: var(--amber); opacity: .7; }
.plan-card { margin-top: auto; }
.primary-button { border: 1px solid rgba(230,164,92,.28); background: rgba(230,164,92,.1); color: var(--amber-soft); border-radius: 10px; padding: 9px 13px; font-size: 11px; transition: .2s; }
.primary-button:hover { background: rgba(230,164,92,.18); border-color: rgba(230,164,92,.45); }
.primary-button.wide { width: 100%; margin-top: 15px; }

/* ---------- memory/member/settings ---------- */
.memory-view, .member-view, .settings-view { padding: 34px 36px; overflow-y: auto; display: none; }
.memory-view.active, .member-view.active, .settings-view.active { display: block; }
.view-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.view-heading h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin: 8px 0 6px; letter-spacing: 1px; }
.view-heading p { color: var(--faint); font-size: 12px; margin: 0; }
.relationship-card {
  display: grid; gap: 10px; margin: 0 0 18px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
}
.relationship-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.relationship-top strong { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.relationship-top span { color: var(--amber-soft); font-size: 11px; }
.relationship-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--faint); font-size: 10px; }
.relationship-bar { height: 5px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.relationship-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8fd3ff, #2f86e0); }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.memory-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 18px; position: relative; }
.memory-card .memory-date { color: var(--faint); font-size: 9px; letter-spacing: 1.4px; }
.memory-card p { color: var(--text); font-size: 13px; line-height: 1.8; margin: 12px 0 16px; }
.memory-card .memory-del { border: 0; background: transparent; color: var(--faint); font-size: 10px; padding: 0; }
.memory-card .memory-del:hover { color: var(--danger); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 13px; }
.plan { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; min-height: 260px; }
.plan.featured { border-color: rgba(230,164,92,.34); background: radial-gradient(circle at 50% 0%, rgba(230,164,92,.12), transparent 58%), var(--panel); }
.plan .plan-kicker { color: var(--faint); font-size: 9px; letter-spacing: 2px; }
.plan h3 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin: 10px 0 4px; }
.plan .price { font-family: var(--serif); font-size: 28px; color: var(--amber-soft); margin: 10px 0 2px; }
.plan .price small { font-family: var(--sans); font-size: 10px; color: var(--faint); margin-left: 3px; }
.plan ul { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.plan li::before { content: "·"; color: var(--amber); margin-right: 7px; }
.plan button { margin-top: auto; }
.fine-print { color: var(--faint); font-size: 10px; margin-top: 18px; }
.settings-list { max-width: 620px; border-top: 1px solid var(--line); }
.settings-categories { display: grid; gap: 8px; margin-top: 20px; }
.settings-category {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); text-align: left;
  text-decoration: none;
}
.settings-category:hover { border-color: rgba(230,164,92,.35); background: var(--panel-2); }
.settings-category-icon {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--amber-dim); color: var(--amber-soft); font-size: 16px;
}
.settings-category > span:nth-child(2) { flex: 1; min-width: 0; }
.settings-category strong { display: block; font-size: 12.5px; font-weight: 500; }
.settings-category small { display: block; color: var(--faint); font-size: 10px; line-height: 1.6; margin-top: 3px; }
.settings-category-arrow { color: var(--faint); font-size: 20px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.setting-row strong { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 4px; }
.setting-row small { color: var(--faint); font-size: 10.5px; }
.danger-button { margin-top: 24px; border: 1px solid rgba(196,122,115,.25); background: rgba(196,122,115,.06); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: 11px; }
input[type="checkbox"] { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-strong); position: relative; transition: .2s; flex: 0 0 36px; }
input[type="checkbox"]::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--faint); top: 2px; left: 2px; transition: .2s; }
input[type="checkbox"]:checked { background: rgba(230,164,92,.28); border-color: rgba(230,164,92,.45); }
input[type="checkbox"]:checked::after { left: 18px; background: var(--amber-soft); }

/* ---------- modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(6,5,4,.72); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(440px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 20px;
  padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.modal header { display: flex; justify-content: space-between; align-items: center; }
.modal-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-back {
  border: 0; background: transparent; color: var(--muted); font-size: 18px;
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
}
.modal-back:hover { background: var(--panel-2); color: var(--text); }
.modal h2 { font-family: var(--serif); font-size: 18px; font-weight: 500; margin: 0; }
.modal textarea { width: 100%; min-height: 100px; margin: 18px 0 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--text); resize: vertical; font-size: 12px; line-height: 1.8; }
.modal .primary-button { width: 100%; }
.access-gate {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(600px 500px at 50% 0%, rgba(230,164,92,.12), transparent 65%), rgba(9,8,7,.96);
  backdrop-filter: blur(12px);
}
.access-gate[hidden] { display: none; }
.access-card {
  width: min(360px, 100%); border: 1px solid var(--line-strong);
  border-radius: 22px; padding: 28px 24px;
  background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.access-card h2 { font-family: var(--serif); font-size: 23px; font-weight: 500; margin: 10px 0 8px; letter-spacing: .5px; }
.access-card > p { color: var(--faint); font-size: 11.5px; line-height: 1.8; margin: 0 0 18px; }
.access-card form { display: flex; gap: 8px; }
.access-card input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 10px 12px; font-size: 12px;
}
.access-card input::placeholder { color: var(--faint); }
.access-card .primary-button { flex: 0 0 auto; }
.access-error { color: var(--danger) !important; min-height: 14px; margin: 10px 0 0 !important; font-size: 10.5px !important; }
.persona-form { display: grid; gap: 10px; margin-top: 16px; }
.persona-form label { display: grid; gap: 5px; color: var(--faint); font-size: 10px; letter-spacing: .4px; }
.persona-form input, .persona-form textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.persona-form textarea { min-height: 62px; resize: vertical; line-height: 1.7; }
.persona-form-actions { display: flex; gap: 8px; margin-top: 4px; }
.persona-form-actions .primary-button { flex: 1; }
.persona-form-actions .danger-button { margin-top: 0; }
.persona-form-hint { color: var(--faint); font-size: 10px; line-height: 1.7; margin: 0; }
.avatar-editor { display: flex; align-items: center; gap: 10px; }
.avatar-preview {
  width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; color: var(--faint); font-size: 10px;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-editor .setting-action { flex: 1; }
.setting-action {
  width: 100%; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--text); font-size: 12px;
}
.setting-action:hover { border-color: rgba(230,164,92,.3); }
.setting-row select,
.setting-row input[type=text] {
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--bg-soft); color: var(--text); padding: 7px 9px; font-size: 11px;
  max-width: 150px;
}
.plugin-list { display: grid; gap: 8px; margin-top: 14px; }
.plugin-row {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line); border-radius: 13px; padding: 10px 11px;
  background: var(--bg-soft);
}
.plugin-copy { flex: 1; min-width: 0; }
.plugin-copy strong { display: block; font-size: 12px; font-weight: 500; }
.plugin-copy small { display: block; color: var(--faint); font-size: 10px; line-height: 1.7; margin-top: 3px; }
.plugin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-badge { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: var(--text); border-radius: 999px; font-size: 10px; padding: 5px 8px; cursor: pointer; }
.mode-badge.is-warning { border-color: #d9a441; color: #f0c36d; }
.sandbox-output { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; padding: 12px; border-radius: 12px; background: var(--bg-soft); color: var(--text); font-size: 12px; line-height: 1.7; }
.plugin-row input[type=checkbox] { flex: 0 0 auto; margin-top: 2px; }
.plugin-actions { display: flex; gap: 6px; margin-top: 12px; }
.plugin-actions .primary-button { flex: 1; }
.plugin-empty { color: var(--faint); font-size: 11px; line-height: 1.8; }
.plugin-empty.warning { color: var(--danger); }
.agent-tools { display: grid; gap: 8px; margin-top: 14px; }
.agent-input-row { display: flex; gap: 8px; }
.agent-input-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.agent-input-row button { flex: 0 0 auto; }
.agent-screen {
  white-space: pre-wrap; max-height: 180px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  color: var(--muted); font-size: 10.5px; line-height: 1.7; margin-top: 10px;
}
.agent-shot { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin-top: 10px; }
.music-player { margin-top: 14px; display: grid; gap: 10px; }
.music-player audio { width: 100%; }
.music-list { display: grid; gap: 6px; margin-top: 10px; }
.music-track {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-soft); color: var(--muted); font-size: 11px; text-align: left;
}
.music-track:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.28); }
.music-empty { color: var(--faint); font-size: 11px; line-height: 1.8; margin: 8px 0 0; }
.listen-room { margin-top: 14px; display: grid; gap: 10px; }
.listen-room code { color: var(--amber-soft); font-size: 20px; letter-spacing: 4px; }
.listen-row { display: flex; gap: 8px; }
.listen-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.listen-status { color: var(--muted); font-size: 11px; line-height: 1.8; }
.listen-upload { display: flex; gap: 8px; }
.listen-upload button { flex: 1; }
.account-box { display: grid; gap: 10px; margin-top: 14px; }
.account-box code { color: var(--amber-soft); font-size: 18px; letter-spacing: 2px; word-break: break-all; }
.account-box input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.account-warning { color: var(--danger); font-size: 10.5px; line-height: 1.8; }
.account-danger-title { color: var(--danger); font-size: 12px; margin: 22px 0 4px; }
.account-box input { margin-top: 6px; }
.web-box { display: grid; gap: 10px; margin-top: 14px; }
.web-box input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.search-results { display: grid; gap: 7px; margin-top: 10px; }
.search-result {
  display: block; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; background: var(--bg-soft); color: var(--text);
  text-decoration: none; font-size: 11px; line-height: 1.7;
}
.search-result strong { display: block; color: var(--amber-soft); font-weight: 500; }
.search-result small { display: block; color: var(--faint); margin-top: 3px; }
.web-title { font-size: 13px; color: var(--amber-soft); font-weight: 500; }
.web-text {
  white-space: pre-wrap; max-height: 300px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  color: var(--muted); font-size: 11px; line-height: 1.8;
}
.file-tools { display: grid; gap: 8px; margin-top: 14px; }
.file-tools input[type=text] {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.file-list { display: grid; gap: 5px; max-height: 160px; overflow: auto; }
.file-item {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--bg-soft); color: var(--muted); text-align: left; font-size: 11px;
}
.file-item:hover { color: var(--amber-soft); border-color: rgba(230,164,92,.28); }
.file-preview {
  white-space: pre-wrap; max-height: 240px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  color: var(--muted); font-size: 10.5px; line-height: 1.75;
}
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.file-actions button { flex: 1; min-width: 90px; }
.file-empty { color: var(--faint); font-size: 11px; }
.office-form { display: grid; gap: 9px; margin-top: 14px; }
.office-form label { display: grid; gap: 5px; color: var(--faint); font-size: 10px; }
.office-form input, .office-form textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.office-form textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.office-result { color: var(--amber-soft); font-size: 11px; line-height: 1.8; word-break: break-all; }
.draw-box { display: grid; gap: 9px; margin-top: 14px; }
.draw-box textarea {
  width: 100%; min-height: 96px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px;
}
.draw-result { display: grid; gap: 8px; }
.draw-result img { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
.panel-item:disabled, .panel-item.is-disabled { opacity: .38; cursor: not-allowed; }
.feedback-count { margin: -4px 0 0; color: var(--faint); font-size: 9px; text-align: right; }
.world-status { margin: 8px 0 0; color: var(--faint); font-size: 10px; }
.world-status.online { color: var(--green); }
.world-list {
  display: grid; gap: 7px; max-height: 360px; overflow: auto;
  margin-top: 10px; padding-right: 2px;
}
.world-message {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  background: var(--bg-soft); font-size: 11px; line-height: 1.7;
}
.world-message.mine { border-color: rgba(220,170,100,.45); }
.world-message strong { color: var(--amber-soft); font-weight: 500; margin-right: 6px; }
.world-message time { color: var(--faint); font-size: 9px; float: right; }
.world-message p { margin: 4px 0 0; color: var(--text); word-break: break-word; }
.world-actions { display: flex; gap: 10px; margin-top: 5px; }
.world-actions button { border: 0; background: transparent; color: var(--faint); font-size: 9px; padding: 0; }
.world-actions button:hover { color: var(--amber-soft); }
.world-compose { display: flex; gap: 6px; margin-top: 10px; }
.world-compose input { flex: 1; min-width: 0; }
.agent-hall { display: grid; gap: 8px; margin-top: 10px; }
.agent-hall-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  background: var(--bg-soft);
}
.agent-hall-card strong { display: block; font-size: 12px; color: var(--text); font-weight: 500; }
.agent-hall-card small { display: block; color: var(--faint); font-size: 10px; line-height: 1.7; margin-top: 4px; }
.agent-hall-card .agent-features { color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 7px; white-space: pre-wrap; }
.agent-advanced { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.agent-advanced summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.agent-advanced label { display: grid; gap: 5px; color: var(--faint); font-size: 10px; }
.agent-hall-actions { display: flex; gap: 6px; margin-top: 8px; }
.agent-hall-actions button { flex: 1; }
.vip-line { color: var(--amber-soft); font-size: 12px; margin: 8px 0; }
.kb-list { display: grid; gap: 6px; margin-top: 10px; }
.kb-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  background: var(--bg-soft);
}
.kb-item strong { display: block; font-size: 11.5px; color: var(--text); font-weight: 500; }
.kb-item small { display: block; color: var(--faint); font-size: 10px; line-height: 1.7; margin-top: 3px; }
.kb-item button { border: 0; background: transparent; color: var(--danger); font-size: 10px; flex: 0 0 auto; }

.retry-banner {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 95;
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 8px 9px 8px 13px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 99px;
  box-shadow: 0 10px 30px rgba(20,70,110,.18); font-size: 11px; color: var(--muted);
}
.retry-banner[hidden] { display: none; }
.retry-banner button { border: 0; border-radius: 99px; padding: 6px 10px; font-size: 10px; }
#retryAction { background: var(--amber); color: #fff; }
#retryDismiss { background: transparent; color: var(--faint); padding: 6px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 100; background: #2c241b; border: 1px solid rgba(230,164,92,.25); color: var(--amber-soft); padding: 10px 16px; border-radius: 99px; font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast[hidden] { display: none; }

.mobile-nav { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 80%, 100% { opacity: .28; } 40% { opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .rail { display: none; }
}

@media (max-width: 760px) {
  body { overflow: hidden; display: flex; flex-direction: column; height: 100dvh; }
  .app {
    display: flex; flex-direction: column; flex: 1 1 auto; height: auto; min-height: 0;
    width: 100%; max-width: 100vw; overflow-x: hidden; padding-bottom: 0;
  }
  .sidebar, .rail { display: none; }
  .main { flex: 1; width: 100%; max-width: 100vw; min-width: 0; min-height: 0; overflow: hidden; }
  .memory-view, .member-view, .settings-view {
    width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  }
  .chat-header { height: 64px; flex-basis: 64px; padding: 0 16px; }
  .header-persona h1 { font-size: 16px; }
  .chat-scroll { padding: 16px 14px 8px; }
  .bubble { max-width: 82%; font-size: 13px; }
  .quick-row { padding: 10px 14px 0; gap: 6px; flex-wrap: wrap; overflow: visible; }
  .composer-panel { width: calc(100% - 28px); margin-top: 7px; }
  .composer-panel-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-row::-webkit-scrollbar { display: none; }
  .quick-chip { flex: 0 0 auto; font-size: 10.5px; }
  .composer { width: calc(100% - 28px); margin-top: 10px; }
  .composer-note { display: none; }
  .memory-view, .member-view, .settings-view { padding: 22px 16px; }
  .view-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .view-heading h2 { font-size: 23px; }
  .plans { grid-template-columns: 1fr; }
  .plan { min-height: 0; }
  .memory-grid { grid-template-columns: 1fr; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line); background: rgba(18,16,13,.96);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-nav-item { border: 0; background: transparent; color: var(--faint); font-size: 9px; display: grid; gap: 4px; justify-items: center; padding: 5px 0; }
  .mobile-nav-item span { font-size: 15px; color: var(--muted); }
  .mobile-nav-item.active { color: var(--amber-soft); }
  .mobile-nav-item.active span { color: var(--amber); }
  .toast { bottom: 84px; }
  .modal { padding: 18px; }
}

/* ---------- lamp wild pets ---------- */
.pet-view { padding: 34px 36px; overflow-y: auto; }
.pet-view.active { display: block; }
.pet-view .desk-pet-stage, .pet-view .desk-pet-config, .pet-view .desk-pet-tips { flex-shrink: 0; }
.pet-streak {
  border: 1px solid var(--line-strong); border-radius: 99px; padding: 7px 12px;
  color: var(--amber-soft); font-size: 10px; white-space: nowrap;
}
.pet-stage {
  --pet-accent: var(--amber);
  position: relative; overflow: hidden; text-align: center;
  border: 1px solid var(--line); border-radius: 26px;
  padding: 26px 20px 22px;
  background:
    radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--pet-accent) 18%, transparent), transparent 55%),
    var(--panel);
  box-shadow: 0 16px 50px rgba(45, 112, 166, .08);
}
.pet-stars { color: var(--faint); font-size: 10px; letter-spacing: 8px; opacity: .7; }
.wild-pet { display: grid; justify-items: center; gap: 5px; padding: 14px 0 16px; }
.wild-emoji {
  font-size: 74px; line-height: 1; color: var(--amber);
  filter: drop-shadow(0 14px 20px rgba(45,112,166,.15));
  animation: pet-bob 2.8s ease-in-out infinite;
}
.wild-pet strong { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: 1px; }
.wild-pet small { color: var(--faint); font-size: 11px; }
.pet-stage-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pet-search, .pet-catch {
  border: 0; border-radius: 99px; padding: 11px 19px; font-size: 12px;
  color: #fff; background: linear-gradient(135deg, #58b7ff, #277bdb);
  box-shadow: 0 8px 22px rgba(47, 134, 224, .22);
  transition: .18s;
}
.pet-search:hover, .pet-catch:hover { transform: translateY(-1px); filter: brightness(1.05); }
.pet-catch { animation: pet-pulse 1.8s ease-in-out infinite; }
.pet-result { min-height: 18px; margin: 14px 0 0; color: var(--muted); font-size: 11px; }
.pet-result.success { color: var(--green); }
.pet-result.fail { color: var(--danger); }
.pet-stage.pet-found .wild-emoji { animation: pet-pop .55s ease both, pet-bob 2.8s .55s ease-in-out infinite; }
.pet-stage.pet-caught .wild-emoji { animation: pet-burst .7s ease both; }
.pet-collection-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.pet-collection-title h3 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.pet-collection-title span { color: var(--faint); font-size: 10px; }
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
.pet-card {
  display: grid; justify-items: center; gap: 4px; padding: 16px 10px;
  border: 1px dashed var(--line-strong); border-radius: 16px;
  background: var(--panel); color: var(--faint); cursor: pointer;
  transition: .18s;
}
.pet-card.owned { border-style: solid; background: var(--panel-2); color: var(--text); }
.pet-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.pet-card-emoji { font-size: 30px; line-height: 1.2; }
.pet-card strong { font-size: 12px; font-weight: 500; }
.pet-card small { font-size: 9px; color: var(--faint); }
.pet-detail-hero { display: grid; place-items: center; font-size: 78px; line-height: 1; padding: 18px 0 8px; }
.pet-detail-hero h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0; }
.pet-detail-rarity { color: var(--amber-soft); font-size: 11px; margin: 4px 0 12px; }
.pet-affection { color: var(--faint); font-size: 11px; }
.pet-view .view-heading { margin-bottom: 18px; }
@keyframes pet-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes pet-pop { from { transform: scale(.45) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes pet-burst { 0% { transform: scale(1); } 35% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(0) rotate(24deg); opacity: 0; } }
@keyframes pet-pulse { 0%, 100% { box-shadow: 0 8px 22px rgba(47,134,224,.22); } 50% { box-shadow: 0 8px 30px rgba(47,134,224,.42); } }
@media (max-width: 760px) {
  .pet-view { padding: 22px 16px; }
  .wild-emoji { font-size: 66px; }
  .pet-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- ocean: deep-sea night blue theme ---------- */
html[data-theme="ocean"] .sidebar {
  background: linear-gradient(180deg, #0a2239, #06182b);
  border-color: var(--line);
}
html[data-theme="ocean"] .brand-mark {
  color: #041321;
  background: linear-gradient(135deg, #a9e8ff, #43b7ef);
  border-color: rgba(120,220,255,.35);
  box-shadow: 0 8px 24px rgba(38, 160, 220, .28);
}
html[data-theme="ocean"] .avatar {
  color: #041321;
  background: linear-gradient(135deg, #b7eeff, #4ec5f5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 4px 14px rgba(35,150,210,.24);
}
html[data-theme="ocean"] .persona-card:hover { background: #123553; }
html[data-theme="ocean"] .nav-item:hover { background: #102f4d; }
html[data-theme="ocean"] .chat-header {
  background: rgba(7, 25, 42, .86);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
html[data-theme="ocean"] .header-persona:hover { background: #102f4d; }
html[data-theme="ocean"] .bubble {
  background: #0f2d49;
  border-color: rgba(120,190,255,.12);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .16);
}
html[data-theme="ocean"] .message.user .bubble {
  background: linear-gradient(145deg, #2d8ec9, #1b5f9a);
  border-color: rgba(105,210,255,.2);
  color: #f4fcff;
}
html[data-theme="ocean"] .quick-chip { background: #0f2d49; border-color: var(--line); }
html[data-theme="ocean"] .quick-chip:hover { background: #16405f; border-color: rgba(88,200,255,.35); }
html[data-theme="ocean"] .composer {
  background: #0c2741;
  border-color: rgba(120,190,255,.16);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}
html[data-theme="ocean"] .composer:focus-within {
  border-color: rgba(88,200,255,.5);
  box-shadow: 0 12px 40px rgba(0,0,0,.3), 0 0 0 3px rgba(88,200,255,.08);
}
html[data-theme="ocean"] .composer-panel {
  background: #0d2a44;
  border-color: var(--line-strong);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .34);
}
html[data-theme="ocean"] .composer-icon:hover { background: #163d5c; }
html[data-theme="ocean"] .send-button { color: #041321; }
html[data-theme="ocean"] .rail-card { background: rgba(10, 34, 55, .82); }
html[data-theme="ocean"] .lamp-card {
  background: radial-gradient(circle at 50% 0%, rgba(88,200,255,.2), transparent 62%), #0d2a44;
}
html[data-theme="ocean"] .lamp-glow { background: rgba(88,200,255,.3); }
html[data-theme="ocean"] .lamp-body {
  color: #9fdcff;
  border-color: rgba(88,200,255,.32);
  background: #103552;
}
html[data-theme="ocean"] .primary-button {
  border-color: rgba(88,200,255,.4);
  background: #103b5c;
  color: #c9f1ff;
}
html[data-theme="ocean"] .primary-button:hover { background: #174b71; border-color: rgba(88,200,255,.65); }
html[data-theme="ocean"] .settings-category:hover { border-color: rgba(88,200,255,.35); background: #102f4d; }
html[data-theme="ocean"] .plan.featured {
  border-color: rgba(88,200,255,.4);
  background: radial-gradient(circle at 50% 0%, rgba(88,200,255,.16), transparent 58%), #0d2a44;
}
html[data-theme="ocean"] input[type="checkbox"]:checked {
  background: #58c8ff;
  border-color: #58c8ff;
}
html[data-theme="ocean"] input[type="checkbox"]:checked::after { background: #041321; }
html[data-theme="ocean"] .update-banner {
  background: rgba(13,42,68,.98);
  border-color: rgba(88,200,255,.3);
  color: #bfeaff;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
html[data-theme="ocean"] .update-banner button { color: #041321; }
html[data-theme="ocean"] .toast {
  background: #123d5d;
  border-color: rgba(88,200,255,.38);
  color: #f5faff;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
html[data-theme="ocean"] .modal { box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
html[data-theme="ocean"] .modal-backdrop { background: rgba(2, 12, 22, .65); }
html[data-theme="ocean"] .access-gate {
  background: radial-gradient(600px 500px at 50% 0%, rgba(54,150,235,.25), transparent 65%), #06182b;
}
html[data-theme="ocean"] .world-message.mine { border-color: rgba(88,200,255,.3); background: #103552; }
html[data-theme="ocean"] .mobile-nav {
  background: rgba(6, 24, 43, .97);
  box-shadow: 0 -8px 24px rgba(0,0,0,.24);
}
html[data-theme="ocean"] .panel-item { background: #103552; }
html[data-theme="ocean"] .panel-item:hover { background: #174564; }
html[data-theme="ocean"] .danger-button { background: rgba(255,143,157,.08); }

/* ---------- desk pet ---------- */
.desk-pet-stage {
  position: relative; overflow: hidden; text-align: center;
  padding: 28px 20px 24px; border: 1px solid var(--line); border-radius: 26px;
  background:
    radial-gradient(circle at 50% 22%, rgba(108, 190, 255, .2), transparent 55%),
    var(--panel);
  box-shadow: 0 18px 50px rgba(45, 112, 166, .1);
}
.desk-pet-glow {
  position: absolute; left: 50%; top: 94px; width: 160px; height: 160px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 183, 255, .28), transparent 68%);
  filter: blur(8px); animation: desk-glow 2.8s ease-in-out infinite;
}
.desk-pet {
  position: relative; width: 154px; height: 170px; margin: 0 auto 12px;
  animation: desk-bob 2.6s ease-in-out infinite;
}
.desk-pet-girl { display: block; width: 100%; height: 100%; filter: drop-shadow(0 14px 24px rgba(0, 18, 36, .28)); }
.desk-pet-body {
  position: absolute; left: 10px; right: 10px; bottom: 4px; height: 92px;
  display: block; border-radius: 46% 46% 42% 42%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--pet-body, #9ddbff) 35%, white), var(--pet-body, #9ddbff));
  border: 2px solid rgba(255,255,255,.75);
  box-shadow: inset -8px -10px 18px rgba(26, 111, 183, .14), 0 14px 26px rgba(45,112,166,.18);
}
.desk-pet-eye {
  position: absolute; top: 35px; width: 10px; height: 13px; border-radius: 50%;
  background: #173e5d; animation: desk-blink 4s infinite;
}
.desk-pet-eye.left { left: 35px; }
.desk-pet-eye.right { right: 35px; }
.desk-pet-mouth {
  position: absolute; left: 50%; top: 54px; width: 13px; height: 7px;
  transform: translateX(-50%); border-bottom: 2px solid #173e5d; border-radius: 0 0 9px 9px;
}
.desk-pet-cheek {
  position: absolute; top: 52px; width: 16px; height: 8px; border-radius: 50%;
  background: rgba(255, 143, 167, .42);
}
.desk-pet-cheek.left { left: 20px; }
.desk-pet-cheek.right { right: 20px; }
.desk-pet-flame {
  position: absolute; left: 50%; top: -17px; width: 25px; height: 34px;
  transform: translateX(-50%) rotate(-3deg);
  border-radius: 55% 55% 48% 48%;
  background: linear-gradient(180deg, #fff6b8, var(--pet-accent, #78cbff) 78%);
  box-shadow: 0 0 22px color-mix(in srgb, var(--pet-accent, #78cbff) 70%, transparent);
  animation: desk-flame 1.5s ease-in-out infinite;
}
.desk-pet-copy { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.desk-pet-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.desk-pet-actions .pet-search { padding: 11px 22px; }
.desk-pet-tips { display: grid; gap: 4px; margin-top: 18px; color: var(--faint); font-size: 10.5px; line-height: 1.8; }
.desk-pet-tips p { margin: 0; }
.desk-pet-config {
  margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); display: grid; gap: 10px;
}
.desk-pet-config .pet-collection-title { margin: 0 0 4px; }
.pet-field { display: grid; gap: 5px; color: var(--faint); font-size: 10px; }
.pet-field input, .pet-field select, .pet-field textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 8px 10px; font-size: 12px;
}
.pet-field textarea { resize: vertical; line-height: 1.7; }
.pet-field input[type="color"] { height: 36px; padding: 3px; }
.pet-field input[type="range"] { padding: 0; }
.pet-color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.desk-pet-config-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.desk-pet-config-actions button { flex: 1; min-width: 100px; }
.roundtable-field { display: grid; gap: 6px; color: var(--faint); font-size: 10px; margin: 10px 0; }
.roundtable-field textarea, .roundtable-field select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 9px 10px; font-size: 12px;
}
.roundtable-field textarea { resize: vertical; line-height: 1.7; }
.roundtable-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.roundtable-transcript { display: grid; gap: 9px; margin-top: 14px; }
.roundtable-turn { padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); }
.roundtable-turn strong { display: block; color: var(--amber-soft); font-size: 10px; font-weight: 500; margin-bottom: 5px; }
.roundtable-turn p { margin: 0; white-space: pre-wrap; color: var(--text); font-size: 12px; line-height: 1.8; }
@media (max-width: 600px) { .roundtable-roles { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .pet-color-row { grid-template-columns: 1fr; } }
@keyframes desk-bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
@keyframes desk-glitch { 0%, 100% { filter: none; } 50% { filter: hue-rotate(12deg); } }
@keyframes desk-glow { 0%, 100% { opacity: .7; transform: translate(-50%, -50%) scale(.95); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }
@keyframes desk-blink { 0%, 44%, 48%, 100% { transform: scaleY(1); } 46% { transform: scaleY(.12); } }
@keyframes desk-flame { 0%, 100% { transform: translateX(-50%) rotate(-3deg) scale(1); } 50% { transform: translateX(-50%) rotate(3deg) scale(1.06); } }
@media (max-width: 760px) {
  .desk-pet-tips { text-align: left; }
}



.diary-panel { margin: 18px 0 22px; padding: 16px; border: 1px solid var(--line, rgba(180,220,255,.18)); border-radius: 18px; background: var(--panel, rgba(10,30,50,.55)); }
.diary-panel .rail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.diary-actions { display: flex; gap: 10px; }
.diary-list { display: grid; gap: 10px; margin-top: 10px; }
.diary-entry { padding: 12px 14px; border-radius: 14px; background: rgba(120,190,255,.08); }
.diary-entry strong { display: block; margin-bottom: 6px; color: var(--accent, #8fdcff); font-size: 13px; }
.diary-entry p { margin: 0; line-height: 1.7; white-space: pre-wrap; }

.usage-box { display: grid; gap: 10px; }
.usage-total { padding: 12px 14px; border-radius: 14px; background: var(--panel-2); color: var(--text); font-size: 16px; }
.usage-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0; }
.usage-warning { color: var(--danger); font-size: 12px; line-height: 1.7; margin: 0; }
.usage-models { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.usage-budget-label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; }
.usage-budget-label input { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-soft); color: var(--text); padding: 9px 11px; font-size: 12px; }

.account-recovery-title { margin: 14px 0 8px; color: var(--amber-soft); font-size: 13px; font-weight: 600; }
.account-recovery-line { margin: 6px 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-all; }

.model-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.model-presets .setting-action { margin: 0; }
