:root {
  color: #000;
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #fff;
}

#home {
  position: relative;
  display: block;
  width: 100vw;
  height: 100vh;
  background: #fff;
}

.conversation-menu-toggle {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;
  display: grid;
  align-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0 12px;
  color: #111;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.conversation-menu-toggle[hidden] {
  display: none;
}

.conversation-menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  border-radius: 999px;
}

.conversation-menu-toggle:hover,
.conversation-menu-toggle:focus-visible {
  border-color: rgba(0, 102, 255, 0.45);
  outline: 0;
}

.conversation-menu-toggle:disabled {
  cursor: default;
  opacity: 0.35;
}

.conversation-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
}

.conversation-menu-overlay[hidden],
.conversation-drawer[hidden] {
  display: none;
}

.conversation-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 28px));
  padding: 18px;
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 18px 0 45px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.conversation-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  font-size: 17px;
}

.conversation-menu-close {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: rgba(0, 0, 0, 0.64);
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 25px;
  cursor: pointer;
}

.conversation-menu-close:hover,
.conversation-menu-close:focus-visible {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
  outline: 0;
}

.new-conversation {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 14px 0 10px;
  padding: 10px 13px;
  color: #fff;
  background: #111;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.new-conversation:disabled {
  cursor: wait;
  opacity: 0.5;
}

.conversation-menu-status {
  min-height: 24px;
  padding: 3px 2px 8px;
  color: rgba(0, 0, 0, 0.52);
  font-size: 12px;
}

.conversation-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conversation-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  color: #111;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}

.conversation-list-item:hover,
.conversation-list-item:focus-visible {
  background: rgba(0, 0, 0, 0.035);
  border-color: rgba(0, 0, 0, 0.08);
  outline: 0;
}

.conversation-list-item.is-active {
  background: rgba(0, 102, 255, 0.065);
  border-color: rgba(0, 102, 255, 0.18);
}

.conversation-list-item strong,
.conversation-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list-item strong {
  font-size: 13px;
  font-weight: 650;
}

.conversation-list-item span {
  color: rgba(0, 0, 0, 0.55);
  font-size: 12px;
}

.conversation-list-item small {
  color: rgba(0, 0, 0, 0.38);
  font-size: 10px;
}

.conversation-drawer-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.logout-account {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: rgba(0, 0, 0, 0.66);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.logout-account:hover,
.logout-account:focus-visible {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.05);
  border-color: rgba(185, 28, 28, 0.12);
  outline: 0;
}

.logout-account:disabled {
  cursor: wait;
  opacity: 0.45;
}

.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;
}

.chat-log {
  height: 100vh;
  overflow-y: auto;
  padding: 72px max(18px, calc((100vw - 760px) / 2)) 136px;
  scroll-behavior: smooth;
}

.chat-log::before {
  content: "";
  display: block;
  height: var(--chat-spacer, 0px);
}

.message {
  display: flex;
  width: 100%;
  max-width: 760px;
  margin: 0 auto 28px;
  font-size: 15px;
  line-height: 1.62;
}

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

.message-assistant {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.message-content {
  min-width: 0;
  max-width: min(680px, 88%);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-user .message-content {
  padding: 9px 13px;
  color: #fff;
  background: #000;
  border-radius: 16px 16px 4px 16px;
}

.message-assistant .message-content {
  padding: 2px 0;
  color: #111;
}

.message-table-scroll {
  width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.message-table {
  width: 100%;
  min-width: 440px;
  border-collapse: collapse;
  white-space: normal;
  font-size: 14px;
  line-height: 1.45;
}

.message-table th,
.message-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid #e7e7e7;
}

.message-table th {
  color: #111;
  background: #f5f5f5;
  font-weight: 650;
}

.message-table tbody tr:last-child td {
  border-bottom: 0;
}

.message-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.message-table-scroll:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.generated-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  width: min(680px, 100%);
  margin-top: 14px;
}

.generated-image-link {
  display: block;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
}

.generated-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 680px;
  object-fit: contain;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 10px;
}

