:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans",
    Arial,
    sans-serif;
  color: #242830;
  background: #fff;
  font-synthesis: none;
  letter-spacing: 0;
  color-scheme: light;
  --accent: #0b6fe8;
  --muted: #707784;
  --border: #e3e6eb;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button,
select,
input,
textarea {
  outline-offset: 4px;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
}
button svg {
  width: 19px;
  height: 19px;
  flex: none;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
input,
textarea,
select {
  color: inherit;
}
h1,
h2,
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  display: flex;
  flex-direction: column;
  background: #f4f5f7;
  border-right: 1px solid var(--border);
  min-height: 0;
  padding: 22px 12px 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}
.brand > svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex: none;
}
.brand span,
.brand h1 {
  font-size: 20px;
  font-weight: 650;
}
.sidebar .brand {
  padding: 0 8px;
  gap: 10px;
}
.new-chat {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  color: #1464c9;
  background: #e2edfc;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-weight: 550;
  font-size: 14px;
}
.new-chat:hover {
  background: #d5e6fc;
}
.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px 6px 8px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}
.icon-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex: none;
}
.icon-button:hover {
  background: #e8ebef;
}
.history {
  overflow: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.history-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  border-radius: 6px;
  height: 40px;
  padding: 0 8px;
  margin: 0 0 2px;
}
.history-item:hover {
  background: #e9ecf1;
}
.history-item.active {
  background: #dceaff;
}
.history-item > svg {
  width: 18px;
  height: 18px;
  color: #747d8a;
}
.history-item.active > svg {
  color: var(--accent);
}
.history-title {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 450;
  line-height: 22px;
}
.history-time {
  font-size: 11px;
  color: var(--muted);
  line-height: 22px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.history-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 13px;
}
.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.text-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  padding: 9px 12px;
  color: #616b79;
  border-radius: 5px;
}
.text-button:hover {
  background: #e8ebef;
  color: #242830;
}
.sidebar-footer .text-button {
  margin-top: 6px;
  justify-content: flex-start;
  min-height: 36px;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.chat-header {
  height: 72px;
  flex: none;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
}
.chat-heading {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.chat-heading h1 {
  font-size: 19px;
  font-weight: 650;
  line-height: 27px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.chat-heading > span {
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.comparison {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.comparison input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch {
  display: block;
  width: 38px;
  height: 22px;
  background: #bdc4ce;
  border-radius: 20px;
  position: relative;
  transition: background 0.15s;
}
.switch:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px #0002;
  transition: transform 0.15s;
}
.comparison input:checked + .switch {
  background: var(--accent);
}
.comparison input:checked + .switch:before {
  transform: translateX(16px);
}
.comparison input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.messages {
  flex: 1;
  overflow: auto;
  min-height: 0;
  scrollbar-width: thin;
}
.message-list {
  max-width: 1180px;
  padding: 28px 32px 12px;
  margin: 0 auto;
}
.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 340px;
  color: var(--muted);
}
.empty-chat > svg {
  width: 38px;
  height: 38px;
  stroke-width: 1.3;
  color: #8b9db6;
}
.empty-chat h2 {
  font-size: 19px;
  font-weight: 500;
  color: #677386;
}
.turn-time {
  text-align: center;
  color: #89919e;
  font-size: 11px;
  margin: 5px 0 25px;
}
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
  min-width: 0;
}
.message-row.user {
  justify-content: flex-end;
}
.avatar {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 2px;
  border-radius: 50%;
  color: white;
  background: var(--accent);
}
.user .avatar {
  background: #8d95a3;
}
.avatar svg {
  width: 19px;
  height: 19px;
}
.bubble {
  max-width: min(82%, 760px);
  min-width: 0;
  border-radius: 16px;
  padding: 14px 18px;
  background: #eef0f3;
  line-height: 1.7;
  font-size: 15px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.user .bubble {
  background: var(--accent);
  color: #fff;
}
.translation {
  border-top: 1px solid #d7dce3;
  margin-top: 10px;
  padding-top: 8px;
}
.translation-label {
  font-size: 11px;
  color: #657080;
  line-height: 1.5;
  margin-bottom: 4px;
  white-space: normal;
}
.translation-text {
  font-size: 14px;
  line-height: 1.7;
}
.user .translation {
  border-color: #ffffff40;
}
.user .translation-label {
  color: #fff;
}
.hide-comparison .translation {
  display: none;
}
.stage-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #526175;
  font-size: 13px;
  white-space: normal;
}
.processing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 29px;
  height: 18px;
}
.processing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.processing-dot:nth-child(2) {
  animation-delay: 0.16s;
}
.processing-dot:nth-child(3) {
  animation-delay: 0.32s;
}
.stage-detail {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}
.error-bubble {
  background: #fff3f3;
  border: 1px solid #efdbdd;
}
.error-title {
  font-size: 13px;
  font-weight: 600;
  color: #a63d48;
  white-space: normal;
}
.error-body {
  font-size: 13px;
  line-height: 1.7;
  margin-top: 6px;
  color: #855660;
  white-space: normal;
}
.retry-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0 0;
  color: #a63d48;
  font-size: 12px;
}
.retry-button svg {
  width: 14px;
  height: 14px;
}
.composer-area {
  flex: none;
  padding: 12px 32px 22px;
  background: #fff;
}
.composer-caption {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.composer {
  display: grid;
  gap: 6px;
  min-height: 122px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 12px 14px 12px 18px;
  max-width: 1116px;
  margin: auto;
  background: #f2f3f5;
  box-shadow: 0 2px 6px #202a3a05;
}
.composer:focus-within {
  border-color: #94baf0;
  box-shadow: 0 0 0 3px #0b6fe80a;
}
.composer textarea {
  min-width: 0;
  width: 100%;
  border: 0;
  resize: none;
  line-height: 1.6;
  font-size: 15px;
  min-height: 52px;
  max-height: 150px;
  background: transparent;
  outline: none;
}
.composer textarea::placeholder {
  color: #9099a7;
}
.send-button {
  width: 38px;
  height: 38px;
  flex: none;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px #0b6fe81a;
}
.send-button:hover {
  background: #095dc4;
}
.send-button:disabled {
  background: #d7dde6;
  color: #77869a;
  opacity: 1;
  box-shadow: none;
}
.notice {
  padding: 12px 36px;
  font-size: 13px;
  background: #fff3f3;
  color: #a63d48;
  line-height: 1.6;
}
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: #f4f5f7;
  padding: 24px;
}
.login-form {
  width: 360px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 12px 36px #202a3a0a;
}
.login-form .brand {
  margin-bottom: 32px;
}
.login-form > label {
  display: block;
  font-size: 13px;
  color: #687384;
  margin-bottom: 8px;
}
.login-form input {
  width: 100%;
  border: 1px solid #d4dce7;
  border-radius: 6px;
  padding: 12px;
  font-size: 16px;
  background: white;
}
.primary {
  background: var(--accent);
  color: white;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
}
.error-text {
  font-size: 12px;
  color: #a63d48;
  min-height: 36px;
  padding: 9px 0;
}
.mobile-only {
  display: none;
}
.sidebar-shade {
  display: none;
}
dialog {
  width: 360px;
  max-width: calc(100% - 32px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  color: inherit;
}
dialog::backdrop {
  background: #19233355;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-heading h2 {
  font-size: 18px;
}
.language-choice {
  display: grid;
  grid-template-columns: 1fr auto 18px;
  width: 100%;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 17px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.language-choice span:nth-child(2) {
  color: var(--muted);
  font-size: 12px;
}
.older {
  margin: 0 auto 24px;
}
.loading {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 13px;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
    transform: translateY(-3px);
  }
}
@media (min-width: 1600px) {
  .app {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    max-width: 85%;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.18s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar .brand {
    padding-left: 4px;
    gap: 8px;
  }
  .sidebar .brand > span {
    flex: 1;
  }
  .sidebar-shade {
    display: block;
    position: fixed;
    inset: 0;
    background: #19233355;
    z-index: 15;
    width: 100%;
    height: 100%;
  }
  .mobile-only {
    display: inline-flex;
  }
  .chat-header {
    height: 70px;
    padding: 12px 14px;
    gap: 8px;
  }
  .chat-heading h1 {
    font-size: 16px;
    line-height: 23px;
  }
  .chat-heading {
    display: block;
  }
  .chat-heading > span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
  }
  .comparison {
    gap: 6px;
    font-size: 11px;
  }
  .switch {
    width: 34px;
    height: 20px;
  }
  .switch:before {
    width: 16px;
    height: 16px;
  }
  .comparison input:checked + .switch:before {
    transform: translateX(14px);
  }
  .message-list {
    padding: 23px 14px;
  }
  .bubble {
    max-width: calc(100% - 38px);
    padding: 12px 14px;
    font-size: 14px;
  }
  .message-row {
    gap: 8px;
    margin-bottom: 22px;
  }
  .avatar {
    width: 30px;
    height: 30px;
  }
  .translation-text {
    font-size: 13px;
  }
  .composer-area {
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  }
  .composer {
    padding: 12px;
  }
  .composer textarea {
    font-size: 16px;
    min-height: 52px;
  }
  .notice {
    padding: 10px 16px;
  }
  .empty-chat {
    min-height: 250px;
  }
  .composer-caption {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
