/* 电波街设计规范：白天手绘 (#EFEDE6/#F8F6EF/#33302C/#E07E52) + 夜城霓虹 (#0B1230/#38E1D6/#FF3D9A) */
@font-face {
  font-family: "ZCOOL KuaiLe";
  src: url("/fonts/zcool-kuaile.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("/fonts/noto-sans-sc.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Fusion Pixel";
  src: url("/fonts/fusion-pixel-12px.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #EFEDE6;
  --card: #F8F6EF;
  --ink: #33302C;
  --ink-on-accent: #33302C;
  --muted: #6B665E;
  --accent: #E07E52;
  --link: #A84A24;
  --border: #33302C;
  --dash: #B8B3A8;
  --shadow: rgba(51, 48, 44, 0.12);
  --bubble-ai: #EFEDE6;
  --bubble-user: #E07E52;
  --bubble-user-border: #33302C;
  --input-bg: #EFEDE6;
  --btn-ink-bg: #33302C;
  --btn-ink-fg: #F8F6EF;
  --radio-glow: none;
  --r1: 20px 26px 22px 18px / 22px 18px 26px 20px;
  --r2: 24px 18px 20px 26px / 18px 24px 22px 20px;
  --r3: 18px 22px 17px 21px / 21px 17px 22px 18px;
  --font-title: "ZCOOL KuaiLe", "Noto Sans SC", "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", -apple-system, sans-serif;
}

:root[data-theme="neon"] {
  --bg: #0B1230;
  --card: #131C46;
  --ink: #ECEAF6;
  --ink-on-accent: #0B1230;
  --muted: #A4B0D0;
  --accent: #38E1D6;
  --link: #38E1D6;
  --border: #33407A;
  --dash: #33407A;
  --shadow: rgba(0, 0, 0, 0.45);
  --bubble-ai: #172252;
  --bubble-user: #231845;
  --bubble-user-border: #FF3D9A;
  --input-bg: #0E163B;
  --btn-ink-bg: #38E1D6;
  --btn-ink-fg: #0B1230;
  --radio-glow: drop-shadow(0 0 8px rgba(56, 225, 214, 0.45));
}

:root[data-theme="neon-pink"] {
  --bg: #120B2A;
  --card: #1C1338;
  --ink: #F3ECFA;
  --ink-on-accent: #120B2A;
  --muted: #B6A8CE;
  --accent: #FF5FA8;
  --link: #FF5FA8;
  --border: #3A2A63;
  --dash: #3A2A63;
  --shadow: rgba(0, 0, 0, 0.45);
  --bubble-ai: #1C1338;
  --bubble-user: #251748;
  --bubble-user-border: #FF5FA8;
  --input-bg: #150E30;
  --btn-ink-bg: #FF5FA8;
  --btn-ink-fg: #120B2A;
  --radio-glow: drop-shadow(0 0 8px rgba(255, 95, 168, 0.45));
}
:root[data-theme="neon-pink"] .msg-group.assistant .bubble { border-color: #38E1D6; }
:root[data-theme="neon-pink"] .msg-group.user .bubble { color: var(--ink); }

:root[data-theme="pixel"] {
  --bg: #2A2622;
  --card: #36312C;
  --ink: #F2E8D8;
  --ink-on-accent: #2A2622;
  --muted: #C2B5A2;
  --accent: #F4A58A;
  --link: #6FC7C0;
  --border: #D9B98A;
  --dash: #8C7D68;
  --shadow: rgba(0, 0, 0, 0.55);
  --bubble-ai: #322D28;
  --bubble-user: #453830;
  --bubble-user-border: #F4A58A;
  --input-bg: #24201C;
  --btn-ink-bg: #F4A58A;
  --btn-ink-fg: #2A2622;
  --radio-glow: none;
  --r1: 0px;
  --r2: 0px;
  --r3: 0px;
  --font-title: "Fusion Pixel", "Noto Sans SC", monospace;
}
:root[data-theme="pixel"] .msg-group.user .bubble { color: var(--ink); }
:root[data-theme="pixel"] .card,
:root[data-theme="pixel"] .btn,
:root[data-theme="pixel"] .bubble { border-radius: 0 !important; }
:root[data-theme="pixel"] .btn { font-family: var(--font-title); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 400;
  margin: 0;
  line-height: 1.3;
}
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }
.muted { color: var(--muted); }
.muted-on-accent { color: var(--ink-on-accent); opacity: 0.85; font-size: 14px; }
.small-text { font-size: 13px; }
.field-label { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 24px 28px;
  gap: 28px;
  max-width: 1360px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  flex: 0 0 186px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.brand-radio, .companion-figure {
  filter: var(--radio-glow);
}
.brand-title {
  font-family: var(--font-title);
  font-size: 26px;
  line-height: 1.15;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-btn {
  text-align: left;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--r3);
  cursor: pointer;
  min-height: 44px;
}
.nav-btn:hover { color: var(--link); }
.nav-btn[aria-current="page"] {
  background: var(--card);
  border-color: var(--border);
  font-weight: 700;
  box-shadow: 2px 3px 0 var(--shadow);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.theme-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}
.user-chip {
  padding: 8px 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--r3);
  font-size: 13px;
  word-break: break-word;
}

/* Main */
.main-area {
  flex: 1 1 auto;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--r1);
  box-shadow: 3px 4px 0 var(--shadow);
  padding: 20px;
}
.dashed-card, .dashed-box {
  border: 2px dashed var(--border);
  border-radius: var(--r2);
  padding: 14px 16px;
  background: var(--card);
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.page-stack { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-actions select { width: auto; padding: 6px 12px; font-size: 14px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { flex: 1 1 auto; min-width: 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.list-stack { display: flex; flex-direction: column; gap: 10px; }
.dotted { border: 0; border-top: 2px dotted var(--dash); margin: 4px 0; }

/* Inputs & Buttons */
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
label.check-row { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], input:not([type]), textarea, select {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--r3);
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  min-height: 44px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover:not(:disabled) { box-shadow: 2px 3px 0 var(--shadow); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--ink-on-accent); font-weight: 700; }
.btn.ink-btn { background: var(--btn-ink-bg); color: var(--btn-ink-fg); font-weight: 700; }
.btn.ghost { border-color: var(--dash); color: var(--muted); }
.btn.danger { border-color: var(--link); color: var(--link); }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.btn.tiny { min-height: 28px; padding: 2px 9px; font-size: 12px; }

/* The personal page and actual management console are separate surfaces. */
.admin-nav-entry { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.me-view-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--dash);
}
.me-view-switch .btn { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.admin-page-title { gap: 4px; }
.admin-section-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--dash);
}
.admin-section-nav .btn {
  min-width: 0;
  min-height: 42px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.admin-section, #me-admin-view, #admin-panel, #admin-owner-controls { min-width: 0; }
.admin-section h3, .admin-section p, #admin-load-status { overflow-wrap: anywhere; }
.admin-section + .admin-section { margin-top: 2px; }
.admin-refresh-row { min-height: 44px; }
.provider-capability { min-width: 0; gap: 8px; }
.provider-capability > h4 { margin: 4px 0 0; }
/* Keep geometry, but do not display the old owner's loaded metadata while
   the returning tab is checking its session. Local edits remain editable. */
#admin-panel[data-auth-unverified] .admin-section { visibility: hidden; }
#admin-panel[data-auth-unverified] .admin-section > h3,
#admin-panel[data-auth-unverified] #admin-provider-controls form,
#admin-panel[data-auth-unverified] #admin-provider-controls > .dashed-box > strong,
#admin-panel[data-auth-unverified] #admin-provider-controls .provider-capability > h4,
#admin-panel[data-auth-unverified] #admin-provider-controls .provider-capability > .dashed-box > strong,
#admin-panel[data-auth-unverified] .admin-section [data-admin-draft] { visibility: visible; }
@media (max-width: 900px) {
  .nav-list:has(#btn-open-admin:not([hidden])) { flex-wrap: wrap; overflow-x: visible; }
  .admin-section-nav { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
}

/* Auth & Onboarding */
.auth-wrap {
  max-width: 680px;
  margin: 24px auto;
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tab-strip { display: flex; gap: 10px; margin-bottom: 14px; }
.tab-pill {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
}
.tab-pill.active { background: var(--accent); color: var(--ink-on-accent); font-weight: 700; }

.role-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.role-option {
  text-align: left;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--r2);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
}
.role-option.selected {
  background: var(--accent);
  color: var(--ink-on-accent);
  box-shadow: 2px 3px 0 var(--shadow);
}

/* Home Split Layout (House + Chat) */
.home-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(340px, 1fr);
  gap: 22px;
  align-items: start;
}
.home-left { display: flex; flex-direction: column; gap: 16px; }
.house-card { display: flex; flex-direction: column; gap: 12px; border-radius: var(--r2); }
.house-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.clickable-title { cursor: pointer; }
.room-stage { width: 100%; }
.status-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--bg);
  font-size: 14px;
}
.status-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--border);
}