.message-speak {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 40px;
  margin: 0;
  padding: 8px 14px;
  color: rgba(0, 0, 0, 0.68);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease;
}

.message-speak-icon {
  display: inline-grid;
  min-width: 14px;
  place-items: center;
  color: rgba(0, 102, 255, 0.9);
  font-size: 11px;
  letter-spacing: -1px;
}

.message-speak:hover,
.message-speak:focus-visible,
.message-speak.is-playing {
  color: #000;
  background: rgba(0, 102, 255, 0.045);
  border-color: rgba(0, 102, 255, 0.5);
  outline: 0;
  transform: translateY(-1px);
}

.message-speak.is-loading {
  border-color: rgba(0, 102, 255, 0.28);
  cursor: progress;
}

.message-speak.is-loading .message-speak-icon {
  animation: speech-loading 900ms ease-in-out infinite;
}

.message-feedback {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.message-feedback-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: rgba(0, 0, 0, 0.46);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  filter: grayscale(1);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, filter 150ms ease;
}

.message-feedback-button:hover,
.message-feedback-button:focus-visible {
  color: #000;
  background: rgba(0, 0, 0, 0.045);
  border-color: rgba(0, 0, 0, 0.1);
  filter: grayscale(0.25);
  outline: 0;
}

.message-feedback-button.is-selected {
  color: #000;
  background: rgba(0, 102, 255, 0.08);
  border-color: rgba(0, 102, 255, 0.24);
  filter: grayscale(0);
}

.message-feedback-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.speech-visualizer {
  position: fixed;
  right: max(18px, calc((100vw - 760px) / 2));
  bottom: 94px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 12px;
  color: rgba(0, 0, 0, 0.72);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 102, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.speech-visualizer[hidden] {
  display: none;
}

.speech-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 30px;
  height: 20px;
}

.speech-wave i {
  display: block;
  width: 2px;
  height: 5px;
  background: rgba(0, 102, 255, 0.88);
  border-radius: 999px;
  transform-origin: center;
}

.speech-visualizer[data-state="loading"] .speech-wave i {
  animation: speech-loading 900ms ease-in-out infinite;
}

.speech-visualizer[data-state="playing"] .speech-wave i {
  animation: speech-wave 760ms ease-in-out infinite;
}

.speech-wave i:nth-child(2),
.speech-wave i:nth-child(6) { animation-delay: -120ms !important; }
.speech-wave i:nth-child(3),
.speech-wave i:nth-child(5) { animation-delay: -240ms !important; }
.speech-wave i:nth-child(4) { animation-delay: -360ms !important; }

@keyframes speech-wave {
  0%, 100% { height: 4px; opacity: 0.5; }
  50% { height: 19px; opacity: 1; }
}

@keyframes speech-loading {
  0%, 100% { opacity: 0.35; transform: scaleY(0.65); }
  50% { opacity: 1; transform: scaleY(1); }
}

.message-assistant.is-typing .message-content::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  border-right: 2px solid #111;
  transform: translateY(2px);
  animation: caret-blink 0.8s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.beta-notice {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  color: rgba(0, 0, 0, 0.48);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  transform: translateX(-50%);
  pointer-events: none;
}

