@font-face {
  font-family: "DotGothic16";
  src: url("./fonts/DotGothic16-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0b0b0b;
  --surface-2: #101010;
  --surface-3: #161616;
  --ink: #f5f5f5;
  --muted: #c8c8c8;
  --line: rgba(255, 255, 255, 0.18);
  --green: #ffffff;
  --green-2: #111111;
  --coral: #d8d8d8;
  --amber: #3e2b58;
  --violet: #5a4276;
  --gold: #3e2b58;
  --gold-2: #5a4276;
  --bright-gold: #6d568c;
  --royal-gold: #493463;
  --black-lacquer: #050505;
  --calligraphy-font:
    "HanziPen SC", "Hannotate SC", "Kaiti SC",
    "STKaiti", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho",
    "HGP\884C\66F8\4F53", "HG\884C\66F8\4F53", "Kozuka Mincho Pro",
    "Noto Serif CJK JP", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --nav-calligraphy: var(--calligraphy-font);
  --ui-font:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: var(--ui-font);
  -webkit-tap-highlight-color: rgba(213, 173, 100, 0.18);
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.schedule-row div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.schedule-row span,
.schedule-row small {
  overflow-wrap: anywhere;
}

.schedule-row small {
  color: var(--muted);
}

.intel-list,
.diary-list,
.call-list,
.call-stream {
  display: grid;
  gap: 10px;
}

.intel-row,
.diary-entry,
.call-message,
.call-tab {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
  padding: 12px;
}

.intel-row,
.call-tab {
  display: grid;
  gap: 4px;
  text-align: left;
  color: var(--ink);
  font-family: var(--calligraphy-font);
}

.intel-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.intel-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.call-tab {
  width: 100%;
  cursor: pointer;
}

.call-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.call-current,
.call-record {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(18, 10, 10, 0.5);
}

.call-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.call-current b,
.call-record-head b {
  display: block;
  color: var(--gold-2);
}

.call-current small,
.call-record-head small,
.call-record-meta {
  color: var(--muted);
}

.call-current.ended,
.call-record.ended {
  opacity: 0.82;
}

.call-record.expanded {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(30, 14, 12, 0.72);
}

.call-record-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: var(--calligraphy-font);
}

.call-record-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.call-record-preview {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.call-tab.active {
  border-color: rgba(228, 91, 67, 0.72);
  background: rgba(94, 20, 22, 0.5);
}

.intel-row span,
.diary-entry p,
.call-message p {
  overflow-wrap: anywhere;
}

.autonomy-book {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.autonomy-page {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 0;
  align-self: start;
  padding: 16px 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(95, 54, 31, 0.16), transparent 18px),
    linear-gradient(180deg, rgba(252, 238, 190, 0.92), rgba(218, 190, 126, 0.82));
  color: #231512;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 218, 0.34), 0 10px 22px rgba(0, 0, 0, 0.22);
}

.autonomy-page-detail {
  display: grid;
  gap: 8px;
}

.autonomy-page-detail[open] {
  min-height: 190px;
}

.autonomy-page-detail summary {
  position: relative;
  display: grid;
  gap: 7px;
  padding-right: 42px;
  cursor: pointer;
  list-style: none;
}

.autonomy-page-detail summary::-webkit-details-marker {
  display: none;
}

.autonomy-page-detail summary::after {
  content: "展开";
  position: absolute;
  top: 0;
  right: 0;
  color: rgba(35, 21, 18, 0.56);
  font-size: 11px;
  font-weight: 900;
}

.autonomy-page-detail[open] summary::after {
  content: "收起";
}

.autonomy-page-preview {
  display: -webkit-box;
  max-height: 4.9em;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  color: rgba(35, 21, 18, 0.72);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.autonomy-page-detail[open] .autonomy-page-preview {
  display: none;
}

.autonomy-page-body {
  display: grid;
  gap: 8px;
}

.autonomy-page::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(95, 54, 31, 0.18);
  pointer-events: none;
}

.autonomy-page header,
.autonomy-page footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(35, 21, 18, 0.68);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.autonomy-page h4 {
  margin: 0;
  color: #3a1f18;
  font-size: 17px;
}

.autonomy-page p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
}

.autonomy-page-meta {
  color: rgba(35, 21, 18, 0.62);
}

.autonomy-page.is-withdrawn {
  opacity: 0.68;
  filter: saturate(0.75);
}

.judgment-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 7px;
  width: 100%;
}

.judgment-scores span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 5px 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(18, 10, 10, 0.34);
}

