:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --page: #171717;
  --sidebar: #1e1e1e;
  --surface: #232323;
  --surface-hover: #2a2a2a;
  --border: #2b2b2b;
  --text: #ededed;
  --muted: #9a9a9a;
  --faint: #6f6f6f;
  --accent: #ff4f91;
  --accent-dark: #e4387b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid #b0b0b0;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex: 0 0 228px;
  width: 228px;
  min-width: 228px;
  height: 100%;
  flex-direction: column;
  padding: 8px 8px 6px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  transition: width .18s ease, min-width .18s ease, flex-basis .18s ease, transform .18s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  flex-basis: 0;
  padding-right: 0;
  padding-left: 0;
  border-right: 0;
  transform: translateX(-100%);
}

.app-shell.sidebar-collapsed .menu-button {
  display: inline-grid;
}

.sidebar-top {
  display: flex;
  height: 36px;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 0 4px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #f1f1f1;
}

.brand-mark img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.brand-name {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.2px;
}

.beta {
  margin-left: -2px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #292929;
  color: #818181;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .4px;
}

.icon-button,
.nav-item,
.composer-icon,
.composer-mode,
.send-button,
.conversation-select,
.conversation-delete {
  border: 0;
  background: none;
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: #9b9b9b;
}

.icon-button:hover {
  background: #272727;
  color: #d4d4d4;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.primary-nav {
  margin-top: 8px;
}

.nav-item {
  display: flex;
  width: 100%;
  height: 28px;
  align-items: center;
  gap: 9px;
  margin-bottom: 1px;
  padding: 0 9px;
  border-radius: 8px;
  color: #c9c9c9;
  font-size: 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-hover);
  color: #f1f1f1;
}

.nav-item svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.section-label {
  height: 23px;
  padding: 0 4px;
  color: #858585;
  font-size: 11px;
  line-height: 23px;
}

.history-section {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  margin-top: 19px;
}

.conversation-list {
  min-height: 0;
  overflow: hidden auto;
  scrollbar-color: #454545 transparent;
  scrollbar-width: thin;
}

.conversation-item {
  position: relative;
  display: flex;
  width: 100%;
  height: 27px;
  align-items: center;
  border-radius: 7px;
}

.conversation-item:hover,
.conversation-item.active {
  background: #272727;
}

.conversation-select {
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 26px 0 5px;
  color: #bdbdbd;
  font-size: 11.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-delete {
  position: absolute;
  right: 3px;
  display: none;
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 5px;
  color: #8d8d8d;
}

.conversation-item:hover .conversation-delete,
.conversation-item.active .conversation-delete {
  display: grid;
  place-items: center;
}

.conversation-delete:hover {
  background: #333;
  color: #eee;
}

.conversation-delete svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sidebar-scrim {
  display: none;
}

.main-panel {
  position: relative;
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-rows: 52px minmax(0, 1fr);
  overflow: hidden;
  background: var(--page);
}

.topbar {
  position: relative;
  z-index: 6;
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 17px;
  border-bottom: 1px solid #1d1d1d;
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.menu-button {
  display: none;
}

.service-status {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
}

.status-ring {
  display: block;
  width: 14px;
  height: 14px;
  border: 1.5px dashed #8d8d8d;
  border-radius: 50%;
}

.service-status.offline .status-ring {
  border-color: #b36363;
}

.chat-scroll {
  position: relative;
  min-height: 0;
  overflow: auto;
  scrollbar-color: #404040 transparent;
  scrollbar-width: thin;
}

.chat-content {
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 30px 24px 150px;
}

.empty-state {
  position: absolute;
  top: 25.5%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.hero-greeting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}

.hello-kitty-hero {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.hero-greeting h1 {
  margin: 0;
  color: #f0f0f0;
  font-size: 24px;
  font-weight: 440;
  letter-spacing: -0.55px;
}

.composer-dock {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 20px;
  left: 0;
  display: flex;
  justify-content: center;
  padding: 0 24px;
  pointer-events: none;
}

.main-panel.is-empty .composer-dock {
  top: 37.4%;
  bottom: auto;
}

.composer {
  width: min(600px, 100%);
  min-height: 92px;
  padding: 15px 12px 9px 16px;
  border: 1px solid #252525;
  border-radius: 24px;
  background: var(--surface);
  pointer-events: auto;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 23px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e8e8e8;
  font-size: 13px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #8d8d8d;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.attachment-list:empty {
  display: none;
}

.attachment-chip {
  display: inline-flex;
  max-width: 210px;
  height: 25px;
  align-items: center;
  gap: 5px;
  padding: 0 5px 0 8px;
  border: 1px solid #383838;
  border-radius: 7px;
  background: #292929;
  color: #cfcfcf;
  font-size: 10px;
}

.attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #8f8f8f;
  cursor: pointer;
}

.attachment-remove:hover {
  background: #363636;
  color: #efefef;
}

.attachment-remove svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.composer-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}

.composer-tools,
.composer-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.composer-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: #b5b5b5;
}

.composer-icon:hover,
.composer-mode:hover {
  background: #2c2c2c;
}