.chat-form {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1;
  display: grid;
  grid-template-columns: 25px auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "geometry attach mic input submit"
    "status status status status status";
  align-items: end;
  gap: 8px;
  width: min(760px, calc(100vw - 32px));
  padding: 10px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  transform: translateX(-50%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.geometry-cursor {
  grid-area: geometry;
  align-self: center;
  display: grid;
  place-items: center;
  width: 25px;
  height: 28px;
  color: rgba(0, 102, 255, 0.72);
  pointer-events: none;
}

.geometry-cursor svg {
  width: 24px;
  height: 24px;
  overflow: visible;
  animation: tetra-breathe 5.6s ease-in-out infinite;
}

.geometry-cursor path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chat-form:focus-within .geometry-cursor {
  color: rgba(0, 102, 255, 0.88);
}

.chat-form:focus-within .geometry-cursor svg,
.chat-form.is-thinking .geometry-cursor svg {
  animation: tetra-turn 7.5s linear infinite, tetra-breathe 2.8s ease-in-out infinite;
}

.chat-form.is-thinking .geometry-cursor {
  color: rgba(0, 102, 255, 1);
}

.chat-form.is-slow {
  border-color: rgba(220, 38, 38, 0.42);
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.08);
}

.chat-form.is-slow .geometry-cursor {
  color: rgba(220, 38, 38, 1);
}

.chat-form.is-slow .geometry-cursor svg {
  animation: tetra-turn 1.35s linear infinite, tetra-breathe 1.1s ease-in-out infinite;
}

.chat-form.is-slow #chat-input::placeholder {
  color: rgba(220, 38, 38, 0.78);
}

.chat-attach {
  grid-area: attach;
  align-self: center;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(0, 0, 0, 0.62);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-attach:hover,
.chat-attach:focus-visible,
.chat-form.has-attachment .chat-attach {
  color: #000;
  border-color: rgba(0, 0, 0, 0.18);
  outline: 0;
}

.chat-form.has-attachment .chat-attach {
  background: rgba(0, 102, 255, 0.08);
  border-color: rgba(0, 102, 255, 0.28);
}

.chat-mic {
  grid-area: mic;
  align-self: center;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(0, 0, 0, 0.58);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.chat-mic svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.chat-mic:hover,
.chat-mic:focus-visible {
  color: #000;
  border-color: rgba(0, 0, 0, 0.18);
  outline: 0;
}

.chat-mic:disabled {
  cursor: default;
  opacity: 0.3;
}

.chat-form.is-recording .chat-mic {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
  animation: recording-pulse 1.2s ease-in-out infinite;
}

.chat-mic.is-transcribing {
  color: rgba(0, 102, 255, 1);
  border-color: rgba(0, 102, 255, 0.3);
}

.composer-status {
  grid-area: status;
  display: flex;
  min-width: 0;
  gap: 10px;
  padding: 2px 4px 0 41px;
  font-size: 12px;
  line-height: 1.3;
}

.attachment-status,
.voice-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-status {
  display: none;
  color: rgba(0, 102, 255, 0.9);
}

.voice-status {
  color: rgba(0, 0, 0, 0.62);
}

.chat-form.has-attachment .attachment-status {
  display: inline;
}

@keyframes recording-pulse {
  50% {
    box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.12);
  }
}

@keyframes tetra-turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tetra-breathe {
  0%,
  100% {
    opacity: 0.42;
    scale: 0.94;
  }

  50% {
    opacity: 0.74;
    scale: 1.06;
  }
}

#chat-input {
  grid-area: input;
  width: 100%;
  max-height: 180px;
  min-height: 28px;
  padding: 5px 4px;
  resize: none;
  overflow-y: auto;
  color: #000;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  line-height: 1.45;
}

#chat-input::placeholder {
  color: #8a8a8a;
}

#chat-submit {
  grid-area: submit;
  align-self: end;
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  color: #fff;
  background: #000;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#chat-submit:disabled {
  cursor: default;
  opacity: 0.35;
}

.chat-form.is-secret #chat-input {
  -webkit-text-security: disc;
  caret-color: #111;
}

@media (max-width: 640px) {
  .chat-log {
    padding: 72px 16px 118px;
  }

  .conversation-menu-toggle {
    top: 12px;
    left: 12px;
  }

  .conversation-drawer {
    width: min(340px, calc(100vw - 18px));
    padding: 14px;
  }

  .message {
    margin-bottom: 24px;
  }

  .beta-notice {
    bottom: 78px;
    width: calc(100vw - 24px);
  }

  .chat-form {
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .speech-visualizer {
    right: 12px;
    bottom: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .speech-wave i,
  .message-speak.is-loading .message-speak-icon {
    animation-duration: 1.8s !important;
  }
}