.judgment-scores b {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.judgment-scores i {
  grid-column: 1 / -1;
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.judgment-scores em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}

.judgment-scores small {
  color: var(--gold-2);
  font-size: 11px;
  text-align: right;
}

.intel-row small,
.diary-entry small,
.call-message b small,
.call-tab small {
  color: var(--muted);
}

.call-message b {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.call-message b small {
  font-size: 11px;
  font-weight: 700;
}

.diary-entry header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.diary-entry header span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.diary-entry p,
.call-message p {
  margin: 8px 0 0;
  line-height: 1.65;
}

.diary-entry-detail .phase-log-body p {
  margin: 0;
  white-space: pre-wrap;
}

.call-message.user {
  border-color: rgba(201, 154, 71, 0.42);
}

.call-message.assistant {
  border-color: rgba(183, 42, 47, 0.5);
}

.call-message audio {
  width: 100%;
  margin-top: 8px;
}

.phase-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.phase-log-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.phase-head h3,
.phase-log-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.phase-card,
.phase-log {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
  padding: 12px;
}

.phase-log-list {
  display: grid;
  gap: 10px;
}

.phase-log {
  display: grid;
  gap: 4px;
  touch-action: manipulation;
  cursor: default;
}

.phase-log[data-phase-log-id] {
  cursor: context-menu;
}

.phase-log span {
  overflow-wrap: anywhere;
}

.phase-log-detail {
  display: block;
}

.phase-log-detail summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 5px 10px;
  align-items: start;
  cursor: pointer;
  list-style: none;
  color: rgba(246, 232, 206, 0.88);
}

.phase-log-detail summary::-webkit-details-marker {
  display: none;
}

.phase-log-detail summary::after {
  content: "展开";
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.phase-log-detail[open] summary::after {
  content: "收起";
}

.phase-log-detail summary > b {
  min-width: 0;
}

.phase-log-detail summary > small {
  grid-column: 1 / -1;
}

.phase-log-preview {
  display: -webkit-box;
  grid-column: 1 / -1;
  max-height: 4.9em;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.6;
}

.phase-log-body {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.phase-log-body > span {
  white-space: pre-wrap;
}

.archive-region {
  display: grid;
  gap: 8px;
}

.archive-region + .archive-region {
  margin-top: 12px;
}

.archive-region-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.archive-region-head h4 {
  margin: 0;
  color: var(--gold-2);
  font-size: 14px;
}

.archive-region-list {
  grid-template-columns: repeat(auto-fill, 46px);
  align-items: start;
}

.archive-item {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.archive-crest-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid rgba(245, 200, 95, 0.72);
  background: linear-gradient(145deg, #050303, #130b08);
  box-shadow: inset 0 0 0 1px rgba(255, 228, 163, 0.08), 0 8px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.archive-crest-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid rgba(245, 200, 95, 0.72);
  box-shadow: inset 0 0 0 1px rgba(35, 19, 12, 0.22);
  pointer-events: none;
}

.archive-crest-tile:hover,
.archive-crest-tile:focus-visible {
  border-color: var(--bright-gold);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 228, 163, 0.22), 0 0 0 3px rgba(245, 200, 95, 0.18);
}

.archive-item.expanded {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(18, 10, 10, 0.72);
}

.archive-item.expanded .phase-log-body {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.archive-item.expanded .phase-log-body > b {
  color: var(--gold-2);
  overflow-wrap: anywhere;
}

.phase-log small {
  color: var(--muted);
}

.phase-emotion-box {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.phase-emotion-head {
  display: grid;
  gap: 3px;
}

.phase-emotion-head small {
  color: var(--muted);
}

.phase-emotion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.phase-emotion-item {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 2, 2, 0.28);
}

.phase-emotion-item > span {
  color: var(--gold-2);
  font-weight: 800;
}

.emotion-preview {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.emotion-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.phase-emotion-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.worldbook-list {
  display: grid;
  gap: 12px;
}

.worldbook-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.proactive-call-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.proactive-call-box h3 {
  margin: 0;
  font-size: 1rem;
}

.storage-view.active {
  display: grid;
  gap: 16px;
}

.storage-summary,
.storage-actions,
.storage-breakdown,
.privacy-summary,
.backup-actions {
  display: grid;
  gap: 10px;
}

.backup-panel {
  align-content: start;
}

.file-pick {
  position: relative;
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(9, 6, 6, 0.6);
  color: var(--gold-2);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.file-pick input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.storage-total {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.storage-total b {
  color: var(--gold-2);
  font-size: 1.8rem;
}

.storage-total.compact b {
  font-size: 1.1rem;
}

.storage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.privacy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
}

.privacy-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.privacy-row span {
  color: var(--muted);
}

.privacy-clear-actions {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.mobile-report-guide {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 6, 6, 0.54);
}

.mobile-home-status {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(18, 10, 10, 0.46);
}

.mobile-home-status b {
  color: var(--gold-2);
}

.mobile-home-status span {
  color: var(--muted);
}

.mobile-report-guide-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.mobile-report-guide span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mobile-report-guide code,
.mobile-report-guide pre {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mobile-report-guide pre {
  max-height: 180px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--gold-2);
  background: rgba(0, 0, 0, 0.34);
}

.storage-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.storage-row span,
.storage-total small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.storage-row strong {
  color: var(--gold-2);
}

.storage-row i {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-2) var(--fill), rgba(255, 255, 255, 0.08) var(--fill));
}

.incoming-call-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 2, 2, 0.72);
  backdrop-filter: blur(8px);
}

.incoming-call-modal.hidden {
  display: none;
}

.incoming-call-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: radial-gradient(circle at top, rgba(124, 23, 26, 0.92), rgba(13, 8, 8, 0.96) 58%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.incoming-call-mark {
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.incoming-call-card h3,
.incoming-call-card p,
.incoming-call-card blockquote {
  margin: 0;
}

.incoming-call-card blockquote {
  padding: 12px;
  border-left: 3px solid var(--red-2);
  background: rgba(0, 0, 0, 0.24);
  line-height: 1.6;
}

.sync-health {
  display: grid;
  gap: 8px;
}

.sync-health-panel {
  align-content: start;
}

.sync-actions {
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sync-actions button {
  flex: 1 1 120px;
}

.sync-empty,
.sync-meta,
.sync-head,
.sync-row {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(18, 10, 10, 0.52);
  padding: 10px 12px;
}

.sync-empty {
  color: var(--muted);
  line-height: 1.6;
}

.sync-empty.error {
  color: var(--coral);
}

.sync-meta {
  display: grid;
  gap: 4px;
}

.sync-meta b {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.sync-meta small {
  color: var(--muted);
}

.sync-head,
.sync-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(56px, auto) minmax(64px, auto) minmax(54px, auto);
  gap: 10px;
  align-items: center;
}

.sync-head {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.sync-row span,
.sync-row b,
.sync-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sync-row b {
  font-size: 0.86rem;
}

.sync-row small {
  justify-self: end;
  color: var(--gold-2);
}

.sync-row.warn {
  border-color: rgba(228, 91, 67, 0.55);
}

.sync-row.warn small {
  color: var(--coral);
}

@media (display-mode: standalone) {
  .topbar {
    padding-top: max(18px, env(safe-area-inset-top));
  }
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  background:
    linear-gradient(90deg, rgba(8, 5, 5, 0.96), rgba(28, 12, 12, 0.92)),
    url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2366382d' stroke-width='1' opacity='.38'%3E%3Cpath d='M0 40c20 20 40 20 60 0s40-20 60 0 40 20 60 0M0 80c20 20 40 20 60 0s40-20 60 0 40 20 60 0M0 120c20 20 40 20 60 0s40-20 60 0 40 20 60 0'/%3E%3Cpath d='M30 0v180M90 0v180M150 0v180' opacity='.25'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--calligraphy-font);
}

button,
input,
textarea,
select {
  font: inherit;
}

input,
textarea,
select {
  font-family: var(--ui-font);
  font-size: 16px;
}

code,
pre,
kbd,
samp,
.tool-feed,
.tool-event,
.tool-card,
.tool-note,
.runtime-summary,
.permission-grid,
.workflow-steps,
.sync-health,
.sync-empty,
.sync-meta,
.sync-head,
.sync-row,
.storage-summary,
.storage-actions,
.storage-breakdown,
.privacy-summary,
.privacy-row,
.storage-total,
.storage-row,
.connection-test,
.model-pick-row,
.context-preview,
.pill,
.metric {
  font-family: var(--ui-font);
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(10, 6, 6, 0.97), rgba(35, 15, 14, 0.94)),
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23a83a33' stroke-width='1' opacity='.22'%3E%3Cpath d='M0 0h80v80H0zM40 0v80M0 40h80'/%3E%3Ccircle cx='40' cy='40' r='18'/%3E%3C/g%3E%3C/svg%3E");
  backdrop-filter: blur(18px);
}

.brand,
.brand-main,
.thread,
.sidebar-footer,
.panel-head,
.topbar,
.composer,
.memory-header,
.button-row,
.memory-actions,
.top-actions,
.persona-controls {
  display: flex;
  align-items: center;
}

.brand {
  justify-content: space-between;
  gap: 12px;
}

.sidebar,
.brand,
.nav-item,
.thread,
.thread-create-icon,
.section-kicker,
.sidebar-settings,
.top-kamon {
  font-family: var(--nav-calligraphy);
}

.brand-main {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0;
  border: 0 !important;
  outline: 0 !important;
  background: transparent;
  color: #050202;
  box-shadow: none !important;
  overflow: hidden;
}

.oda-mon {
  display: block;
  width: 100%;
  height: 100%;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  object-fit: contain;
}

.brand strong,
.thread b,
.panel h2,
.topbar h1,
.memory-header h2 {
  display: block;
  margin: 0;
}

.brand span,
.thread small,
.topbar p,
.memory-header p,
.section-kicker {
  color: var(--muted);
}

.brand strong {
  color: var(--gold-2);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.nav-section,
.nav-stack {
  display: grid;
}

.nav-section {
  gap: 9px;
  min-height: 0;
}

.nav-stack {
  gap: 8px;
}

.nav-item,
.thread,
.thread-create-icon,
.icon-button,
.ghost-button,
.primary-button,
.text-button,
.composer-tools button,
.send-button,
.search-bar button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
}

.nav-item span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(213, 173, 100, 0.25);
  background: var(--black-lacquer);
  color: var(--gold-2);
}

.nav-item.active,
.thread.active {
  border-color: rgba(213, 173, 100, 0.5);
  background: linear-gradient(90deg, rgba(128, 24, 27, 0.72), rgba(53, 19, 19, 0.88));
  box-shadow: inset 3px 0 0 var(--gold);
}

.thread-create-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-color: rgba(213, 173, 100, 0.38);
  background: var(--black-lacquer);
  color: var(--gold-2);
  font-size: 20px;
  line-height: 1;
}

.conversation-list {
  display: grid;
  gap: 9px;
  min-height: 0;
}

.section-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.thread {
  gap: 10px;
  width: 100%;
  padding: 11px;
  text-align: left;
}

.thread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  flex: 0 0 auto;
}

.thread-dot.coral {
  background: var(--coral);
}

.thread-dot.violet {
  background: var(--violet);
}

.sidebar-footer {
  justify-content: space-between;
  margin-top: auto;
  gap: 10px;
}

.sidebar-settings {
  flex: 0 0 auto;
}

.pill,
.metric {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.pill.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.metric {
  background: rgba(213, 173, 100, 0.14);
  color: var(--gold-2);
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: block;
  position: relative;
  margin-bottom: 18px;
}

.top-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-right: 96px;
}

.top-crest-button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  cursor: pointer;
  background: #030101;
  border: 2px solid rgba(255, 228, 163, 0.9);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 2px rgba(3, 1, 1, 0.9),
    0 0 18px rgba(245, 200, 95, 0.18),
    0 12px 34px rgba(0, 0, 0, 0.42);
}

.top-crest-button:focus-visible {
  outline: 2px solid var(--bright-gold);
  outline-offset: 3px;
}

.mobile-rail-toggle {
  display: none;
}

.top-crest {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar h1 {
  font-size: 30px;
  color: var(--gold-2);
  letter-spacing: 0.03em;
}

.topbar p {
  margin: 4px 0 0;
}

.top-kamon {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 24px;
  width: fit-content;
  margin-bottom: 6px;
  padding: 0 9px;
  border: 1px solid rgba(213, 173, 100, 0.38);
  border-radius: 999px;
  background: rgba(183, 42, 47, 0.18);
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.top-actions,
.button-row,
.memory-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions {
  flex-wrap: wrap;
  margin-top: 6px;
}

.ghost-button,
.primary-button,
.text-button,
.icon-button {
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
}

.button-row {
  margin-top: 10px;
}

.panel > .button-row,
.panel > .primary-button,
.panel > .ghost-button {
  margin-top: 14px;
}

.panel-head .primary-button,
.panel-head .ghost-button,
.panel-head .text-button {
  margin-top: 0;
}

.life-view .button-row,
.life-view .panel > .primary-button,
.life-view .panel > .ghost-button {
  margin-top: 16px;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.primary-button {
  border-color: rgba(213, 173, 100, 0.4);
  background: linear-gradient(180deg, #c13a3e, #8e171c);
  color: var(--gold-2);
  box-shadow: inset 0 1px 0 rgba(255, 245, 211, 0.18);
}

.text-button {
  color: var(--gold);
}

.icon-button {
  width: 38px;
  padding: 0;
  background: var(--surface-2);
  color: var(--gold-2);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid.active {
  display: grid;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: calc(100vh - 112px);
}

.chat-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 22, 20, 0.94), rgba(24, 14, 13, 0.96)),
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d8b166' opacity='.06'%3E%3Cpath d='M0 0h1v120H0zM30 0h1v120h-1zM60 0h1v120h-1zM90 0h1v120h-1zM0 0v1h120V0zM0 30v1h120v-1zM0 60v1h120v-1zM0 90v1h120v-1z'/%3E%3C/g%3E%3C/svg%3E");
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  min-height: 640px;
  overflow: hidden;
}

.message-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  overflow: auto;
  position: relative;
}

.message-stream.empty {
  justify-content: center;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(201, 0, 23, 0.34), transparent 34%),
    linear-gradient(135deg, rgba(8, 4, 4, 0.72), rgba(50, 14, 13, 0.42));
}

.message-history-toggle {
  align-self: center;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid rgba(166, 127, 55, 0.52);
  border-radius: 999px;
  background: rgba(18, 10, 9, 0.86);
  color: rgba(244, 219, 158, 0.86);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.message-history-toggle:hover {
  border-color: rgba(255, 255, 255, 0.78);
  color: var(--gold-2);
}

.honmaru-screen {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 260px;
}

.honmaru-crest {
  width: min(300px, 64%);
  aspect-ratio: 1;
  background: transparent;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

.honmaru-crest img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.honmaru-label {
  color: var(--gold-2);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.message {
  max-width: min(720px, 92%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.message.assistant {
  align-self: flex-start;
}

.message.assistant-reply-group + .message.assistant-reply-group {
  margin-top: -8px;
}

.message.user {
  align-self: flex-end;
  background: rgba(82, 22, 20, 0.92);
  border-color: rgba(213, 173, 100, 0.32);
}

.message .role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.role-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.role-meta time {
  color: rgba(242, 220, 168, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.message-role-button,
.message-delete {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.message-role-button {
  padding: 0;
  cursor: pointer;
}

.message-role-button:hover {
  color: var(--gold-2);
}

.message-delete {
  display: none;
}

.message-action-menu {
  position: fixed;
  z-index: 80;
  min-width: 148px;
  padding: 6px;
  border: 1px solid rgba(67, 47, 94, 0.28) !important;
  border-radius: 8px;
  background: #fbfafc !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32) !important;
  color: #432f5e !important;
}

.message-action-menu.hidden {
  display: none;
}

.message-action-menu.stack {
  display: grid;
  gap: 6px;
}

.message-action-menu.stack.hidden {
  display: none;
}

.message-action-menu button {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(67, 47, 94, 0.18) !important;
  border-radius: 6px;
  background: #ffffff !important;
  color: #432f5e !important;
  font-weight: 800;
  cursor: pointer;
}

.message-action-menu button.danger-action {
  background: #ffffff !important;
  color: #432f5e !important;
}

.message-action-menu button:hover {
  background: #eee8f6 !important;
  border-color: rgba(67, 47, 94, 0.38) !important;
}

.message-action-menu button.danger-action:hover {
  background: #eee8f6 !important;
}

.message-edit-card {
  width: min(640px, calc(100vw - 32px));
}

.message-edit-card textarea {
  min-height: 220px;
  resize: vertical;
}

.message-body {
  margin: 0;
  font-size: 16px;
  line-height: 1.66;
  overflow-wrap: anywhere;
}

.message-body > *:first-child {
  margin-top: 0;
}

.message-body > *:last-child {
  margin-bottom: 0;
}

.message-body p {
  margin: 0 0 0.82em;
}

.message-body h1,
.message-body h2,
.message-body h3 {
  margin: 0.95em 0 0.45em;
  color: var(--gold-2);
  line-height: 1.28;
  letter-spacing: 0;
}

.message-body h1 {
  font-size: 20px;
}

.message-body h2 {
  font-size: 18px;
}

.message-body h3 {
  font-size: 17px;
}

.message-body ul,
.message-body ol {
  margin: 0.35em 0 0.82em;
  padding-left: 1.25em;
}

.message-body li {
  margin: 0.25em 0;
}

.message-body blockquote {
  margin: 0.7em 0;
  padding: 0.15em 0 0.15em 0.85em;
  border-left: 2px solid rgba(213, 173, 100, 0.42);
  color: rgba(246, 232, 206, 0.82);
}

.message-body strong {
  color: var(--gold-2);
  font-weight: 900;
}

.message-body em {
  color: rgba(246, 232, 206, 0.92);
}

.message-body a {
  color: var(--gold-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-body code {
  padding: 0.08em 0.32em;
  border: 1px solid rgba(213, 173, 100, 0.24);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 236, 184, 0.96);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message-body pre {
  max-width: 100%;
  margin: 0.75em 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid rgba(213, 173, 100, 0.22);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
}

.message-body pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: pre-wrap;
}

.html-artifact {
  max-width: 100%;
  margin: 0.8em 0;
  overflow: hidden;
  border: 1px solid rgba(213, 173, 100, 0.28);
  border-radius: 8px;
  background: rgba(18, 12, 10, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 236, 184, 0.08);
}

.html-artifact figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(213, 173, 100, 0.2);
  color: var(--gold-2);
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 900;
}

.html-artifact figcaption small {
  color: rgba(246, 232, 206, 0.64);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.html-artifact iframe {
  display: block;
  width: 100%;
  min-height: 320px;
  border: 0;
  background: #ffffff;
}

.html-artifact details {
  border-top: 1px solid rgba(213, 173, 100, 0.2);
}

.html-artifact summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--gold-2);
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 900;
}

.html-artifact details pre {
  max-height: 220px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.32);
}

.writing-message {
  display: inline-flex;
  align-items: flex-end;
  max-width: max-content;
  padding: 4px 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(242, 220, 168, 0.78);
}

.writing-line {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(213, 173, 100, 0.42);
  font-weight: 800;
}

.writing-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 1em;
  padding-bottom: 2px;
}

.writing-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(244, 219, 158, 0.88);
  animation: writing-dot-hop 900ms ease-in-out infinite;
}

.writing-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.writing-dots i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes writing-dot-hop {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.48;
  }

  28% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .writing-dots i {
    animation: none;
    opacity: 0.72;
  }
}

.message audio {
  width: 100%;
  margin-top: 10px;
}

.voice-message {
  min-width: min(360px, 92%);
}

.voice-bar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.48) !important;
  background: linear-gradient(90deg, rgba(8, 8, 8, 0.94), rgba(31, 31, 31, 0.9)) !important;
  color: #f7f7f7 !important;
}

.voice-play {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  background: #050505 !important;
  color: #f7f7f7 !important;
  font-weight: 900;
  cursor: pointer;
}

.voice-bar[data-playing="1"] .voice-play,
.voice-play:hover {
  background: #f4f4f4 !important;
  color: #050505 !important;
  border-color: #f4f4f4 !important;
}

.voice-bar div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.voice-bar b,
.voice-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-bar b {
  color: #ffffff !important;
}

.voice-bar span {
  color: #c8c8c8 !important;
  font-size: 12px;
}

.voice-bar audio {
  display: none;
}

.composer {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(12, 7, 7, 0.82);
}

.composer-tools {
  display: flex;
  gap: 6px;
}

.composer-tools button,
.send-button,
.search-bar button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface-2);
  color: var(--gold-2);
}