.weather-card { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px; min-width: 0; }
.weather-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weather-head h2 { margin: 0; font-size: 20px; }
.weather-city-name { font-size: 13px; overflow-wrap: anywhere; }
.weather-summary { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.weather-card p { margin: 0; overflow-wrap: anywhere; }
.weather-advice { font-size: 14px; }
.weather-city-panel { border-top: 1px dashed var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.weather-search-form { display: flex; flex-direction: column; gap: 5px; }
.weather-search-row { display: flex; gap: 6px; align-items: stretch; }
.weather-search-row input { flex: 1; min-width: 0; }
.weather-search-row .btn { flex: none; }
.weather-city-results { display: flex; flex-direction: column; gap: 6px; }
.weather-city-results .btn { white-space: normal; text-align: left; overflow-wrap: anywhere; }
.weather-source { font-size: 12px; }
.weather-greeting { border-top: 1px dashed var(--border); padding-top: 8px; font-size: 14px; line-height: 1.5; }
.weather-card [hidden] { display: none !important; }

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.shortcut-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  padding: 15px 16px;
}
.shortcut-card:nth-child(even) { border-radius: var(--r2); }
.shortcut-card.accent-card {
  background: var(--accent);
  color: var(--ink-on-accent);
}
.shortcut-title { font-family: var(--font-title); font-size: 21px; }
.shortcut-main { font-size: 15px; font-weight: 600; }

/* Chat Column */
.chat-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 620px;
  max-height: calc(100vh - 56px);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-head-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.companion-name-row { min-width: 0; }
.companion-name-row h1, .companion-name-row h2 { min-width: 0; overflow-wrap: anywhere; }
#home-avatar-slot, #ours-avatar-slot, #companion-avatar-panel { min-width: 0; }
#home-avatar-panel .media-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
}

