:root {
  --paper: #f5f5f2;
  --ink: #393d42;
  --muted: #747971;
  --rule: #d9ddd6;
  --sage: #dfe8df;
  --blue: #e3e9ef;
  --rose: #f0e3e4;
  --gold: #c5a661;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  font:
    16px/1.75 "LXGW WenKai",
    serif;
  color: var(--ink);
  background: #e7e9e5;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  cursor: pointer;
  background: transparent;
  padding: 10px 14px;
  border-radius: 10px;
  touch-action: manipulation;
  transition:
    transform 120ms var(--ease-out),
    background-color 120ms ease;
}
button:active {
  transform: scale(0.97);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: inherit;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #70857b;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 27px;
  font-weight: 400;
  line-height: 1.45;
}
h2 {
  font-size: 22px;
  font-weight: 400;
}
h3 {
  font-size: 18px;
  font-weight: 400;
}
small,
.muted {
  color: var(--muted);
  font-size: 13px;
}
.prototype-note {
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 6px 8px;
  color: #6f776d;
  background: #e8ece5;
  position: relative;
  z-index: 3;
}
#app {
  max-width: 1100px;
  margin: auto;
  background: var(--paper);
  min-height: calc(100dvh - 27px);
  position: relative;
  isolation: isolate;
}
#app:before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.24' filter='url(%23n)'/%3E%3C/svg%3E");
}
.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 30px;
  border-bottom: 1px solid var(--rule);
  gap: 10px;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-title small {
  display: block;
  font-size: 12px;
}
.topbar h1 {
  font-size: 19px;
}
.icon {
  font-family: system-ui, sans-serif;
  min-width: 44px;
  min-height: 44px;
  font-size: 23px;
  padding: 4px 10px;
}
.back {
  font-size: 15px;
  padding: 8px 5px;
  white-space: nowrap;
}
.page {
  padding: 44px 48px 70px;
  max-width: 800px;
  margin: auto;
}
.page-intro {
  margin-bottom: 30px;
}
.page-intro h1 {
  display: inline-block;
  margin-bottom: 8px;
}
.page-intro p {
  color: var(--muted);
  font-size: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 20px 2px;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}
.row-body {
  flex: 1;
  min-width: 0;
}
.row-body strong {
  display: block;
  font-size: 18px;
  font-weight: 400;
}
.row-body small {
  display: block;
  overflow-wrap: anywhere;
}
.arrow {
  font-size: 21px;
  color: #92998e;
}
.avatar {
  width: 49px;
  height: 49px;
  flex: 0 0 49px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 23px;
  background: var(--sage);
  position: relative;
}
.avatar:after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid #a1aaa0;
  border-radius: 48% 52% 50% 47%;
  transform: rotate(-8deg);
}
.avatar.blue {
  background: var(--blue);
}
.row .edit {
  padding: 10px 4px;
  font-size: 14px;
  color: #647a6a;
}
.row-main {
  display: flex;
  gap: 16px;
  align-items: center;
  text-align: left;
  flex: 1;
  min-width: 0;
  padding: 0;
}
.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.quiet {
  padding: 9px 0;
  color: #647a6a;
}
.primary {
  background: var(--sage);
  padding: 10px 25px;
  border-radius: 45% 8px 40% 8px/8px 45% 8px 40%;
}
.danger {
  color: #9b6267;
}
.tabs {
  display: flex;
  gap: 22px;
  margin: 20px 0;
}
.tabs button {
  padding: 6px 2px;
  color: var(--muted);
  border-radius: 0;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
}
.chat-layout {
  min-height: calc(100dvh - 113px);
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
}
.page-margin {
  padding: 43px 28px;
  border-right: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}