.composer-icon.is-listening {
  background: rgba(255, 79, 145, .16);
  color: var(--accent);
  animation: listening 1.25s ease-in-out infinite;
}

.composer-icon svg,
.composer-mode svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.composer-mode {
  display: inline-flex;
  height: 29px;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  border-radius: 7px;
  color: #c5c5c5;
  font-size: 11px;
  white-space: nowrap;
}

.composer-mode .chevron {
  width: 12px;
  color: #777;
}

.composer-mode.active {
  color: var(--accent);
}

.composer-mode.muted {
  color: #767676;
}

.send-button {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #fff0f6;
}

.send-button:disabled {
  cursor: default;
  opacity: .72;
}

.send-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stop-icon,
.composer.is-generating .send-icon {
  display: none;
}

.composer.is-generating .stop-icon {
  display: block;
}

.message-list {
  width: min(760px, 100%);
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 11px;
  margin: 0 0 25px;
  color: #dedede;
  font-size: 14px;
  line-height: 1.65;
}

.message.user {
  justify-content: flex-end;
}

.message.user .message-body {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  background: #262626;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 7px;
}

.message-attachment {
  padding: 3px 7px;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #aaa;
  font-size: 10px;
  line-height: 1.3;
}

.message.assistant .message-body {
  min-width: 0;
  flex: 1;
}

.message-avatar {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: contain;
}

.message-content p {
  margin: 0 0 12px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content.burst {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.assistant-bubble {
  max-width: min(520px, 92%);
  padding: 8px 11px;
  border: 1px solid #2d2d2d;
  border-radius: 15px;
  background: #222;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 20px 0 8px;
  color: #f0f0f0;
  line-height: 1.3;
}

.message-content ul,
.message-content ol {
  margin: 7px 0 12px;
  padding-left: 22px;
}

.message-content pre {
  overflow: auto;
  padding: 13px;
  border: 1px solid #303030;
  border-radius: 9px;
  background: #111;
}

.message-content code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .9em;
}

.message-content a {
  color: #ff87b6;
}

.message-content blockquote {
  margin: 10px 0;
  padding-left: 12px;
  border-left: 2px solid #555;
  color: #aaa;
}

.message.error .message-content {
  color: #e0a4a4;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: #737373;
  font-size: 10px;
}

.message-action {
  display: grid;
  width: 25px;
  height: 25px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #777;
  cursor: pointer;
}

.message-action:hover {
  background: #252525;
  color: #bbb;
}

.message-action svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.thinking {
  display: inline-flex;
  gap: 4px;
  padding-top: 7px;
}

.thinking span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #888;
  animation: pulse 1.1s infinite ease-in-out;
}

.thinking span:nth-child(2) {
  animation-delay: .12s;
}

.thinking span:nth-child(3) {
  animation-delay: .24s;
}

.toast {
  position: fixed;
  z-index: 50;
  bottom: 18px;
  left: 50%;
  padding: 8px 12px;
  transform: translate(-50%, 12px);
  border: 1px solid #343434;
  border-radius: 8px;
  background: #262626;
  color: #dedede;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.panel-scrim {
  position: fixed;
  z-index: 22;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.panel-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.right-panel {
  position: fixed;
  z-index: 25;
  top: 0;
  right: 0;
  width: min(290px, 88vw);
  height: 100%;
  padding: 8px 14px;
  border-left: 1px solid var(--border);
  background: var(--sidebar);
  transform: translateX(100%);
  transition: transform .18s ease;
}

.right-panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  height: 38px;
  align-items: center;
  justify-content: space-between;
  padding-left: 2px;
}

.panel-header strong {
  font-size: 13px;
  font-weight: 600;
}

.detail-list {
  margin: 17px 0 0;
}

.detail-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  min-height: 36px;
  padding: 9px 2px;
  border-bottom: 1px solid #292929;
}

.detail-list dt {
  color: #858585;
  font-size: 11px;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #d0d0d0;
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-list dd.panel-online {
  color: var(--accent);
}

@keyframes pulse {
  0%, 80%, 100% { opacity: .28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

@keyframes listening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 79, 145, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 79, 145, .12); }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 228px;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }

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

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, .52);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .sidebar-scrim.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar {
    padding-left: 7px;
  }

  .empty-state {
    top: 28%;
  }

  .hero-greeting h1 {
    font-size: 21px;
  }

  .hello-kitty-hero {
    width: 38px;
    height: 38px;
  }

  .main-panel.is-empty .composer-dock {
    top: calc(28% + 64px);
  }

  .composer-dock {
    bottom: 10px;
    padding: 0 10px;
  }

  .composer {
    border-radius: 20px;
  }

  .composer-mode span,
  .composer-mode .chevron {
    display: none;
  }

  .composer-mode {
    width: 29px;
    justify-content: center;
    padding: 0;
  }

  .chat-content {
    padding: 24px 14px 132px;
  }
}

@media (max-height: 650px) and (min-width: 761px) {
  .empty-state {
    top: 27%;
  }

  .main-panel.is-empty .composer-dock {
    top: 36%;
  }
}

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