.msg-group { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.msg-group.user { align-self: flex-end; align-items: flex-end; }
.msg-group.assistant { align-self: flex-start; align-items: flex-start; }

.bubble {
  padding: 11px 15px;
  border: 2px solid var(--border);
  border-radius: var(--r1);
  background: var(--bubble-ai);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-group.user .bubble {
  background: var(--bubble-user);
  border-color: var(--bubble-user-border);
  color: var(--ink-on-accent);
  border-radius: var(--r2);
}
:root[data-theme="neon"] .msg-group.user .bubble {
  color: var(--ink);
}

.msg-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  opacity: 0.15;
  transition: opacity 0.15s;
}
.msg-group:hover .msg-actions, .msg-group:focus-within .msg-actions {
  opacity: 1;
}

.chat-composer {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-composer .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}
.plus-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}
.plus-drawer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 2px dotted var(--dash);
}

/* Knobs & Lists */
.knob-rows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.knob-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 10px; align-items: center; font-size: 14px; }
.example-box { padding: 8px 12px; border: 2px dashed var(--dash); border-radius: var(--r3); background: var(--bg); font-size: 14px; margin-bottom: 8px; }
.msg-highlight { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--r2); }
.confirm-strip { margin-top: 10px; padding-top: 10px; border-top: 2px dotted var(--dash); display: flex; flex-direction: column; gap: 8px; }

.list-item {
  padding: 10px 12px;
  border: 2px dotted var(--dash);
  border-radius: var(--r3);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.list-item.retired { opacity: 0.6; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat-box {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--bg);
}
.stat-box strong { display: block; font-size: 20px; margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger-table th, .ledger-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px dashed var(--dash);
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  background: var(--btn-ink-bg);
  color: var(--btn-ink-fg);
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  box-shadow: 3px 4px 0 var(--shadow);
  max-width: 380px;
}
.error-box {
  margin-top: 12px;
  padding: 10px 14px;
  border: 2px solid var(--link);
  border-radius: var(--r3);
  color: var(--link);
  font-size: 14px;
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; padding: 14px; gap: 16px; }
  .sidebar { flex: none; gap: 12px; }
  .nav-list { flex-direction: row; overflow-x: auto; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 0; }
  .home-grid { grid-template-columns: 1fr; }
  .street-grid, .split-chat-grid { grid-template-columns: 1fr !important; }
  .chat-col, .split-right { max-height: none; min-height: 460px; }
}