.page-margin .day {
  font-size: 42px;
  line-height: 1.4;
  color: #8a9487;
}
.page-margin p {
  margin-top: 18px;
}
.page-margin .tiny-flower {
  margin-top: 60px;
  width: 70px;
  color: #919e90;
}
.conversation {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 113px);
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 38px 40px 20px;
  scroll-behavior: auto;
}
.load-older-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 20px;
}
.load-older-trigger {
  min-height: 48px;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  font-size: 13px;
  font-family: inherit;
  color: #647a6a;
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed rgba(100, 122, 106, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
}
.load-older-trigger:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.75);
}
.load-older-trigger:disabled {
  opacity: 0.6;
  cursor: default;
}
.message {
  margin-bottom: 30px;
  max-width: 580px;
}
.message.user {
  margin-left: auto;
  max-width: 86%;
  text-align: right;
}
.message.user .message-text {
  display: inline-block;
  background: var(--blue);
  padding: 12px 18px;
  border-radius: 18px 5px 16px 14px;
  text-align: left;
}
.message-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}
.message-head .avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  font-size: 17px;
}
.message-head small {
  font-size: 13px;
}
.thought-trigger {
  font-size: 12px;
  color: #7f8579;
  padding: 3px 0;
}
.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.95;
}
.thought {
  font-size: 13px;
  color: #858a80;
  margin: 8px 0 17px 44px;
  white-space: pre-wrap;
}
.composer {
  margin: 0 40px;
  padding: 18px 0 max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
}
.composer form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.composer textarea {
  resize: none;
  border: 0;
  background: transparent;
  outline: none;
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  max-height: 140px;
  font-size: 17px;
  line-height: 1.7;
}
.send {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  background: var(--sage);
  border-radius: 50% 46% 49% 44%;
  padding: 0;
  font-size: 26px;
}
.composer-note {
  font-size: 11px;
  color: #959a90;
  margin-top: 7px;
}
.spark {
  display: grid;
  place-items: center;
  color: #b39758;
  width: 38px;
  height: 38px;
  padding: 4px;
}
.spark .yanlan-spark-mask {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.spark .yanlan-spark-sprite {
  display: block;
  width: 100%;
}
.draft-tip {
  font-size: 12px;
  color: #8a917f;
}
.attachment {
  padding: 5px 10px;
  background: var(--blue);
  font-size: 12px;
  border-radius: 5px;
  margin-bottom: 8px;
  display: inline-block;
}
.home {
  max-width: 850px;
}
.home-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.home-heading h1 {
  font-size: 35px;
}
.home-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}
.home-illustration {
  width: 100%;
  max-height: 360px;
  margin: 24px 0 10px;
  display: block;
}
.home-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 60px;
  padding: 25px 0;
}
.resume {
  display: block;
  text-align: left;
  padding: 0;
}
.resume h2 {
  margin: 5px 0 10px;
}
.resume p {
  font-size: 14px;
  color: var(--muted);
}
.bookmark {
  font-size: 12px;
  color: #7d8b77;
}
.partner-identity {
  text-align: center;
  margin-bottom: 35px;
}
.partner-identity > .avatar {
  width: 88px;
  height: 88px;
  font-size: 40px;
  margin: 0 auto 14px;
}
.partner-identity h1 {
  margin-bottom: 7px;
}
.partner-identity .quiet {
  font-size: 13px;
}
.partner-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 12px 0 28px;
}
.settings-group {
  margin-top: 28px;
}
.settings-group h2 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.form {
  display: grid;
  gap: 22px;
}
.form label {
  display: grid;
  gap: 9px;
  font-size: 14px;
}
.form input:not([type="checkbox"]),
.form textarea,
.form select,
.search {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #b9c1b6;
  padding: 10px 2px;
  background: transparent;
  border-radius: 0;
}
.form textarea {
  min-height: 200px;
  line-height: 1.9;
  resize: vertical;
}
.form input[type="checkbox"] {
  accent-color: #7f947e;
  width: 19px;
  height: 19px;
}
.form .switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.form .actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}
.saved {
  font-size: 13px;
  color: #647a6a;
}
.fineprint {
  font:
    12px/1.7 system-ui,
    sans-serif;
  color: #7e857b;
}
.plain-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.95;
}
.memory-entrance {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 35px 0;
}
.memory-entrance button {
  padding: 28px 6px;
  min-height: 140px;
  text-align: center;
  border-radius: 50% 40% 50% 35%;
}
.realm-stars {
  background: #e9e6ef;
}
.realm-sky {
  background: #e3edf1;
}
.realm-sea {
  background: #e0eae7;
}
.realm-icon {
  display: block;
  font-size: 34px;
  margin-bottom: 6px;
}
.memory-sky {
  min-height: 300px;
  position: relative;
  padding: 20px 0;
}
.memory-pins {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  text-align: center;
}
.memory-pins button {
  padding: 10px 0;
  font-size: 13px;
}
.memory-pins span {
  display: block;
  font-size: 32px;
  color: #9c8d63;
}
.memory-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 40px;
}
.memory-dot {
  color: #b0944e;
  padding: 10px 0;
  font-size: 14px;
}
.memory-dot span {
  font-size: 28px;
  margin-right: 9px;
}
.memory-dot.purple {
  color: #8974a6;
}
.policy {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #7e857b;
}
.policy i {
  display: block;
  width: 13px;
  height: 13px;
  background: #92968e;
  border-radius: 50%;
}
.policy[data-policy="RECALL"] i {
  background: #dfc98e;
}
.policy[data-policy="ALWAYS"] i {
  background: #b89742;
}
.tool-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.tool-group summary {
  cursor: pointer;
  padding: 10px 0;
  list-style: none;
}
.tool-group .switch {
  padding: 10px 2px;
}
.scope {
  display: inline-block;
  padding: 3px 8px;
  background: var(--blue);
  font-size: 11px;
  border-radius: 5px;
  margin-bottom: 14px;
}
.server-tools {
  padding: 8px 0 5px 20px;
}
.social-graph {
  position: relative;
  height: 300px;
  margin-top: 15px;
}
.social-graph svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  stroke: #a8b5a5;
  fill: none;
  stroke-width: 1;
}
.social-center,
.social-person {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
}
.social-center {
  left: 50%;
  top: 50%;
}
.social-person {
  left: 80%;
  top: 25%;
  background: var(--paper);
}
.social-person.second {
  left: 19%;
  top: 75%;
}
.search {
  margin: 16px 0;
}
.zero {
  padding: 35px 0;
  color: var(--muted);
}
dialog {
  border: 0;
  padding: 25px 30px 30px;
  background: var(--paper);
  color: var(--ink);
  max-width: 570px;
  width: calc(100% - 32px);
  max-height: 86dvh;
  overflow: auto;
  border-radius: 16px 12px 0 0;
  margin: auto auto 0;
  box-shadow: 0 -10px 50px #38433713;
}
dialog::backdrop {
  background: #252d3440;
}
dialog[open] {
  animation: sheet-in 240ms var(--ease-drawer);
}
dialog.closing {
  animation: sheet-out 180ms var(--ease-out) forwards;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.sheet-head h2 {
  font-size: 21px;
}
.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.nav-grid button {
  text-align: left;
  padding: 17px 12px;
}
.nav-grid button small {
  display: block;
}
.sheet-caption {
  font-size: 12px;
  color: var(--muted);
  margin: 18px 0 8px;
}
#notice {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 8px);
  background: #e4eadf;
  color: #43513d;
  padding: 10px 18px;
  border-radius: 7px;
  opacity: 0;
  pointer-events: none;
  font-size: 13px;
  transition:
    opacity 160ms var(--ease-out),
    transform 160ms var(--ease-out);
  z-index: 6;
  max-width: 90%;
  text-align: center;
}
#notice.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.keyboard button,
.keyboard dialog {
  animation: none !important;
  transition: none !important;
}
@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(24px);
    opacity: 0;
  }
}
@media (hover: hover) and (pointer: fine) {
  button:hover {
    background-color: #e7ebe380;
  }
  .primary:hover,
  .send:hover {
    background-color: #d0dfcd;
  }
  .row:hover {
    background-color: #eceee780;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 76px;
    padding: 8px 17px;
  }
  .topbar h1 {
    font-size: 17px;
  }
  .page {
    padding: 32px 24px 55px;
  }
  .chat-layout {
    display: block;
    min-height: calc(100dvh - 103px);
  }
  .page-margin {
    display: none;
  }
  .conversation {
    height: calc(100dvh - 103px);
  }
  .messages {
    padding: 28px 23px 15px;
  }
  .message-text {
    font-size: 16px;
  }
  .composer {
    margin: 0 23px;
  }
  .home-heading h1 {
    font-size: 30px;
  }
  .home-illustration {
    margin-top: 28px;
  }
  .home-bottom {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .row {
    gap: 11px;
  }
  .row-body strong {
    font-size: 17px;
  }
  .avatar {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
  .memory-entrance {
    gap: 8px;
  }
  .memory-entrance button {
    min-height: 120px;
  }
  .memory-pins {
    gap: 8px;
  }
  .memory-pins button {
    font-size: 11px;
  }
  .memory-pins span {
    font-size: 27px;
  }
  .memory-dots {
    gap: 14px;
  }
  dialog {
    width: 100%;
    padding: 20px 24px 28px;
  }
  .topbar-title {
    gap: 8px;
  }
  .prototype-note {
    font-size: 9px;
  }
  .social-person {
    left: 82%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
html[data-reduced="true"] *,
html[data-reduced="true"] *::before,
html[data-reduced="true"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.topbar-title > span {
  min-width: 0;
}
.topbar-title small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.topbar-title h1 {
  white-space: nowrap;
}
@media (max-width: 650px) {
  .topbar-title small {
    max-width: 125px;
  }
}
@media (max-width: 350px) {
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
    gap: 4px;
  }
  .topbar-title small {
    max-width: 76px;
  }
  .topbar .tools {
    gap: 0;
  }
  .topbar-title .avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }
  .topbar-title {
    gap: 6px;
  }
  .topbar .back {
    font-size: 13px;
  }
}
[data-annotate] {
  display: inline-block;
}
.prototype-note {
  height: 28px;
  line-height: 16px;
}
#app {
  min-height: calc(100dvh - 28px);
}
.chat-layout {
  min-height: calc(100dvh - 114px);
}
.conversation {
  height: calc(100dvh - 114px);
}
@media (max-width: 650px) {
  .chat-layout {
    min-height: calc(100dvh - 104px);
  }
  .conversation {
    height: calc(100dvh - 104px);
  }
}
/* Global movable Spark, outside page rendering and inside the top layer when needed. */
.floating-spark {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8;
  width: 48px;
  height: 48px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  padding: 7px;
  transition: none;
  background: transparent !important;
}
.floating-spark.dragging {
  cursor: grabbing;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.home {
  padding-top: 56px;
}
.home-launcher {
  max-width: 440px;
  margin: 10px auto 0;
  text-align: center;
}
.home-time {
  font-size: 14px;
  color: #787e75;
  margin: 5px 0 22px;
}
.home-time strong {
  font-weight: 400;
  color: #4d574c;
  margin-left: 12px;
  font-size: 20px;
}
.home-time small {
  font-size: 10px;
  margin-left: 10px;
  color: #949a91;
}
.home-carousel {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scroll-padding: 0;
  padding-inline: calc(100% / 3);
  box-sizing: content-box;
  width: calc(100% / 3);
  margin: 0 auto;
  gap: 0;
  cursor: grab;
}
.home-carousel::-webkit-scrollbar {
  display: none;
}
.home-carousel.dragging {
  scroll-snap-type: none;
  cursor: grabbing;
}
.home-shortcut {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #9aa197;
  opacity: 0.7;
  padding: 14px 4px;
  transform: scale(0.88);
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms var(--ease-out);
  border-radius: 0;
  background: transparent !important;
}
.home-shortcut svg {
  width: 62px;
  height: 62px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.home-shortcut span {
  font-size: 15px;
  pointer-events: none;
}
.home-shortcut.selected {
  color: #404a42;
  opacity: 1;
  transform: scale(1);
}
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.carousel-controls small {
  font-size: 11px;
  color: #91978d;
}
.carousel-controls button {
  font-size: 23px;
  color: #9aa197;
  min-width: 40px;
  min-height: 40px;
  padding: 2px 8px;
}
.home-shortcut:focus-visible {
  outline-offset: -4px;
}
@media (max-width: 650px) {
  .home {
    padding-top: 44px;
  }
  .home-heading h1 {
    font-size: 29px;
  }
  .home-illustration {
    margin-top: 30px;
    margin-bottom: 10px;
  }
  .home-launcher {
    margin-top: 20px;
  }
  .home-time {
    margin-bottom: 18px;
  }
  .home-shortcut svg {
    width: 54px;
    height: 54px;
  }
  .home-shortcut span {
    font-size: 14px;
  }
  .home-time strong {
    font-size: 19px;
  }
}
.home-carousel {
  touch-action: pan-x pan-y pinch-zoom;
}
.home-shortcut {
  color: #8b9685;
  opacity: 1;
}
.home-shortcut span {
  color: #687360;
}
.home-shortcut.selected {
  color: #404a42;
}
.home-shortcut.selected span {
  color: #404a42;
}
/* Keep the floating pet in viewport coordinates while the sheet surface moves. */
dialog[open],
dialog.closing {
  animation: none;
}
dialog {
  padding: 0;
  background: transparent;
  overflow: visible;
  box-shadow: none;
}
.sheet-surface {
  padding: 25px 30px 30px;
  background: var(--paper);
  border-radius: 16px 12px 0 0;
  max-height: 86dvh;
  overflow: auto;
  box-shadow: 0 -10px 50px #38433713;
  animation: sheet-in 240ms var(--ease-drawer);
}
dialog.closing .sheet-surface {
  animation: sheet-out 180ms var(--ease-out) forwards;
}
@media (max-width: 650px) {
  .sheet-surface {
    padding: 20px 24px 28px;
  }
}
/* Compact diary chat: the assistant name has one visible home, in the 50px header. */
.topbar.chat-header {
  height: 50px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 82px;
  gap: 0;
}
.chat-header .back {
  justify-self: start;
  font-size: 14px;
  min-height: 44px;
}
.chat-header .topbar-title {
  justify-content: center;
  padding: 0 4px;
  min-width: 0;
  height: 44px;
}
.chat-header h1 {
  font-size: 17px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.chat-header .chat-menu {
  justify-self: end;
  min-height: 44px;
}
.chat-layout {
  min-height: calc(100dvh - 78px);
}
.conversation {
  height: calc(100dvh - 78px);
  min-height: 0;
}
.messages {
  min-height: 0;
  padding-top: 25px;
}
.message {
  margin-bottom: 24px;
}
.message-head {
  justify-content: space-between;
  margin-bottom: 6px;
  min-height: 32px;
}
.message.assistant .message-text {
  font-size: 16px;
  line-height: 1.8;
  white-space: normal;
}
.message.user .message-text {
  font-size: 16px;
  line-height: 1.8;
  border: 0;
  border-radius: 21px 21px 19px 21px;
  background: #e5eaf0;
  padding: 10px 16px;
}
.message-text p {
  margin: 0 0 2px;
}
.message-text p:last-child {
  margin-bottom: 0;
}
.message-text :is(ul, ol) {
  padding-left: 1.5em;
  margin: 2px 0;
}
.message-text li > p {
  margin: 0;
}
.message-text :is(h1, h2, h3, h4, h5, h6) {
  font-size: 1.1em;
  line-height: 1.6;
  margin: 6px 0 2px;
}
.message-text blockquote {
  border-left: 1px solid #cbd0c9;
  padding: 2px 12px;
  margin: 3px 0;
  color: #72786d;
}
.message-text table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
  margin: 4px 0;
}
.message-text :is(td, th) {
  border: 1px solid var(--rule);
  padding: 3px 8px;
}
.message-text a {
  color: #657a80;
  text-underline-offset: 3px;
}
.message-text code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: #e9ece7;
  border-radius: 3px;
  padding: 1px 3px;
}
.message-text .code-block {
  background: #eceeea;
  overflow: hidden;
  max-width: 100%;
  border-radius: 8px;
  margin: 4px 0;
}
.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  padding: 3px 10px;
  color: #7c8277;
}
.code-head button {
  padding: 4px 8px;
  font-size: 11px;
}
.message-text pre {
  overflow: auto;
  margin: 0;
  padding: 8px 12px;
  line-height: 1.6;
}
.message-text pre code {
  padding: 0;
  background: transparent;
  white-space: pre;
  display: block;
  min-width: max-content;
}
.message-text .katex-display {
  overflow: auto;
  margin: 4px 0;
}
.message-text.richtext-fallback {
  white-space: pre-wrap;
}
.thought-trigger {
  margin-left: auto;
  font-size: 11.5px;
  color: #7c8278;
  padding: 4px 0;
  min-height: 32px;
}
.thought-shell {
  height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0 0 0 12px;
  border: 0;
  box-shadow: none;
}
.thought {
  font-size: 12.5px;
  line-height: 1.75;
  color: #7e8379;
  white-space: normal;
  margin: 0;
  padding: 6px 10px 10px;
  background: #ffffff35;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.thought p {
  margin: 0 0 2px;
}
.thought :is(ul, ol) {
  padding-left: 1.5em;
  margin: 2px 0;
}
.thought blockquote {
  border: 0;
  margin: 2px 0;
  padding-left: 10px;
}
.thought :is(pre, code) {
  font-size: 11px;
  white-space: pre-wrap;
}
.composer {
  flex-shrink: 0;
  border: 0;
  padding-top: 10px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: transparent;
}
.composer form {
  position: relative;
  padding-bottom: 8px;
  border: 0;
  gap: 10px;
}
.composer form::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 3' preserveAspectRatio='none'%3E%3Cpath d='M1 1.8Q152 .5 300 1.5T599 1.4' fill='none' stroke='%23c5ccc0' stroke-width='.7'/%3E%3C/svg%3E")
    center/100% 100% no-repeat;
}
.composer textarea {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: var(--chat-font, 16px);
  line-height: 1.75;
  min-height: 46px;
  padding: 8px 0;
  overflow-y: hidden;
}
.composer textarea::placeholder {
  font-size: inherit;
}
.composer .icon {
  align-self: flex-end;
  min-height: 48px;
}
.composer-note {
  margin-top: 5px;
  font-size: 10px;
}
@media (max-width: 650px) {
  .topbar.chat-header {
    padding: 0 12px;
  }
  .conversation {
    height: calc(100dvh - 78px);
  }
  .chat-layout {
    min-height: calc(100dvh - 78px);
  }
  .messages {
    padding: 22px 23px 12px;
  }
  .composer {
    margin: 0 23px;
  }
  .thought-shell {
    margin-left: 8px;
  }
}
/* Small hand-drawn homes replace global menus; detail pages keep a contextual back. */
.topbar.primary-header,
.topbar.detail-header {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 82px;
  gap: 0;
  height: 56px;
  padding: 0 12px;
}
.topbar .topbar-title {
  justify-content: center;
  min-width: 0;
}
.topbar .home-icon {
  justify-self: end;
  width: 44px;
  height: 44px;
  padding: 7px;
}
.home-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #4c554b;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.session-entry {
  justify-self: start;
  padding: 8px 0;
  font-size: 14px;
  min-height: 44px;
}
.primary-header h1,
.detail-header h1 {
  font-size: 18px;
  text-align: center;
}
.quiet-page {
  padding-top: 18px;
}
.floating-spark {
  color: #d97757;
}
.home-shortcut[aria-disabled="true"] {
  cursor: default;
}
.home-shortcut[aria-disabled="true"]:active {
  transform: scale(0.88);
}
.home-shortcut.selected[aria-disabled="true"]:active {
  transform: scale(1);
}
.session-more {
  font-size: 20px;
  color: #858d80;
}
.tabs span {
  display: inline-block;
}
.partners-page {
  min-height: calc(100dvh - 84px);
  display: flex;
  flex-direction: column;
  padding-top: 22px;
  padding-bottom: 20px;
}
.partner-content {
  flex: 1;
}
.add-partner {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: #e6ece2;
  border-radius: 12px 14px 11px 15px;
  color: #58684d;
}
.partner-mode {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 28px 0 max(8px, env(safe-area-inset-bottom));
  margin-top: 32px;
}
.mode-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}
.mode-control > svg {
  width: 45px;
  height: 45px;
  fill: none;
  stroke: #77826f;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mode-track {
  position: relative;
  width: min(220px, 52vw);
  height: 56px;
}
.mode-guide {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 27px;
  border-top: 1px dashed #b8c0b2;
}
.mode-thumb {
  position: absolute;
  left: 5px;
  top: 5px;
  width: 46px;
  height: 46px;
  border: 1.5px dashed #87957b;
  border-radius: 48% 52% 47% 53%;
  background: var(--paper);
  padding: 0;
  cursor: grab;
  touch-action: none;
  transition: transform 240ms var(--ease-out);
}
.mode-thumb::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed #c2c9bb;
  border-radius: 52% 47% 53% 48%;
  pointer-events: none;
}
.mode-track.dragging .mode-thumb {
  transition: none;
  cursor: grabbing;
}
.mode-track.at-end .mode-thumb {
  background: #edf1e8;
}
.mode-hint {
  font-size: 11px;
  color: #8a9381;
  text-align: center;
  margin-top: 7px;
}
.mode-thumb:active {
  background: #edf1e8;
}
/* Pencil switch: native checkbox semantics, hand-shaded reusable skin. */
.form .switch {
  min-height: 66px;
}
.pencil-switch {
  position: relative;
  display: inline-block;
  width: 72px;
  height: 54px;
  flex: 0 0 72px;
  vertical-align: middle;
}
.pencil-switch input[type="checkbox"] {
  position: absolute;
  inset: 0 0 auto 0;
  width: 72px;
  height: 42px;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-track {
  position: absolute;
  left: 2px;
  top: 6px;
  width: 66px;
  height: 30px;
  border: 1px solid #929588;
  border-radius: 17px 19px 16px 18px;
  transform: rotate(-0.7deg);
  background-color: #e5e2da;
  background-image: repeating-linear-gradient(
    125deg,
    transparent 0 4px,
    #a6a49525 4px 4.7px
  );
  transition: background-color 240ms ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  inset: 1px -1px -2px 1px;
  border: 1px solid #a6ab9b66;
  border-radius: 19px 16px 18px 17px;
}
.switch-thumb {
  position: absolute;
  left: 6px;
  top: 9px;
  width: 24px;
  height: 24px;
  border: 1px solid #929688;
  border-radius: 48% 52% 46% 53%;
  background-color: #f7f7f1;
  background-image: repeating-linear-gradient(
    130deg,
    transparent 0 5px,
    #a6a49520 5px 5.6px
  );
  transition: transform 240ms var(--ease-out);
  pointer-events: none;
}
.switch-state {
  position: absolute;
  top: 11px;
  left: 36px;
  font:
    9px/20px "LXGW WenKai",
    serif;
  color: #777b6e;
  pointer-events: none;
}
.pencil-switch input:checked ~ .switch-track {
  background-color: #d1dfc9;
}
.pencil-switch input:checked ~ .switch-thumb {
  transform: translateX(32px);
}
.pencil-switch input:checked ~ .switch-state {
  left: 10px;
  color: #5c7152;
}
.pencil-switch input:focus-visible ~ .switch-track {
  outline: 2px solid #8c9e7e;
  outline-offset: 4px;
}
.pencil-switch input:disabled {
  cursor: not-allowed;
}
.pencil-switch:has(input:disabled) {
  opacity: 0.45;
}
.switch-save-status {
  position: absolute;
  top: 37px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  line-height: 14px;
  color: #7b8870;
  pointer-events: none;
}
/* Partner pages: compact identity and one home for each setting. */
.partner-detail {
  padding-top: 8px;
}
.compact-identity {
  height: clamp(126px, 17dvh, 154px);
  margin: 8px auto 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.compact-identity > .avatar {
  width: clamp(78px, 10.6dvh, 98px);
  height: clamp(78px, 10.6dvh, 98px);
  flex-basis: auto;
  margin: 0;
  font-size: 35px;
}
.compact-identity h1 {
  font-size: 21px;
  line-height: 1.35;
  margin: 0;
  font-weight: 400;
}
.partner-sections .row {
  padding: 13px 2px;
  min-height: 59px;
}
.partner-sections .row strong {
  font-size: 17px;
}
.partner-sections small:empty {
  display: none;
}
.avatar img,
.home-avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.basic-avatar {
  display: flex;
  justify-content: center;
  margin: 4px auto 18px;
}
.basic-avatar button {
  padding: 5px;
}
.basic-avatar .avatar {
  width: 88px;
  height: 88px;
  font-size: 38px;
}
.basic-form {
  gap: 3px;
  margin-bottom: 15px;
}
.basic-form input {
  text-align: center;
  font-size: 21px;
}
.inline-status {
  display: block;
  font-size: 11px;
  color: var(--muted);
  min-height: 20px;
  margin: 2px 0;
}
.basic-form .inline-status {
  text-align: right;
  padding-right: 12px;
}
/* Two fine, imperfect pencil strokes; fields remain native and resizable. */
.sketch-field {
  position: relative;
  display: block;
  padding: 3px 7px 5px;
  background: #ffffff35;
  border: 1px solid #b0b7ac;
  border-radius: 9px 5px 8px 6px / 5px 8px 6px 9px;
}
.sketch-field::after {
  content: "";
  position: absolute;
  inset: 2px -2px -1px 1px;
  border: 1px solid #c4c9be99;
  border-radius: 5px 9px 6px 8px;
  pointer-events: none;
  transform: rotate(-0.18deg);
}
.form .sketch-field input,
.form .sketch-field textarea {
  border: 0;
  padding: 9px 8px;
  outline: none;
}
.sketch-field:focus-within {
  border-color: #7e9274;
  outline: 2px solid #a8b49f44;
  outline-offset: 3px;
}
.form .sketch-field textarea {
  min-height: 47dvh;
  resize: vertical;
}
.prompt-label {
  display: inline-block;
  width: fit-content;
  margin: 0 0 12px;
}
.diary-picker {
  border-bottom: 1px solid var(--rule);
}
.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 14px;
  padding: 17px 2px;
  text-align: left;
  border-radius: 0;
}
.picker-current {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: #7b8474;
  font-size: 14px;
  max-width: 68%;
  text-align: right;
}
.picker-current i {
  font-style: normal;
  display: inline-block;
  transition: transform 200ms var(--ease-out);
}
.picker-trigger[aria-expanded="true"] i {
  transform: rotate(180deg);
}
.picker-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 200ms var(--ease-out),
    opacity 200ms var(--ease-out);
}
.picker-body.open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.picker-clip {
  min-height: 0;
  overflow: hidden;
}
.picker-scroll {
  max-height: 156px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 0 8px;
  background: #e8ece455;
}
.picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  gap: 12px;
  border-bottom: 1px solid #cbd2c55c;
  padding: 9px 8px;
  text-align: left;
  font-size: 15px;
  border-radius: 0;
}
.picker-option[aria-pressed="true"] {
  color: #526747;
  background: #dce5d666;
}
.picker-option[aria-pressed="true"] span::before {
  content: "✓ ";
}
.picker-option small {
  font-size: 10px;
  color: #8b8f83;
  white-space: nowrap;
}
.permission-list {
  gap: 0;
}
.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
}
.resource-name {
  min-width: 0;
  flex: 1;
  padding: 10px 2px;
  text-align: left;
  border-radius: 0;
}
.resource-name small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.permission-row .switch {
  flex: 0 0 72px;
}
dialog[data-kind$="card"] {
  margin: auto;
  width: min(360px, calc(100% - 42px));
}
dialog[data-kind$="card"] .sheet-surface {
  border-radius: 8px 13px 9px 6px;
  border: 1px solid #b1b9a9;
  box-shadow:
    3px 4px 0 #cbd1c533,
    0 12px 40px #3b44382b;
  position: relative;
  animation: paper-card-in 240ms var(--ease-out);
}
dialog[data-kind$="card"] .sheet-surface::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid #c4cabb66;
  border-radius: 12px 7px 6px 11px;
  pointer-events: none;
}
dialog[data-kind="tool-card"] .sheet-surface {
  min-height: min(280px, 45dvh);
}
dialog[data-kind$="card"] .sheet-head h2 {
  font-size: 19px;
  font-weight: 400;
}
dialog[data-kind$="card"].closing .sheet-surface {
  animation: paper-card-out 180ms var(--ease-out) forwards;
}
@keyframes paper-card-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes paper-card-out {
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}
.tool-options {
  gap: 0;
}
.form .square-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  min-height: 54px;
}
.square-row span {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.form input.tool-square {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border: 1px solid #819075;
  border-radius: 2px 1px 3px 1px;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: background-color 160ms ease;
}
.form input.tool-square::after {
  content: "";
  position: absolute;
  inset: 2px 1px 1px 2px;
  border: 1px solid #94a08966;
  border-radius: 1px;
}
.form input.tool-square:checked {
  background: #859976;
}
.form input.tool-square:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.form input.tool-square:focus-visible {
  outline: 2px solid #91a181;
  outline-offset: 4px;
}
.tool-options .inline-status {
  margin-top: 16px;
}
.history-row {
  padding: 17px 2px 12px;
}
.history-date {
  display: block;
  text-align: right;
  font-size: 10px;
  color: #92988b;
  margin-top: 7px;
}
.history-row small {
  font-size: 13px;
}
/* A small personal greeting with a sketch portrait, not another header. */
.home-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.home-greeting {
  min-width: 0;
  flex: 1;
}
.home-heading h1 {
  font-size: clamp(19px, 5.4vw, 25px);
  font-weight: 400;
  white-space: nowrap;
}
.home-heading p {
  font-size: 12px;
}
.welcome-name {
  display: inline-grid;
  position: relative;
  padding: 0;
  border-radius: 0;
  vertical-align: baseline;
  color: inherit;
}
.welcome-name .welcome-text {
  grid-area: 1/1;
}
.welcome-cat {
  position: absolute;
  inset: -4px 0 0;
  width: 100%;
  height: 36px;
  opacity: 0;
  pointer-events: none;
}
.welcome-cat svg {
  width: 39px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}
.is-arriving .welcome-cat {
  animation: cat-to-name-sketch 650ms ease-in-out both;
}
.is-arriving .welcome-text {
  animation: cat-to-name-text 650ms ease-in-out both;
}
@keyframes cat-to-name-sketch {
  0%,
  28% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  78%,
  100% {
    opacity: 0;
    transform: translateY(-3px) scale(0.96);
  }
}
@keyframes cat-to-name-text {
  0%,
  28% {
    opacity: 0;
    transform: translateY(4px);
  }
  78%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.home-avatar-frame {
  width: 64px;
  height: 68px;
  padding: 5px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  background: #e6eae04d;
  border: 1px solid #969e8e;
  border-radius: 8px 5px 7px 4px;
  position: relative;
  transform: rotate(2deg);
  font-size: 29px;
}
.home-avatar-frame::after {
  content: "";
  position: absolute;
  inset: 2px -3px -2px 2px;
  border: 1px solid #bac2b066;
  border-radius: 5px 8px 4px 7px;
  pointer-events: none;
}
.avatar-gallery,
.avatar-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.avatar-gallery figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.avatar-gallery figcaption {
  font-size: 12px;
  color: var(--muted);
}
.avatar-choices button {
  padding: 9px;
  display: grid;
  justify-items: center;
}
.avatar-choices [aria-pressed="true"] {
  background: #e1e8db;
}
.avatar-upload {
  display: block;
  font-size: 14px;
  color: #627655;
  margin-top: 24px;
  cursor: pointer;
}
.avatar-upload input {
  display: block;
  width: 100%;
  font-size: 12px;
  margin: 10px 0;
}
@media (max-width: 350px) {
  .home-heading {
    gap: 8px;
  }
  .home-avatar-frame {
    width: 50px;
    height: 55px;
    flex-basis: 50px;
  }
  .home-heading h1 {
    font-size: 18px;
  }
  .home-heading p {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-cat {
    display: none;
  }
  .welcome-text {
    opacity: 1 !important;
    transform: none !important;
  }
}
html[data-reduced="true"] .welcome-cat {
  display: none;
}
html[data-reduced="true"] .welcome-text {
  opacity: 1 !important;
  transform: none !important;
}
.welcome-name {
  max-width: 4em;
}
.welcome-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-identity h1 {
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-current,
.resource-name,
.history-row strong {
  overflow-wrap: anywhere;
}
/* Paper settings: two real controls, generous quiet space beneath. */
.appearance-form {
  max-width: 560px;
  margin: 12px auto;
}
.appearance-form > .switch,
.appearance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  font-size: 16px;
}
.appearance-row .sketch-field {
  width: 72px;
}
.appearance-row input {
  text-align: center;
  width: 100%;
  font-size: 16px;
}
.floating-spark[hidden] {
  display: none !important;
}
.avatar-gallery,
.avatar-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 12px;
  align-items: center;
}
.avatar-gallery figure {
  margin: 0;
  display: grid;
  place-items: center;
  min-width: 0;
}
.avatar-gallery .avatar,
.avatar-choices .avatar {
  width: clamp(38px, 13vw, 70px);
  height: clamp(38px, 13vw, 70px);
}
.avatar-gallery figcaption {
  display: none;
}
.avatar-choices button {
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
}
.avatar-add {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(38px, 13vw, 70px);
  height: clamp(38px, 13vw, 70px);
  margin: auto;
  padding: 0;
  border: 1px dashed #85887e;
  border-radius: 48% 52% 47% 51%;
  color: var(--muted);
  cursor: pointer;
}
.avatar-add span {
  font-size: 28px;
  font-weight: 300;
}
.avatar-add input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.avatar-add:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
.message.assistant .message-text,
.message.user .message-text {
  font-size: var(--chat-font, 16px);
  overflow-wrap: anywhere;
}
.message.user .message-text {
  padding: 0.62em 1em;
  border-radius: 1.3em 1.3em 1.18em 1.3em;
  max-width: 100%;
  min-width: 0;
}
.thought,
.thought :is(pre, code) {
  font-size: var(--thought-font, 12.48px);
}
.thought {
  background: transparent;
  max-height: min(40dvh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.thought-trigger[aria-busy="true"] {
  animation: ink-breathe 1.7s ease-in-out infinite;
}
.ink-status {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 24px;
  padding-left: 2px;
  color: #8a8b80;
  pointer-events: none;
}
.ink-status i {
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 40% 60% 50% 45%;
  animation: ink-dot 1.4s ease-in-out infinite;
}
.ink-status i:nth-child(2) {
  animation-delay: 0.2s;
}
.ink-status i:nth-child(3) {
  animation-delay: 0.4s;
}
.thought-empty {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
@keyframes ink-breathe {
  50% {
    opacity: 0.52;
  }
}
@keyframes ink-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 0.8;
    transform: translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ink-status i,
  .thought-trigger[aria-busy="true"] {
    animation: none;
  }
}
html[data-reduced="true"] .ink-status i,
html[data-reduced="true"] .thought-trigger[aria-busy="true"] {
  animation: none;
}
.ink-status[hidden] {
  display: none;
}
.thought:empty::before {
  content: "暂未收到可展示的思考内容";
  font-size: inherit;
  color: var(--muted);
}
.message-text code {
  font-size: 0.88em;
}
.message-text pre {
  font-size: 0.88em;
}
.message-text pre code {
  font-size: inherit;
}

/* Match both sides' avatars and keep the user's beside the first bubble line. */
.message.user {display:grid;grid-template-columns:minmax(0,1fr) 32px;align-items:start;gap:10px}
.message.user .message-text {grid-column:1;grid-row:1;justify-self:end;max-width:100%;min-width:0}
.message.user .user-avatar {grid-column:2;grid-row:1;width:32px;height:32px;align-self:start}
.message.user [data-last-turn-editor] {grid-column:1;grid-row:1;min-width:0}
.form label.appearance-row {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:16px}
.form .appearance-row .sketch-field {flex:0 0 62px;width:62px;margin:0}
.form .appearance-row input {height:38px;min-height:0;padding:5px 2px;box-sizing:border-box}
.ink-status .ink-status-label {font-size:var(--thought-font,12.48px);color:var(--muted);animation:ink-word-breathe 1.8s ease-in-out infinite}
.ink-dots {display:inline-flex;align-items:center;gap:5px}
@keyframes ink-word-breathe {50%{opacity:.55}}
@media (prefers-reduced-motion:reduce) {.ink-status-label{animation:none!important}}
html[data-reduced=true] .ink-status-label {animation:none!important}

/* Navigation stays usable while an authenticated list is loading. */
.navigation-status {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 100;
  padding: 8px 14px;
  border-radius: 16px;
  background: #f4f2ec;
  color: #565850;
  box-shadow: 0 2px 12px #34372e12;
  font-size: 13px;
  pointer-events: none;
}

/* Keep user bubbles stable when only the assistant receives streaming chunks. */
.message.user {width:fit-content;align-content:start;align-self:flex-end}
.message.user .message-text {width:fit-content;align-self:start;white-space:pre-wrap;overflow-wrap:anywhere}
.user-message-meta {grid-column:1 / -1;grid-row:2;justify-self:end;text-align:right;color:var(--muted);font-size:var(--thought-font,12.48px);line-height:1.6;font-weight:400}
.thought:empty::before {content:none}

/* Companion-scoped deferred tools; same pencil switch, warm yellow accent. */
/* Tool cards share the compact paper surface; names are accessible, without a visible heading. */
dialog[data-kind="tool-card"]{width:min(370px,calc(100% - 32px))}
dialog[data-kind="tool-card"] .sheet-surface{min-height:0;max-height:65dvh;padding:16px 14px 12px}
dialog[data-kind="tool-card"] .sheet-head{display:none}
dialog[data-kind="tool-card"] .tool-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
.form .toolbox-tool-row{min-width:0;min-height:96px;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:5px;padding:8px 0;border-bottom:1px solid var(--rule)}
.toolbox-tool-row>span{font-size:12px;line-height:1.45;min-height:2.9em;overflow-wrap:anywhere;word-break:break-word}
.toolbox-switches{display:flex;gap:6px;justify-content:center}
.toolbox-switches>div{display:flex;flex-direction:column;align-items:center;gap:0}
.toolbox-switches small{font-size:9px;line-height:1.2;color:var(--muted,#777)}
.form .toolbox-switches label.switch{min-height:44px;width:54px;margin:0;padding:0;border:0;display:block}
.toolbox-switches .pencil-switch{width:54px;height:44px;flex-basis:54px}
.toolbox-switches .pencil-switch input[type="checkbox"]{width:54px;height:44px}
.toolbox-switches .switch-track{left:1px;top:7px;width:50px;height:24px}
.toolbox-switches .switch-thumb{left:3px;top:9px;width:20px;height:20px}
.toolbox-switches .pencil-switch input:checked~.switch-thumb{transform:translateX(26px)}
.toolbox-switches .switch-state{font-size:7px;line-height:18px;left:27px;top:10px}
.toolbox-switches .pencil-switch input:checked~.switch-state{left:7px}
.toolbox-switches .switch-save-status{top:32px;font-size:9px;line-height:12px}
.toolbox-yellow .pencil-switch input:checked~.switch-track{background-color:#e9d791}
.toolbox-yellow .pencil-switch input:checked~.switch-thumb{background-color:#f5e7b7}
.toolbox-yellow .pencil-switch input:checked~.switch-state{color:#67552b}