.composer textarea {
  width: 100%;
  max-height: 160px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}

.send-button {
  background: var(--black-lacquer);
  color: var(--gold-2);
}

.right-rail {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel {
  padding: 16px;
}

.panel.compact {
  min-height: 310px;
}

.panel-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 17px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.idle {
  background: var(--amber);
}

.tool-feed,
.memory-surface,
.memory-results,
.bucket-list,
.bucket-detail {
  display: grid;
  gap: 10px;
}

.tool-feed {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
  align-content: start;
}

.tool-event,
.memory-card,
.bucket-card,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 10, 10, 0.58);
  padding: 12px;
}

.tool-event b,
.memory-card b,
.bucket-card b,
.tool-card b {
  display: block;
  margin-bottom: 5px;
}

.tool-event span,
.memory-card span,
.bucket-card span,
.tool-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.inner-voice {
  display: grid;
  gap: 10px;
}

.inner-voice-panel {
  display: none;
  position: fixed;
  top: 92px;
  right: 22px;
  z-index: 40;
  width: min(360px, calc(100vw - 28px));
  max-height: min(520px, calc(100dvh - 130px));
  overflow: auto;
}

.inner-voice-open .inner-voice-panel {
  display: block;
}

.inner-card {
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(213, 173, 100, 0.12);
  padding: 11px 12px;
}

.inner-card b {
  display: block;
  margin-bottom: 5px;
  color: var(--gold-2);
  font-size: 12px;
}

.inner-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.inner-voice-off .inner-voice-panel {
  display: none;
}

.memory-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.memory-header h2 {
  font-size: 24px;
}

.memory-header p {
  margin: 4px 0 0;
}