/* Batch 2: Street, 5 Residents, Lock-free Groups, DMs, Notifications */
.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-on-accent);
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.ai-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}
.mention-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  background: #FFD84D;
  color: #33302C;
  border: 1.5px solid var(--border);
  margin-right: 6px;
}
.street-top { flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.street-subtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.street-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}
.street-filter-bar { flex-wrap: wrap; gap: 10px; }
.post-card { gap: 10px; }
.post-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.author-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline dotted var(--dash);
}
.author-link:hover { color: var(--link); }
.post-content { white-space: pre-wrap; word-break: break-word; font-size: 15.5px; line-height: 1.7; }
.post-comments {
  border-top: 2px dashed var(--dash);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-row {
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 14px;
}
.split-chat-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  min-height: 620px;
}
.split-left { max-height: calc(100vh - 170px); overflow-y: auto; }
.split-right {
  min-height: 600px;
  max-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
}
.split-right .chat-messages { flex: 1; min-height: 220px; }
.thread-card {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-bottom: 1.5px dashed var(--dash);
  border-radius: var(--r3);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.thread-card:hover { background: var(--bg); }
.thread-card.active {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: 2px 3px 0 var(--shadow);
}
.notif-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 2px dotted var(--dash);
  border-radius: var(--r3);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.notif-item.unread {
  border-style: solid;
  border-color: var(--border);
  background: var(--bg);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 14, 18, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: min(620px, 100%);
  max-height: 85vh;
  overflow-y: auto;
}

/* Batch 3: Lamp 4x4 Circuit Board, Badges & Rules */
.lamp-board {
  display: grid;
  grid-template-columns: repeat(4, 68px);
  gap: 8px;
  justify-content: start;
  padding: 10px 0;
}
.lamp-tile {
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.lamp-tile.lit {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
}
.lamp-tile .tile-tag {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--ink-on-accent);
  top: 2px;
  left: 3px;
}
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 2px dotted var(--dash);
  border-radius: var(--r3);
  font-size: 13px;
  opacity: 0.55;
}
.badge-chip.earned {
  border-style: solid;
  border-color: var(--border);
  background: var(--accent);
  color: var(--ink-on-accent);
  font-weight: 700;
  opacity: 1;
}
.rules-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}

/* Batch 5: Multimedia Studio, Portraits & Feed Media */
.companion-portrait-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.companion-portrait {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: var(--r2);
  border: 2.5px solid var(--border);
  box-shadow: 3px 3px 0 var(--border);
  background: var(--bg);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.media-thumb-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--bg);
}
.media-thumb-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.media-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--border);
}
.post-media-img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: var(--r3);
  border: 2px solid var(--border);
  background: var(--bg);
}
.post-media-audio {
  width: 100%;
  max-width: 420px;
}

/* Batch 6: Restored Hand-Drawn Avatar Cards, RC-01 Rich Role Cards, Toggle Rows & Lamp I/O */
.avatar-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}
.avatar-card svg,
.avatar-card img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 10px;
}
.avatar-card.selected {
  background: var(--accent);
  color: var(--ink-on-accent);
  font-weight: 700;
  box-shadow: 2px 3px 0 var(--shadow);
}
.avatar-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
  flex-shrink: 0;
  vertical-align: middle;
}
.avatar-mini svg,
.avatar-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-crop-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 2px dashed var(--dash);
  border-radius: var(--r3);
  background: var(--bg);
}
.avatar-crop-canvas {
  width: 160px;
  height: 160px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--card);
}
.role-card-rich {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--r3);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  min-width: 0;
}
.role-card-rich.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.role-card-rich dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  font-size: 13px;
}
.role-card-rich dt { font-weight: 700; color: var(--muted); white-space: nowrap; }
.role-card-rich dd { margin: 0; word-break: break-word; }
.role-card-example {
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  background: var(--card);
  font-size: 13px;
  border-radius: 6px;
}
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px dotted var(--dash);
  border-radius: var(--r3);
  background: var(--bg);
}
.lamp-io-hint {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--link);
  max-width: 296px;
}
@media (max-width: 480px) {
  .role-card-grid, .grid-2, .two-col { grid-template-columns: 1fr !important; }
  .avatar-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