.memory-layout {
  display: grid;
  grid-template-columns: 320px minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.connect-panel,
.search-panel {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(213, 173, 100, 0.28);
  border-color: var(--gold);
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.bucket-panel {
  grid-column: 1 / 3;
}

.detail-panel {
  grid-column: 3;
  grid-row: 1 / span 3;
  min-height: 520px;
}

.bucket-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.bucket-card {
  text-align: left;
}

.bucket-card button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.bucket-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.bucket-tags em {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 4px 8px;
  color: var(--gold-2);
  font-size: 12px;
  font-style: normal;
}

.bucket-detail {
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
}

.html-artifacts-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.html-artifacts-header h2 {
  margin: 0;
  color: var(--gold-2);
  font-size: 24px;
}

.html-artifacts-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.html-artifacts-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.artifact-list-panel,
.artifact-detail-panel {
  min-height: 560px;
}

.artifact-list {
  display: grid;
  gap: 10px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.artifact-card {
  overflow: hidden;
  border: 1px solid rgba(213, 173, 100, 0.2);
  border-radius: 8px;
  background: rgba(24, 14, 12, 0.72);
}

.artifact-card.active {
  border-color: rgba(213, 173, 100, 0.58);
  box-shadow: inset 3px 0 0 rgba(213, 173, 100, 0.82);
}

.artifact-card-main {
  width: 100%;
  border: 0;
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.artifact-card-main b,
.artifact-card-main span {
  display: block;
}

.artifact-card-main b {
  color: var(--gold-2);
  font-size: 14px;
}

.artifact-card-main span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.artifact-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px 10px;
}

.artifact-detail-head {
  align-items: flex-start;
}

.artifact-detail-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.artifact-detail {
  display: grid;
  gap: 12px;
}

.artifact-preview-frame {
  overflow: hidden;
  border: 1px solid rgba(213, 173, 100, 0.24);
  border-radius: 8px;
  background: #ffffff;
}

.artifact-preview-frame iframe {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #ffffff;
}

.artifact-source {
  border: 1px solid rgba(213, 173, 100, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.artifact-source summary {
  cursor: pointer;
  padding: 9px 12px;
  color: var(--gold-2);
  font-weight: 900;
}

.artifact-source pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  border-top: 1px solid rgba(213, 173, 100, 0.18);
  padding: 10px 12px;
  color: rgba(255, 236, 184, 0.96);
  white-space: pre-wrap;
}

.html-artifact-empty {
  padding: 28px;
  border: 1px dashed rgba(213, 173, 100, 0.28);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.message.html-artifact-focus {
  outline: 2px solid rgba(213, 173, 100, 0.9);
  outline-offset: 4px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.tool-card {
  min-height: 150px;
}

.tool-card .switch {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.persona-view.active {
  display: grid;
  max-width: 860px;
}

.persona-editor {
  display: grid;
  gap: 14px;
}

.persona-controls {
  flex-wrap: wrap;
  gap: 16px;
}

.persona-controls label {
  grid-template-columns: auto 1fr;
  color: var(--ink);
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(6, 4, 4, 0.74);
}

.dialog-card {
  display: grid;
  min-width: min(520px, calc(100vw - 32px));
  gap: 14px;
  padding: 20px;
  background: var(--surface);
}

.dialog-card h2 {
  margin: 0;
}

.dialog-card menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.connection-test {
  display: grid;
  gap: 10px;
}

.connection-test .sync-empty {
  margin: 0;
  white-space: pre-line;
}

.model-pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.full {
  width: 100%;
}

.slim {
  min-height: 32px;
  padding: 0 10px;
}

.thread-list,
.workflow-steps,
.runtime-summary,
.permission-grid {
  display: grid;
  gap: 10px;
}

.permission-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.thread-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 6px;
}

.thread-row .thread {
  min-width: 0;
}

.danger,
.danger-text {
  color: var(--coral);
}

.chat-options {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: rgba(12, 7, 7, 0.72);
  scrollbar-width: none;
}

.chat-options::-webkit-scrollbar {
  display: none;
}

.chat-options label {
  flex: 0 0 auto;
  margin: 0;
}

.chat-options button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.context-preview {
  display: grid;
  gap: 10px;
  max-height: 320px;
  padding: 12px 14px;
  border-top: 1px solid rgba(213, 173, 100, 0.24);
  background: rgba(9, 6, 6, 0.84);
  overflow: hidden;
}

.context-preview.hidden {
  display: none;
}

.context-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.context-preview-head > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.context-preview-head b {
  color: var(--gold-2);
  font-size: 14px;
}

.context-preview-head span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.context-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.context-usage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.context-usage span {
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgba(213, 173, 100, 0.22);
  border-radius: 8px;
  background: rgba(213, 173, 100, 0.07);
  color: rgba(246, 232, 206, 0.88);
  font-size: 12px;
  font-weight: 800;
}

.context-usage .judgment-scores {
  flex: 1 1 100%;
}

.context-usage .judgment-scores span,
.phase-log .judgment-scores span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 5px 8px;
  align-items: center;
  min-height: 0;
  border-radius: 4px;
}

.context-usage .judgment-scores small,
.phase-log .judgment-scores small {
  color: var(--gold-2);
}

.context-preview pre {
  min-height: 88px;
  max-height: 190px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(213, 173, 100, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
  color: rgba(246, 232, 206, 0.86);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}

.nav-item:hover,
.thread:hover,
.ghost-button:hover,
.icon-button:hover,
.composer-tools button:hover,
.search-bar button:hover {
  border-color: rgba(213, 173, 100, 0.42);
  background: rgba(213, 173, 100, 0.08);
}

.primary-button:hover,
.send-button:hover {
  filter: brightness(1.08);
}

::placeholder {
  color: rgba(200, 170, 145, 0.68);
}

.inline-check,
.tool-title-row,
.workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input,
.persona-controls input,
.compact-switch input {
  width: auto;
}

.runtime-summary div {
  display: grid;
  gap: 3px;
}

.runtime-summary b {
  color: var(--muted);
  font-size: 12px;
}

.runtime-summary span {
  overflow-wrap: anywhere;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.tool-section {
  margin-top: 0;
}

.tool-title-row {
  justify-content: space-between;
}

.tool-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scheme-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(213, 173, 100, 0.24);
}

.scheme-box h3 {
  margin: 0;
  color: var(--gold-2);
  font-size: 16px;
}

.diary-scheme-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.diary-scheme-actions button {
  width: 100%;
}

.scheme-box + .primary-button,
.scheme-box + .ghost-button {
  margin-top: 14px;
}

.compact-switch {
  grid-template-columns: auto auto;
  color: var(--ink);
  font-size: 12px;
}

.workflow-step span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 800;
}

.workflow-step input {
  flex: 1;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.bucket-detail pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}

.write-panel {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
}

.context-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .brand div:not(.brand-mark),
  .nav-item b,
  .conversation-list,
  .sidebar-footer .pill {
    display: none;
  }

  .sidebar {
    align-items: center;
    padding: 18px;
  }

  .nav-item {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: 1fr 1fr;
  }

  .memory-layout,
  .html-artifacts-layout,
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-nav-height: 0px;
    --mobile-options-height: 40px;
    --mobile-composer-height: 76px;
    --visual-viewport-height: 100dvh;
    --keyboard-inset: 0px;
  }

  body {
    overflow-x: hidden;
    font-family: var(--calligraphy-font);
  }

  .sidebar,
  .brand,
  .brand strong,
  .nav-item,
  .thread,
  .thread-create-icon,
  .topbar h1,
  .topbar p,
  .mobile-options,
  .message .role,
  .message-role-button {
    font-family: var(--calligraphy-font) !important;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.chat-view-active {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .html-artifact figcaption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .html-artifact figcaption small {
    text-align: left;
  }

  .html-artifact iframe {
    min-height: 260px;
  }

  .html-artifacts-header {
    align-items: stretch;
    flex-direction: column;
  }

  .html-artifacts-layout {
    grid-template-columns: 1fr;
  }

  .artifact-list-panel,
  .artifact-detail-panel {
    min-height: auto;
  }

  .artifact-list {
    max-height: none;
  }

  .artifact-preview-frame iframe {
    min-height: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  body.chat-view-active .app-shell {
    height: var(--visual-viewport-height);
    min-height: var(--visual-viewport-height);
    max-height: var(--visual-viewport-height);
    overflow: hidden;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(2px);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(86vw, 336px);
    gap: 18px;
    height: 100dvh;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-right: 2px solid rgba(255, 255, 255, 0.62);
    border-top: 0;
    border-bottom: 0;
    box-shadow:
      inset -1px 0 0 rgba(0, 0, 0, 0.9),
      18px 0 48px rgba(0, 0, 0, 0.5);
    align-items: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .brand {
    display: flex !important;
    position: relative;
    flex: 0 0 auto;
    min-height: 72px;
    padding: 0 52px 6px 0;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .brand .brand-main {
    display: flex !important;
    min-width: 0;
  }

  .brand .brand-main > div:not(.brand-mark) {
    display: block !important;
    min-width: 0;
    padding-top: 4px;
  }

  .brand strong {
    font-size: 20px;
  }

  .brand-mark {
    display: grid !important;
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .thread-create-icon {
    position: absolute;
    top: 2px;
    right: 0;
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border: 2px solid rgba(226, 188, 99, 0.82);
    background:
      linear-gradient(180deg, rgba(18, 11, 7, 0.98), rgba(3, 1, 1, 0.98));
    color: var(--gold-2);
    font-size: 20px;
    box-shadow:
      inset 0 0 0 2px rgba(0, 0, 0, 0.92),
      0 0 10px rgba(245, 200, 95, 0.1),
      0 8px 20px rgba(0, 0, 0, 0.34);
  }

  .conversation-list {
    display: grid;
    order: 3;
    flex: 2 1 0;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 120px;
    max-height: none;
    overflow: hidden;
    touch-action: pan-y;
  }

  .thread-list {
    display: grid;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-right: 2px;
  }

  .sidebar-footer {
    display: grid;
    order: 4;
    flex: 0 0 auto;
    gap: 8px;
  }

  .sidebar-footer .pill {
    display: inline-flex;
  }

  .sidebar-settings {
    width: 100%;
  }

  .nav-section {
    display: grid;
    order: 2;
    flex: 4 1 0;
    width: 100%;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 9px;
    min-height: 120px;
    max-height: none;
    overflow: hidden;
    touch-action: pan-y;
  }

  .nav-kicker {
    padding: 0 2px;
  }

  .nav-stack {
    display: grid;
    width: 100%;
    gap: 9px;
    min-height: 0;
    max-height: none;
    padding: 0 2px 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .nav-item {
    grid-template-columns: 38px 1fr;
    justify-items: stretch;
    min-height: 52px;
    padding: 7px 10px;
    border-radius: 8px;
    border-color: rgba(255, 228, 163, 0.62);
    background: rgba(5, 2, 2, 0.42);
    font-size: 14px;
    box-shadow:
      inset 0 0 0 1px rgba(0, 0, 0, 0.82),
      0 0 12px rgba(245, 200, 95, 0.08);
  }

  .nav-item span {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 228, 163, 0.86);
    background:
      linear-gradient(180deg, rgba(17, 10, 7, 0.98), rgba(2, 1, 1, 0.98));
    font-size: 20px;
    box-shadow:
      inset 0 0 0 2px rgba(0, 0, 0, 0.86),
      0 0 14px rgba(245, 200, 95, 0.12);
  }

  .nav-item b {
    display: block;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-item.active {
    border-color: rgba(255, 232, 170, 0.96);
    box-shadow:
      inset 4px 0 0 var(--gold),
      inset 0 0 0 1px rgba(0, 0, 0, 0.92),
      0 0 18px rgba(245, 200, 95, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.24);
  }

  .workspace {
    min-height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) 8px calc(var(--mobile-composer-height) + var(--mobile-options-height) + env(safe-area-inset-bottom) + 16px);
  }

  body.chat-view-active .workspace {
    display: flex;
    flex-direction: column;
    height: var(--visual-viewport-height);
    min-height: 0;
    max-height: var(--visual-viewport-height);
    overflow: hidden;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .topbar,
  .memory-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
  }

  .topbar {
    display: block;
    padding-top: 0;
  }

  body.chat-view-active .topbar {
    flex: 0 0 auto;
  }

  .top-kamon {
    min-height: 36px;
    padding: 0 14px;
    border: 2px solid rgba(255, 228, 163, 0.9);
    background:
      linear-gradient(180deg, rgba(23, 13, 9, 0.96), rgba(5, 2, 2, 0.96));
    box-shadow:
      inset 0 0 0 2px rgba(0, 0, 0, 0.88),
      0 0 14px rgba(245, 200, 95, 0.14);
    font-size: 16px;
    letter-spacing: 0.04em;
  }

  .top-copy {
    padding-right: 88px;
  }

  .top-crest-button {
    width: 74px;
    height: 74px;
    border-width: 2px;
    border-color: rgba(255, 228, 163, 0.94);
    box-shadow:
      inset 0 0 0 2px rgba(0, 0, 0, 0.9),
      0 0 18px rgba(245, 200, 95, 0.18),
      0 12px 30px rgba(0, 0, 0, 0.42);
  }

  body.chat-view-active .mobile-rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 999px;
    background: rgba(12, 7, 7, 0.86);
    color: var(--gold-2);
    font-family: var(--calligraphy-font);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.24);
  }

  body.chat-view-active.mobile-rail-open .mobile-rail-toggle {
    border-color: rgba(255, 228, 163, 0.82);
    background: rgba(94, 20, 22, 0.72);
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.18;
  }

  .topbar p,
  .memory-header p {
    font-size: 13px;
    line-height: 1.45;
  }

  .top-actions,
  .memory-actions {
    width: 100%;
    gap: 8px;
  }

  .top-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .top-actions::-webkit-scrollbar {
    display: none;
  }

  .top-actions button {
    flex: 0 0 auto;
    min-width: auto;
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .chat-panel {
    min-height: calc(var(--visual-viewport-height) - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 80px);
    padding-bottom: 0;
    border: 2px solid rgba(190, 145, 63, 0.42);
    box-shadow:
      inset 0 0 0 1px rgba(0, 0, 0, 0.86),
      0 0 10px rgba(153, 102, 32, 0.06),
      0 14px 34px rgba(0, 0, 0, 0.28);
    overflow: hidden;
  }

  .panel {
    border: 2px solid rgba(190, 145, 63, 0.36);
    box-shadow:
      inset 0 0 0 1px rgba(0, 0, 0, 0.86),
      0 0 8px rgba(153, 102, 32, 0.05),
      0 12px 30px rgba(0, 0, 0, 0.22);
  }

  .content-grid.active {
    gap: 10px;
    min-height: calc(var(--visual-viewport-height) - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 76px);
  }

  body.chat-view-active #view-chat.active {
    display: grid;
    flex: 1 1 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: hidden;
  }

  body.chat-view-active #view-chat > .right-rail {
    display: none;
  }

  body.chat-view-active.inner-voice-open:not(.mobile-rail-open) #view-chat > .right-rail {
    position: fixed;
    inset: 0;
    z-index: 43;
    display: block;
    pointer-events: none;
  }

  body.chat-view-active.inner-voice-open:not(.mobile-rail-open) #view-chat > .right-rail > :not(.inner-voice-panel) {
    display: none;
  }

  body.chat-view-active.inner-voice-open:not(.mobile-rail-open) .inner-voice-panel {
    display: block;
    pointer-events: auto;
    z-index: 44;
  }

  body.chat-view-active.mobile-rail-open #view-chat > .right-rail {
    position: fixed;
    left: 10px;
    right: 10px;
    top: max(88px, calc(env(safe-area-inset-top) + 74px));
    bottom: calc(env(safe-area-inset-bottom) + 16px);
    z-index: 42;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow-y: auto;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.48);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(22, 10, 9, 0.98), rgba(10, 5, 5, 0.98));
    box-shadow:
      0 22px 58px rgba(0, 0, 0, 0.58),
      inset 0 0 0 1px rgba(0, 0, 0, 0.84);
    overscroll-behavior: contain;
  }

  body.chat-view-active .chat-panel {
    height: auto;
    min-width: 0;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  .message-stream {
    min-height: calc(var(--visual-viewport-height) - var(--mobile-composer-height) - var(--mobile-options-height) - env(safe-area-inset-bottom) - 128px);
    max-height: calc(var(--visual-viewport-height) - var(--mobile-composer-height) - var(--mobile-options-height) - env(safe-area-inset-bottom) - 96px);
    overflow-y: auto;
    padding: 12px;
    scroll-padding-bottom: 12px;
    gap: 12px;
  }

  body.chat-view-active .message-stream {
    min-height: 0;
    max-height: none;
  }

  body.composer-focused .app-shell,
  body.composer-focused .workspace {
    height: var(--visual-viewport-height);
    min-height: var(--visual-viewport-height);
    max-height: var(--visual-viewport-height);
    overflow: hidden;
  }

  body.composer-focused {
    overflow: hidden;
  }

  body.composer-focused .workspace {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  body.composer-focused .content-grid.active,
  body.composer-focused .chat-panel {
    min-height: auto;
  }

  body.composer-focused .message-stream {
    min-height: max(180px, calc(var(--visual-viewport-height) - var(--mobile-composer-height) - var(--mobile-options-height) - env(safe-area-inset-bottom) - 140px));
    max-height: max(220px, calc(var(--visual-viewport-height) - var(--mobile-composer-height) - var(--mobile-options-height) - env(safe-area-inset-bottom) - 110px));
    padding-bottom: 8px;
    scroll-padding-bottom: 8px;
  }

  body.chat-view-active.composer-focused .content-grid.active,
  body.chat-view-active.composer-focused .chat-panel,
  body.chat-view-active.composer-focused .message-stream {
    min-height: 0;
  }

  body.chat-view-active.composer-focused .message-stream {
    max-height: none;
    padding-bottom: 12px;
    scroll-padding-bottom: 12px;
  }

  .message {
    max-width: 96%;
    padding: 12px 13px;
  }

  .honmaru-screen {
    min-height: 160px;
  }

  .honmaru-crest {
    width: min(180px, 58%);
  }

  .right-rail,
  .memory-layout,
  .settings-grid,
  .chat-options,
  .phase-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    gap: 12px;
  }

  .panel.compact,
  .detail-panel {
    min-height: auto;
  }

  .bucket-panel,
  .detail-panel {
    grid-column: auto;
  }

  .chat-options {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 3;
    display: flex;
    align-items: center;
    min-height: var(--mobile-options-height);
    gap: 6px;
    overflow-x: auto;
    padding: 4px 6px;
    border: 0;
    border-radius: 8px;
    background: rgba(12, 7, 7, 0.78);
    box-shadow:
      0 -10px 24px rgba(0, 0, 0, 0.24);
    scrollbar-width: none;
  }

  .chat-options::-webkit-scrollbar {
    display: none;
  }

  .chat-options label,
  .chat-options button {
    flex: 0 0 auto;
  }

  .chat-options label:not(.inline-check) {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  .chat-options select {
    min-width: 78px;
    min-height: 34px;
    padding: 0 8px;
    border-color: transparent;
    background: rgba(18, 10, 10, 0.36);
    box-shadow: none;
  }

  .chat-options button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }

  .chat-options .inline-check {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    gap: 5px;
    padding: 0 7px;
    border: 0;
    border-radius: 8px;
    background: rgba(18, 10, 10, 0.34);
    white-space: nowrap;
    font-size: 12px;
  }

  .chat-options .inline-check input {
    width: 16px;
    height: 16px;
  }

  .composer {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 4;
    align-items: end;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    min-height: var(--mobile-composer-height);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.28);
  }

  .composer textarea {
    min-height: 44px;
    max-height: 90px;
  }

  .composer-tools {
    display: flex;
    gap: 0;
  }

  .composer-tools button,
  .send-button,
  .search-bar button,
  .icon-button,
  .ghost-button,
  .primary-button,
  .text-button {
    min-height: 44px;
  }

  .chat-options .ghost-button,
  .chat-options .primary-button,
  .chat-options .text-button {
    min-height: 34px;
    padding: 0 8px;
    border-color: transparent;
    background: rgba(18, 10, 10, 0.32);
    box-shadow: none;
    font-size: 12px;
  }

  .inner-voice-panel {
    top: max(68px, calc(env(safe-area-inset-top) + 48px));
    left: 10px;
    right: 10px;
    width: auto;
    max-height: calc(100dvh - var(--mobile-nav-height) - var(--mobile-composer-height) - env(safe-area-inset-bottom) - 96px);
  }

  .form-grid,
  .context-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .model-pick-row {
    grid-template-columns: 1fr;
  }

  .tool-grid,
  .bucket-list {
    grid-template-columns: 1fr;
  }

  .sync-head,
  .sync-row {
    grid-template-columns: minmax(86px, 1fr) minmax(0, 1fr);
  }

  .sync-head b:nth-of-type(2),
  .sync-row b:nth-of-type(2) {
    display: none;
  }

  .sync-head small,
  .sync-row small {
    justify-self: start;
  }

  .dialog-card {
    min-width: min(100vw - 24px, 520px);
    max-height: calc(100dvh - 28px);
    overflow: auto;
  }
}

@media (max-width: 420px) {
  .workspace {
    padding-left: 6px;
    padding-right: 6px;
  }

  .composer {
    left: 6px;
    right: 6px;
  }

  .panel,
  .chat-panel {
    border-radius: 8px;
  }

  .panel {
    padding: 12px;
  }

  .button-row,
  .memory-actions {
    flex-wrap: nowrap;
  }

  .button-row button,
  .memory-actions button {
    flex: 1 1 auto;
  }

  .diary-scheme-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phase-head,
  .panel-head,
  .diary-entry header {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* geto monochrome override */
:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-soft: #0d0d0d;
  --surface: #111111;
  --surface-soft: #151515;
  --surface-strong: #1d1d1d;
  --border: rgba(255, 255, 255, 0.18);
  --border-strong: rgba(255, 255, 255, 0.42);
  --text: #f7f7f7;
  --muted: #b7b7b7;
  --muted-strong: #dddddd;
  --accent: #ffffff;
  --accent-strong: #e6e6e6;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --gold: #ffffff;
  --gold-strong: #dcdcdc;
  --gold-soft: rgba(255, 255, 255, 0.12);
  --violet: #f1f1f1;
  --violet-strong: #ffffff;
  --violet-soft: rgba(255, 255, 255, 0.1);
  --coral: #d3d3d3;
  --coral-soft: rgba(255, 255, 255, 0.1);
  --green: #ffffff;
  --green-soft: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  --radius: 8px;
}
body {
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 85% 12%, rgba(255, 255, 255, 0.08), transparent 24rem),
    linear-gradient(145deg, #020202 0%, #111111 52%, #050505 100%);
  color: var(--text);
}
body::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 120px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 120px);
  opacity: 1;
}
.app-shell,
.sidebar,
.mobile-topbar,
.content-panel,
.right-rail,
.chat-stream,
.composer,
.memory-surface,
.artifact-preview,
.settings-panel,
.tool-card,
.modal-card,
.status-card,
.timeline-card,
.diary-card,
.log-card,
.storage-card,
.privacy-card {
  background: rgba(10, 10, 10, 0.88);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.nav-item.active,
.mode-button.active,
.tab-button.active,
.primary-button,
.send-button,
.quick-action.primary,
.icon-button.primary,
.pill.active {
  background: linear-gradient(135deg, #ffffff 0%, #d6d6d6 100%);
  color: #050505;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(255, 255, 255, 0.14);
}
.nav-item.active *,
.mode-button.active *,
.tab-button.active *,
.primary-button *,
.send-button *,
.quick-action.primary *,
.icon-button.primary *,
.pill.active * {
  color: inherit;
}
button,
input,
select,
textarea,
.nav-item,
.chip,
.pill,
.quick-action,
.icon-button,
.mode-button,
.tab-button {
  border-radius: 8px;
}
a,
.link-button,
.ghost-button,
.nav-item:hover,
.tool-name,
.stat-value {
  color: #ffffff;
}
.crest,
.brand-crest,
.top-crest img,
.crest-preview img {
  filter: grayscale(1) contrast(1.16);
}
.message.assistant,
.message.user,
.tool-result,
.memory-card,
.artifact-card,
.context-card {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.16);
}
.compat-hidden {
  display: none !important;
}
/* end geto monochrome override */


/* strict black-white pass */
.brand-mark img,
.oda-mon {
  content: url("./assets/geto-school-crest.png");
}

.sidebar,
.right-rail,
.panel,
.chat-panel,
.rail-panel,
.message-stream,
.composer,
.thread-card,
.thread-item,
.tool-event,
.memory-card,
.context-preview,
.sync-empty,
.settings-grid > section,
.scheme-box,
.bucket-detail,
.artifact-detail-panel,
.artifact-list-panel,
.html-artifacts-header {
  background: rgba(8, 8, 8, 0.94) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.56) !important;
}

.message-stream {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    #090909 !important;
}

.thread-card.active,
.thread-item.active,
.nav-item.active {
  background: linear-gradient(135deg, #ffffff 0%, #d7d7d7 100%) !important;
  color: #050505 !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
}

.thread-card.active *,
.thread-item.active *,
.nav-item.active * {
  color: #050505 !important;
}

.tool-event,
.memory-card,
.runtime-summary > *,
.inner-voice,
.sync-empty,
.scheme-box {
  color: #f4f4f4 !important;
}

.panel-head .metric,
.pill,
.section-kicker,
.nav-kicker,
.brand span,
.thread-card small,
.tool-note,
.empty-state {
  color: #cfcfcf !important;
}

.panel-head,
.tool-event,
.memory-card,
.runtime-summary > *,
.sync-empty,
.scheme-box {
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.thread-create-icon,
.top-crest-button {
  background: #0a0a0a !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.brand-mark,
.top-crest-button {
  filter: grayscale(1) contrast(1.2);
}

/* final monochrome clamp */
.brand strong,
#viewTitle,
.panel-head h2,
.panel-head h3 {
  color: #f5f5f5 !important;
  text-shadow: none !important;
}

.nav-item span,
.thread-create-icon,
.top-kamon,
.pill,
.status-dot,
.panel-head .metric {
  background: #080808 !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
  color: #f5f5f5 !important;
  box-shadow: none !important;
}

.thread.active,
.thread-row.active,
.thread-list .active,
.thread-list button.active {
  background: linear-gradient(135deg, #ffffff 0%, #d9d9d9 100%) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  color: #050505 !important;
  box-shadow: 0 14px 28px rgba(255, 255, 255, 0.12) !important;
}

.thread.active *,
.thread-row.active *,
.thread-list .active *,
.thread-list button.active * {
  color: #050505 !important;
}

.honmaru-crest img,
.archive-crest-tile img {
  filter: grayscale(1) contrast(1.18) !important;
}


/* black-white clamp v7 */
:root {
  --bg: #050505 !important;
  --surface: #0b0b0b !important;
  --surface-2: #101010 !important;
  --surface-3: #161616 !important;
  --ink: #f5f5f5 !important;
  --muted: #c8c8c8 !important;
  --line: rgba(255, 255, 255, 0.18) !important;
  --green: #ffffff !important;
  --green-2: #111111 !important;
  --coral: #d8d8d8 !important;
  --amber: #ffffff !important;
  --violet: #eaeaea !important;
  --gold: #ffffff !important;
  --gold-2: #e6e6e6 !important;
  --bright-gold: #ffffff !important;
  --royal-gold: #ffffff !important;
  --black-lacquer: #050505 !important;
  --red: #d8d8d8 !important;
  --red-2: #f0f0f0 !important;
}

:where(.panel, .rail-panel, .right-rail, .chat-panel, .message-stream, .composer, .context-preview, .scheme-box, .dialog-card, .tool-event, .memory-card, .bucket-detail, .artifact-card, .artifact-detail-panel, .artifact-list-panel, .html-artifacts-header, .thread, .thread-row, .sync-empty, .runtime-summary > *, .inner-voice, .nav-item span, input, textarea, select, button) {
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: none !important;
}

:where(.panel, .rail-panel, .right-rail, .chat-panel, .message-stream, .composer, .context-preview, .scheme-box, .dialog-card, .tool-event, .memory-card, .bucket-detail, .artifact-card, .artifact-detail-panel, .artifact-list-panel, .html-artifacts-header, .sync-empty, .runtime-summary > *, .inner-voice, input, textarea, select) {
  background: rgba(8, 8, 8, 0.96) !important;
  color: #f5f5f5 !important;
}

:where(.thread.active, .thread-row.active, .thread-list .active, .nav-item.active, .primary-button, .send-button) {
  background: linear-gradient(135deg, #ffffff 0%, #d8d8d8 100%) !important;
  border-color: rgba(255, 255, 255, 0.82) !important;
  color: #050505 !important;
}

:where(.thread.active, .thread-row.active, .thread-list .active, .nav-item.active, .primary-button, .send-button) * {
  color: #050505 !important;
}

:where(.pill, .top-kamon, .thread-create-icon, .ghost-button, .text-button, .icon-button, .nav-item span) {
  background: #080808 !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
  color: #f5f5f5 !important;
}

:where(.brand strong, #viewTitle, .panel-head h2, .panel-head h3, .section-kicker, .nav-kicker) {
  color: #f5f5f5 !important;
  text-shadow: none !important;
}

.persona-card-grid {
  max-width: 920px;
}

.persona-editor textarea {
  min-height: 340px;
  resize: vertical;
}

.persona-controls {
  display: grid;
  gap: 10px;
}


/* shared swirl school crest */
.brand-mark img,
.oda-mon,
.top-crest,
.honmaru-crest img,
.archive-crest-tile img,
.crest-preview img {
  content: url("./assets/geto-school-crest.png") !important;
  filter: grayscale(1) contrast(1.08) !important;
  object-fit: contain !important;
}

.brand-mark,
.top-crest-button,
.honmaru-crest,
.archive-crest-tile {
  background: #f7f7f4 !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

/* v10 polish: keep the supplied crest image readable and keep active nav contrast stable */
.brand-main {
  align-items: center !important;
}

.brand-mark {
  width: 82px !important;
  height: 74px !important;
  aspect-ratio: 227 / 205 !important;
  flex: 0 0 82px !important;
  padding: 4px !important;
  border-radius: 6px !important;
  overflow: hidden !important;
}

.brand-mark img,
.oda-mon {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.nav-item.active {
  background: linear-gradient(135deg, #ffffff 0%, #d8d8d8 100%) !important;
  color: #050505 !important;
  border-color: rgba(255, 255, 255, 0.86) !important;
}

.nav-item.active b {
  color: #050505 !important;
}

.nav-item.active span {
  background: #050505 !important;
  color: #ffffff !important;
  border-color: #050505 !important;
}

/* v10 accent pass: replace remaining muted gold text accents with dark purple */
:root {
  --amber: #6f568f !important;
  --gold: #6f568f !important;
  --gold-2: #9b82c3 !important;
  --bright-gold: #b8a0da !important;
  --royal-gold: #8a6bb2 !important;
}

:where(
  .section-kicker,
  .nav-kicker,
  .brand span,
  .tool-name,
  .tool-note strong,
  .context-usage span,
  .panel-head .pill,
  .phase-log-detail summary small,
  .phase-log-body small,
  .thread small,
  .archive-region-head h4,
  .stat-value
) {
  color: #9b82c3 !important;
}

.nav-item.active span {
  background: #050505 !important;
  color: #ffffff !important;
  border-color: #050505 !important;
}

/* v11 sidebar fixes */
.brand {
  align-items: center !important;
}

.brand-main {
  grid-template-columns: 78px 1fr !important;
}

.brand-mark {
  width: 78px !important;
  height: 78px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 78px !important;
  padding: 5px !important;
}

.brand-mark img,
.oda-mon {
  object-fit: contain !important;
}

.nav-section > .thread-create-icon {
  width: 100% !important;
  height: 40px !important;
  flex: none !important;
  margin: 0 0 8px !important;
  border-radius: 8px !important;
  background: #0a0a0a !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
}

.thread-list .active span,
.thread.active span,
.thread-row.active span {
  background: transparent !important;
  border-color: transparent !important;
}

.thread-list .active .thread-dot,
.thread.active .thread-dot,
.thread-row.active .thread-dot {
  width: 10px !important;
  height: 10px !important;
  border-radius: 50% !important;
  background: #050505 !important;
  border-color: #050505 !important;
  flex: 0 0 10px !important;
}

.thread-list .active b,
.thread-list .active small,
.thread.active b,
.thread.active small {
  color: #050505 !important;
}

/* v11 darker ink-purple accents */
:root {
  --amber: #4e3a68 !important;
  --gold: #4e3a68 !important;
  --gold-2: #6f568f !important;
  --bright-gold: #846aa6 !important;
  --royal-gold: #5b4478 !important;
}

:where(
  .call-record-head b,
  .judgment-scores small,
  .archive-region-head h4,
  .archive-item.expanded .phase-log-body > b,
  .phase-emotion-item > span,
  .storage-total b,
  .mobile-home-status b,
  .storage-row strong,
  .incoming-call-mark,
  .sync-row small,
  .section-kicker,
  .nav-kicker,
  .brand span,
  .tool-name,
  .tool-note strong,
  .context-usage span,
  .panel-head .pill,
  .phase-log-detail summary small,
  .phase-log-body small,
  .thread small,
  .stat-value
) {
  color: #6f568f !important;
}

.nav-section > .thread-create-icon {
  position: static !important;
}

:where(
  .message-history-toggle,
  .phase-log-detail summary,
  .role-meta time,
  .message-body blockquote,
  .message-body em,
  .message-body code,
  .message-body strong,
  .message-body a,
  .message-body h1,
  .message-body h2,
  .message-body h3,
  .html-artifact figcaption,
  .html-artifact figcaption small,
  .html-artifact summary,
  .artifact-source summary,
  .artifact-source pre,
  .context-usage span,
  .context-usage .judgment-scores small,
  .phase-log .judgment-scores small,
  .context-preview pre,
  .writing-message,
  .bucket-tags em,
  .scheme-box h3,
  .context-preview-head b
) {
  color: #5d4878 !important;
}

.writing-dots i,
.status-dot,
.status-dot.idle {
  background: #5d4878 !important;
}

.judgment-scores em,
.storage-row i {
  background: linear-gradient(90deg, #4e3a68, #5d4878) !important;
}

::placeholder {
  color: rgba(93, 72, 120, 0.68) !important;
}

/* v12 emotion image restore + darker purple */
:root {
  --amber: #3e2b58 !important;
  --gold: #3e2b58 !important;
  --gold-2: #5a4276 !important;
  --bright-gold: #6d568c !important;
  --royal-gold: #493463 !important;
}

:where(
  .call-record-head b,
  .judgment-scores small,
  .archive-region-head h4,
  .archive-item.expanded .phase-log-body > b,
  .phase-emotion-item > span,
  .storage-total b,
  .mobile-home-status b,
  .storage-row strong,
  .incoming-call-mark,
  .sync-row small,
  .section-kicker,
  .nav-kicker,
  .brand span,
  .tool-name,
  .tool-note strong,
  .context-usage span,
  .panel-head .pill,
  .phase-log-detail summary small,
  .phase-log-body small,
  .thread small,
  .stat-value
) {
  color: #5a4276 !important;
}

:where(
  .message-history-toggle,
  .phase-log-detail summary,
  .role-meta time,
  .message-body blockquote,
  .message-body em,
  .message-body code,
  .message-body strong,
  .message-body a,
  .message-body h1,
  .message-body h2,
  .message-body h3,
  .html-artifact figcaption,
  .html-artifact figcaption small,
  .html-artifact summary,
  .artifact-source summary,
  .artifact-source pre,
  .context-usage span,
  .context-usage .judgment-scores small,
  .phase-log .judgment-scores small,
  .context-preview pre,
  .writing-message,
  .bucket-tags em,
  .scheme-box h3,
  .context-preview-head b
) {
  color: #432f5e !important;
}

.phase-emotion-item,
.persona-emotion-panel {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: #080808 !important;
}

.emotion-preview {
  border-color: rgba(255, 255, 255, 0.24) !important;
  background: #ffffff !important;
}

.phase-emotion-actions .text-button {
  color: #432f5e !important;
}


/* v13 worldbook + DotGothic16 */
:root {
  --dot-gothic: "DotGothic16", "Noto Sans JP", "Yu Gothic", "Microsoft YaHei", sans-serif;
  --trace-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --ui-font: var(--dot-gothic) !important;
  --calligraphy-font: var(--dot-gothic) !important;
  --nav-calligraphy: var(--dot-gothic) !important;
}

body,
button,
input,
textarea,
select,
.message,
.message-body,
.panel,
.nav-item,
.brand,
.topbar,
.persona-editor,
.worldbook-editor,
.inner-voice {
  font-family: var(--dot-gothic) !important;
}

.tool-event,
.tool-feed,
.runtime-summary,
.context-preview,
.context-preview pre,
.phase-log,
.phase-log-detail,
.phase-log-body,
.log-card,
.sync-health,
.sync-row,
.storage-row,
.artifact-source pre {
  font-family: var(--trace-font) !important;
}

.worldbook-view .settings-grid {
  max-width: 980px;
}

.worldbook-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #080808;
}

/* v17 Twitter tool */
.twitter-view.active {
  display: block;
}

.twitter-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.twitter-page {
  min-height: calc(100vh - 180px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #050505;
}

.twitter-topline {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(14px);
}

.twitter-topline h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.08rem;
}

.twitter-cover {
  height: 150px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, #050505 0 42%, #17121f 42% 56%, #f3f3f3 56% 62%, #050505 62% 100%);
  background-position: center;
  background-size: cover;
  overflow: hidden;
  position: relative;
}

.twitter-profile-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
  background: #050505;
  margin-top: 0;
  padding: 14px 18px 10px;
  position: relative;
  z-index: 1;
}

.twitter-profile-row .twitter-avatar-button {
  align-self: start;
  justify-self: start;
}

.twitter-avatar,
.tweet-avatar {
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #050505;
  background: #ffffff;
}

.twitter-avatar {
  width: 96px;
  height: 96px;
}

.tweet-avatar {
  width: 44px;
  height: 44px;
  border-width: 2px;
}

.twitter-profile-copy {
  align-self: start;
  display: grid;
  gap: 2px;
  padding: 8px 0 0;
}

.twitter-profile-copy b {
  color: #ffffff;
  font-size: 1.25rem;
}

.twitter-profile-copy span,
.twitter-bio,
.twitter-stats,
.tweet-meta span,
.tweet-foot,
.twitter-composer-actions span {
  color: rgba(255, 255, 255, 0.58);
}

.twitter-heartbeat-toggle {
  align-self: start;
  justify-self: end;
  margin-bottom: 0;
  margin-top: 32px;
}

.twitter-bio,
.twitter-stats {
  padding: 0 18px;
}

.twitter-bio {
  margin: 4px 0 0;
  line-height: 1.65;
}

.twitter-stats {
  display: flex;
  gap: 16px;
  margin: 10px 0 18px;
}

.twitter-stats b {
  color: #ffffff;
}

.twitter-composer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.twitter-composer-avatar {
  margin-top: 4px;
}

.twitter-composer-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.twitter-composer textarea {
  min-height: 76px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 1.08rem;
  line-height: 1.55;
  padding: 8px 0;
}

.twitter-composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 10px;
}

.twitter-composer-actions span {
  margin-right: auto;
}

.twitter-compose-actions {
  justify-content: space-between;
}

.twitter-compose-tools,
.twitter-compose-submit {
  align-items: center;
  display: flex;
  gap: 8px;
}

.twitter-compose-icon {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  height: 34px;
  justify-content: center;
  padding: 0;
  transition: background 0.16s ease, color 0.16s ease;
  width: 34px;
}

.twitter-compose-icon:hover,
.twitter-compose-icon:focus-visible {
  background: rgba(96, 64, 128, 0.28);
  color: #d2bedf;
  outline: none;
}

.twitter-compose-icon svg {
  display: block;
  fill: none;
  flex: 0 0 19px;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 19px;
}

.twitter-compose-icon .compose-icon-x {
  stroke-width: 2.2;
}

.twitter-compose-icon .compose-icon-settings {
  stroke-width: 2.1;
}

.twitter-compose-submit span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.82rem;
  margin: 0;
}

.twitter-post-button {
  appearance: none;
  background: #f5f5f5;
  border: 0;
  border-radius: 999px;
  color: #050505;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 34px;
  min-width: 76px;
  padding: 0 18px;
}

.twitter-post-button:hover,
.twitter-post-button:focus-visible {
  background: #ffffff;
  outline: 2px solid rgba(255, 255, 255, 0.24);
  outline-offset: 2px;
}

.twitter-feed {
  display: grid;
}

.tweet-card {
  align-items: start;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tweet-card > .twitter-avatar-button.mini {
  align-self: start;
  justify-self: start;
  line-height: 0;
  margin-top: 2px;
}

.tweet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tweet-meta b {
  color: #ffffff;
}

.tweet-meta .text-button {
  margin-left: auto;
}

.tweet-body p {
  margin: 8px 0 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.tweet-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .twitter-shell {
    max-width: 100%;
  }

  .twitter-cover {
    height: 132px;
  }

  .twitter-profile-row {
    grid-template-columns: auto 1fr;
  }

  .twitter-heartbeat-toggle {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
  }
}

/* v18 twitter social expansion */
.twitter-back.hidden,
#twitterTimeline.hidden,
.twitter-profile-panel.hidden,
.twitter-card-composer.hidden {
  display: none;
}

.twitter-avatar-button,
.twitter-profile-copy,
.tweet-author-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.twitter-avatar-button.large .twitter-avatar {
  width: 112px;
  height: 112px;
  border-width: 3px;
  background: #050505;
}

.twitter-avatar-button.mini {
  align-self: start;
  display: inline-flex;
  justify-self: start;
  line-height: 0;
  width: fit-content;
}

.tweet-author-link {
  color: #fff;
  font-weight: 700;
}

.twitter-card-composer,
.twitter-profile-form,
.tweet-comments {
  display: grid;
  gap: 10px;
}

.twitter-card-composer input,
.twitter-card-composer textarea,
.twitter-profile-form input,
.twitter-profile-form textarea,
.tweet-comment-form textarea {
  background: #080808;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: #fff;
  padding: 10px;
}

.twitter-card-composer textarea,
.twitter-profile-form textarea {
  min-height: 86px;
  resize: vertical;
}

.twitter-card-composer {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px;
}

.tweet-image-card {
  align-content: center;
  aspect-ratio: 16 / 10;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  color: #050505;
  display: grid;
  gap: 8px;
  isolation: isolate;
  margin: 10px 0 12px;
  overflow: hidden;
  padding: 16px;
  place-items: center;
  position: relative;
  text-align: left;
  width: min(100%, 420px);
}

.tweet-image-card::before {
  background: url("./assets/geto-school-crest.png") center / 42% no-repeat;
  content: "";
  filter: grayscale(1);
  inset: 0;
  opacity: 0.075;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.tweet-image-card > * {
  position: relative;
  z-index: 1;
}

.tweet-image-card .tweet-image-card-text {
  color: #050505;
  display: none;
  font-size: 0.94rem;
  height: 100%;
  line-height: 1.75;
  overflow: hidden;
  white-space: pre-wrap;
  width: 100%;
}

.tweet-image-card.revealed {
  align-content: center;
  place-items: center;
}

.tweet-image-card.revealed::before {
  opacity: 0.045;
}

.tweet-image-card.revealed .tweet-image-card-text {
  display: block;
  margin: auto;
  max-height: 100%;
  overflow: auto;
  text-align: center;
}

.twitter-card-dialog {
  background: #070707;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  max-height: 82vh;
  padding: 0;
  width: min(92vw, 560px);
}

.twitter-card-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.twitter-card-dialog-head {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.twitter-card-dialog-body {
  background:
    linear-gradient(rgba(247, 247, 247, 0.92), rgba(247, 247, 247, 0.92)),
    url("./assets/geto-school-crest.png") center / 46% no-repeat #f7f7f7;
  border-radius: 8px;
  color: #050505;
  line-height: 1.75;
  margin: 16px;
  max-height: 62vh;
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
}

.twitter-cover-edit {
  background: rgba(5, 5, 5, 0.72);
  border-color: rgba(255, 255, 255, 0.34);
  bottom: 14px;
  color: #fff;
  position: absolute;
  right: 14px;
}

.tweet-comments {
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  margin-top: 12px;
  padding-top: 10px;
}

.tweet-comment {
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr;
}

.tweet-avatar.small {
  border-width: 1px;
  height: 30px;
  width: 30px;
}

.tweet-comment p {
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 3px 0 0;
}

.tweet-meta.compact {
  font-size: 0.84rem;
  gap: 6px;
}

.tweet-comment-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.tweet-comment-form textarea {
  min-height: 44px;
  resize: vertical;
}

.twitter-profile-panel {
  display: grid;
  gap: 14px;
}

.twitter-profile-editor {
  display: grid;
  gap: 18px;
  grid-template-columns: auto 1fr;
  margin-top: 0;
  padding: 14px 18px 18px;
}

.twitter-profile-form {
  padding-top: 0;
}

.twitter-profile-form label {
  color: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 6px;
}

.tweet-profile-summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 8px;
  padding: 16px 18px;
}

.tweet-profile-summary b {
  color: #fff;
  font-size: 1.2rem;
}

.tweet-profile-summary span {
  color: rgba(255, 255, 255, 0.58);
}

.tweet-profile-pinned {
  background: #090909;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  line-height: 1.6;
  padding: 12px;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .twitter-profile-editor {
    grid-template-columns: 1fr;
  }

  .twitter-profile-form {
    padding-top: 0;
  }

  .tweet-comment-form {
    grid-template-columns: 1fr;
  }

  .tweet-image-card {
    width: 100%;
  }

  .twitter-composer {
    grid-template-columns: auto 1fr;
    padding-inline: 14px;
  }

  .twitter-composer-actions {
    gap: 6px;
  }

  .twitter-compose-actions {
    align-items: flex-start;
  }

  .twitter-compose-submit {
    gap: 6px;
  }

  .twitter-post-button {
    min-width: 64px;
    padding-inline: 14px;
  }
}

/* v29 sidebar repair: keep compact controls and restore black/white active switching */
.sidebar .nav-section > .thread-create-icon {
  align-self: stretch !important;
  background: #080808 !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  color: #f5f5f5 !important;
  display: grid !important;
  flex: none !important;
  height: 40px !important;
  justify-self: stretch !important;
  line-height: 1 !important;
  margin: 0 0 8px !important;
  max-height: 40px !important;
  max-width: 100% !important;
  min-height: 40px !important;
  min-width: 0 !important;
  padding: 0 !important;
  place-items: center !important;
  position: static !important;
  width: 100% !important;
}

.sidebar .nav-item,
.sidebar .thread,
.sidebar .thread-list button {
  background: rgba(8, 8, 8, 0.66) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: none !important;
  color: #f5f5f5 !important;
}

.sidebar .nav-item.active,
.sidebar .thread.active,
.sidebar .thread-list .active,
.sidebar .thread-list button.active {
  background: linear-gradient(135deg, #ffffff 0%, #d7d7d7 100%) !important;
  border-color: rgba(255, 255, 255, 0.86) !important;
  box-shadow: 0 12px 24px rgba(255, 255, 255, 0.12) !important;
  color: #050505 !important;
}

.sidebar .nav-item.active *,
.sidebar .thread.active *,
.sidebar .thread-list .active *,
.sidebar .thread-list button.active * {
  color: #050505 !important;
}

.sidebar .nav-item span {
  background: #080808 !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
  color: #f5f5f5 !important;
}

.sidebar .nav-item.active span {
  background: #050505 !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  color: #ffffff !important;
}

.sidebar .thread-list .active .thread-dot,
.sidebar .thread.active .thread-dot {
  background: #050505 !important;
  border-color: #050505 !important;
}

/* v30 sidebar section boundaries */
.sidebar .nav-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  gap: 10px !important;
  padding-bottom: 14px !important;
}

.sidebar .nav-kicker {
  border-top: 1px solid rgba(255, 255, 255, 0.18) !important;
  margin-top: 4px !important;
  padding: 12px 2px 0 !important;
}

.sidebar .conversation-list {
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, 0.14) !important;
  margin-top: 0 !important;
  padding-top: 12px !important;
}

.sidebar .thread-list {
  background: transparent !important;
  display: grid !important;
  gap: 8px !important;
  padding: 0 !important;
}

.sidebar .thread-list > .thread,
.sidebar .thread-list > button {
  background-clip: padding-box !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
  max-width: 100% !important;
  overflow: hidden !important;
  width: 100% !important;
}

.sidebar .thread-list .active:not(.thread):not(button) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.sidebar .thread-list > .thread-row,
.sidebar .thread-list > .thread-row.active {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sidebar .thread-list > .thread-row > .thread.active {
  background: linear-gradient(135deg, #ffffff 0%, #d7d7d7 100%) !important;
  border-color: rgba(255, 255, 255, 0.86) !important;
  border-radius: 0 !important;
  box-shadow: 0 10px 18px rgba(255, 255, 255, 0.1) !important;
  color: #050505 !important;
  overflow: hidden !important;
}

/* v43 mobile sidebar: keep 校舎案内 visible between new-chat and tool nav */
@media (max-width: 760px) {
  .sidebar {
    gap: 12px !important;
  }

  .sidebar .nav-section {
    display: grid !important;
    grid-template-rows: 40px auto minmax(0, 1fr) !important;
    min-height: 210px !important;
    overflow: hidden !important;
    row-gap: 8px !important;
  }

  .sidebar .nav-section > .thread-create-icon {
    grid-row: 1 !important;
  }

  .sidebar .nav-kicker {
    display: block !important;
    grid-row: 2 !important;
    min-height: 28px !important;
    margin: 0 !important;
    padding: 9px 2px 7px !important;
    background: #050505 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
    line-height: 1.1 !important;
    position: relative !important;
    z-index: 2 !important;
  }

  .sidebar .nav-stack {
    grid-row: 3 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-top: 2px !important;
    position: relative !important;
    z-index: 1 !important;
  }
}

.sidebar .thread-list > .thread-row > .thread.active * {
  color: #050505 !important;
}

.sidebar .thread-list > .thread-row > .thread.active .thread-dot {
  background: #050505 !important;
  border-color: #050505 !important;
}
