/* ------------------------------
   CHAT LAYOUT
------------------------------ */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ------------------------------
   CHAT HEADER
------------------------------ */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 6;
  overflow: visible;
}

.chat-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

.chat-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 7;
}

.chat-action-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.24) 0%, rgba(9, 22, 44, 0.26) 54%, rgba(0, 0, 0, 0.3) 100%);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chat-action-btn:hover,
.chat-action-btn:focus {
  outline: none;
  border-color: rgba(15, 82, 186, 0.58);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.3) 0%, rgba(9, 22, 44, 0.32) 54%, rgba(0, 0, 0, 0.34) 100%);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.14);
}

.chat-action-btn.is-active,
.chat-action-btn[aria-pressed="true"] {
  border-color: rgba(15, 82, 186, 0.78);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.44) 0%, rgba(11, 58, 132, 0.4) 52%, rgba(0, 0, 0, 0.34) 100%);
}

.chat-admin-input {
  height: 38px;
  padding: 0 10px;
  min-width: 180px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
}

.chat-admin-input:focus {
  outline: none;
  border-color: rgba(15, 82, 186, 0.62);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.15);
}

.model-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-control {
  position: relative;
  z-index: 8;
}

.model-selector label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  margin-left: 2px;
  animation: rainbow-shift 50s linear infinite;
}

.model-selector select,
#model {
  height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-width: 160px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322C55E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.chat-control-btn {
  height: 42px;
  padding: 10px 14px;
  padding-right: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.24) 0%, rgba(9, 22, 44, 0.26) 54%, rgba(0, 0, 0, 0.3) 100%);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-width: 160px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(14px) saturate(140%);
  text-align: left;
  position: relative;
  animation: rainbow-shift 50s linear infinite;
}

.chat-control-btn::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.86);
  border-bottom: 2px solid rgba(255, 255, 255, 0.86);
  transform: translateY(-60%) rotate(45deg);
  transition: transform 0.16s ease;
}

.dropdown-control.open .chat-control-btn::after {
  transform: translateY(-30%) rotate(225deg);
}

.chat-control-btn:hover {
  border-color: rgba(15, 82, 186, 0.52);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.3) 0%, rgba(9, 22, 44, 0.32) 54%, rgba(0, 0, 0, 0.34) 100%);
}

.chat-control-btn:focus {
  outline: none;
  border-color: rgba(15, 82, 186, 0.72);
  background: linear-gradient(135deg, rgba(15, 82, 186, 0.36) 0%, rgba(11, 58, 132, 0.34) 52%, rgba(0, 0, 0, 0.32) 100%);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.18), 0 0 12px var(--accent-glow);
}

.chat-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: 100%;
  max-width: 280px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(14, 14, 14, 0.96);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.42), 0 0 12px rgba(15, 82, 186, 0.16);
  backdrop-filter: blur(14px) saturate(140%);
  z-index: 50;
  display: none;
}

.dropdown-control.open .chat-dropdown {
  display: grid;
  gap: 4px;
}

.chat-dropdown.open {
  display: grid;
  gap: 4px;
}

.chat-dropdown-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chat-dropdown-item:hover,
.chat-dropdown-item:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(15, 82, 186, 0.4);
}

.chat-dropdown-item.is-active {
  background: rgba(15, 82, 186, 0.16);
  border-color: rgba(15, 82, 186, 0.48);
  color: #fff;
}

.model-selector select:hover,
#model:hover {
  border-color: rgba(15, 82, 186, 0.52);
  background: rgba(255, 255, 255, 0.07);
}

.model-selector select:focus,
#model:focus {
  outline: none;
  border-color: rgba(15, 82, 186, 0.72);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.18), 0 0 12px var(--accent-glow);
}

#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
}


.jump-to-latest {
  position: absolute;
  right: 18px;
  bottom: 74px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(14, 14, 14, 0.84);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 10px rgba(15, 82, 186, 0.22);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.2s ease;
}

.jump-to-latest.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.jump-to-latest:hover {
  border-color: rgba(15, 82, 186, 0.78);
}

.simulation-badge {
  border: 1px solid rgba(15, 82, 186, 0.5);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text);
  background: rgba(15, 82, 186, 0.16);
}


.simulation-panel {
  border-top: 1px solid var(--border);
  padding: 10px 20px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.simulation-panel > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.simulation-controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.simulation-rules-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.simulation-rules-editor {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  padding: 10px;
}

.simulation-log-wrap {
  margin-top: 10px;
}

.simulation-log-wrap strong {
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.simulation-log {
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
}

.simulation-log-entry {
  margin-bottom: 6px;
}

.simulation-log-entry:last-child {
  margin-bottom: 0;
}

#chat-area.simulation-active {
  box-shadow: 0 0 0 1px rgba(15, 82, 186, 0.34), 0 0 24px rgba(15, 82, 186, 0.18) inset;
}

/* ------------------------------
   CHAT CONTAINER
------------------------------ */
#chat-container,
#chat-messages {
  flex: 1;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* ------------------------------
   THEMED SCROLLBARS
------------------------------ */
#chat-container,
#chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 82, 186, 0.55) rgba(255, 255, 255, 0.12);
}

#chat-container::-webkit-scrollbar,
#chat-messages::-webkit-scrollbar {
  width: 10px;
}

#chat-container::-webkit-scrollbar-track,
#chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

#chat-container::-webkit-scrollbar-thumb,
#chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(15, 82, 186, 0.72) 0%,
    rgba(27, 64, 128, 0.64) 54%,
    rgba(12, 17, 32, 0.58) 100%
  );
  border-radius: 999px;
  border: 2px solid rgba(14, 14, 14, 0.72);
  animation: rainbow-shift 50s linear infinite;
}

#chat-container::-webkit-scrollbar-thumb:hover,
#chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(15, 82, 186, 0.9) 0%,
    rgba(31, 74, 148, 0.8) 56%,
    rgba(12, 17, 32, 0.72) 100%
  );
}

/* ------------------------------
   MESSAGE BUBBLES
------------------------------ */
.message {
  padding: 0;
  margin: 12px 0;
  border-radius: 0;
  max-width: 100%;
  width: 100%;
  line-height: 1.6;
  font-size: 15px;
  font-weight: 400;
  color: #f5f3f0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.message.user {
  align-self: stretch;
}

.message.user .message-body,
.message.user .message-body p {
  color: #0f52ba;
}

.message.user .message-body a,
.message.user .message-body a:visited,
.message.user .message-body .md-inline-code,
.message.user .message-body code,
.message.user .message-body .md-code,
.message.user .message-body pre,
.message.user .message-body pre code,
.message.user .message-body pre code * {
  color: #0f52ba !important;
}

.message.bot {
  align-self: stretch;
}

.message.typing {
  opacity: 0.6;
  font-style: italic;
}

.message-body,
.message-body p {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

.generated-image-spacer {
  height: 10px;
}

.generated-image-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  max-width: min(100%, 520px);
}

.generated-image-preview {
  width: 100%;
  height: auto;
  display: block;
  border-bottom: 1px solid var(--border);
}

.generated-image-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.generated-image-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}

.generated-image-download:hover,
.generated-image-download:focus {
  border-color: rgba(15, 82, 186, 0.66);
  background: rgba(15, 82, 186, 0.2);
}

.generated-image-meta {
  color: var(--text-dim);
  font-size: 12px;
  white-space: normal;
}

.generated-media-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  max-width: min(100%, 620px);
}

.generated-media-viewer {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
}

.generated-media-viewer {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}

.generated-media-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.generated-media-fullscreen {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  cursor: pointer;
}

.generated-media-fullscreen:hover,
.generated-media-fullscreen:focus {
  border-color: rgba(15, 82, 186, 0.66);
  background: rgba(15, 82, 186, 0.2);
}


.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.message-role {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message-badge {
  margin-left: 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.message-timestamp {
  color: var(--text-dim);
  font-size: 11px;
  opacity: 0.8;
}

.message-body .md-inline-code,
.message-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.message-body .md-code,
.message-body pre {
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.message-body ul {
  margin: 8px 0;
  padding-left: 18px;
}

.message-body li {
  margin: 4px 0;
}

.message-user {
  font-weight: 600;
}

.message-user .message-role,
.message-user .message-body {
  color: #0f52ba;
}

.message-assistant {
  font-weight: 400;
}

.message-assistant .message-role,
.message-assistant .message-body {
  color: #f5f3f0;
}

#chat-container.chat-compact,
#chat-messages.chat-compact {
  gap: 8px;
}

#chat-container.chat-compact .message,
#chat-messages.chat-compact .message {
  margin: 4px 0;
}

#chat-container.chat-font-small,
#chat-messages.chat-font-small {
  font-size: 13px;
}

#chat-container.chat-font-small .message-body,
#chat-messages.chat-font-small .message-body {
  font-size: 13px;
}

#chat-container.chat-font-medium,
#chat-messages.chat-font-medium {
  font-size: 15px;
}

#chat-container.chat-font-medium .message-body,
#chat-messages.chat-font-medium .message-body {
  font-size: 15px;
}

#chat-container.chat-font-large,
#chat-messages.chat-font-large {
  font-size: 17px;
}

#chat-container.chat-font-large .message-body,
#chat-messages.chat-font-large .message-body {
  font-size: 17px;
  line-height: 1.7;
}

/* ------------------------------
   INPUT AREA
------------------------------ */
#input-area {
  display: flex;
  gap: 10px;
  padding: 16px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px) saturate(140%);
}

#user-input {
  flex: 1;
  height: 44px;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#user-input::placeholder {
  color: rgba(229, 231, 235, 0.56);
}

#send-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 14px rgba(15, 82, 186, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
  animation: rainbow-shift 50s linear infinite;
}

#send-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

#send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}
@keyframes pulseGlow {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}
#input-area {
  backdrop-filter: blur(14px);
}

#user-input:focus {
  outline: none;
  border-color: rgba(15, 82, 186, 0.72);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.18), 0 0 12px var(--accent-glow);
}

.age-gate-composer-notice {
  margin: 0 16px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

.age-gate-composer-notice[hidden] {
  display: none !important;
}

#legal-attestation-composer-notice {
  display: grid;
  gap: 10px;
}

#open-legal-attestation-btn {
  width: fit-content;
  height: 34px;
  font-size: 12px;
  padding: 0 10px;
}

.legal-attestation-form {
  display: grid;
  gap: 12px;
}

.legal-attestation-jurisdiction {
  display: grid;
  gap: 6px;
}

.legal-attestation-jurisdiction input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  padding: 10px;
}

.legal-attestation-checks {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.legal-attestation-checks label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}

.legal-attestation-links {
  font-size: 12px;
  color: var(--text-dim);
}

.legal-attestation-links a {
  color: var(--text-primary);
}

.typing-indicator {
  margin: 0 16px 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

@media (max-width: 960px) {
  html,
  body {
    height: var(--omni-vvh, 100dvh);
    min-height: var(--omni-vvh, 100dvh);
    overflow: hidden;
  }

  #layout {
    height: var(--omni-vvh, 100dvh);
    min-height: var(--omni-vvh, 100dvh);
    overflow: hidden;
  }

  #main.chat-main {
    height: auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px;
  }

  .chat-main {
    min-height: var(--omni-vvh, 100dvh);
  }

  .chat-main > .site-footer {
    display: none;
  }

  .chat-header h2,
  .chat-subtitle {
    display: none;
  }

  .chat-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .chat-subtitle {
    font-size: 12px;
  }

  .chat-controls {
    width: 100%;
    gap: 8px;
  }

  .model-selector {
    flex: 1;
    min-width: 0;
  }

  .chat-control-btn,
  .chat-admin-input {
    min-width: 0;
    width: 100%;
    height: 40px;
    font-size: 14px;
  }

  .chat-dropdown {
    left: 0;
    right: 0;
    max-width: 100%;
  }

  #chat-area {
    border-radius: 10px;
    min-height: 0;
    height: 100%;
    width: 100%;
    margin: 0 auto;
  }

  #chat-container,
  #chat-messages {
    flex: 1 1 auto;
    padding: 14px;
    gap: 12px;
  }

  .message {
    font-size: 14px;
    line-height: 1.55;
  }

  .generated-image-card,
  .generated-media-card {
    max-width: 100%;
  }

  #input-area {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 10px;
    gap: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  #user-input,
  .chat-admin-input,
  .simulation-rules-editor,
  .legal-attestation-jurisdiction input {
    font-size: 16px;
  }

  #send-btn {
    height: 44px;
    font-size: 14px;
    padding: 0 14px;
  }

  .jump-to-latest {
    right: 12px;
    bottom: 84px;
  }

  body.mobile-input-active .chat-subtitle {
    display: none;
  }

  body.mobile-keyboard-open #chat-container,
  body.mobile-keyboard-open #chat-messages {
    padding-bottom: 8px;
  }
}

@media (max-width: 640px) {
  #chat-container,
  #chat-messages {
    padding: 12px;
  }

  #input-area {
    padding: 8px;
  }

  #send-btn {
    min-width: 82px;
  }
}

@media (max-width: 380px) {
  .chat-header {
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .chat-header h2 {
    font-size: 18px;
  }

  .chat-subtitle {
    font-size: 11px;
  }

  .chat-controls {
    gap: 6px;
  }

  .model-selector label {
    font-size: 10px;
  }

  .chat-control-btn {
    height: 38px;
    font-size: 13px;
    padding: 8px 12px;
    padding-right: 34px;
  }

  #chat-container,
  #chat-messages {
    padding: 10px;
    gap: 10px;
  }

  .message {
    font-size: 13px;
    line-height: 1.5;
  }

  #input-area {
    gap: 6px;
    padding: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  #user-input {
    min-width: 0;
    height: 42px;
    padding: 8px 12px;
  }

  #send-btn {
    height: 42px;
    min-width: 72px;
    font-size: 12px;
    padding: 0 10px;
  }

  .jump-to-latest {
    right: 8px;
    bottom: 78px;
    font-size: 11px;
    padding: 5px 10px;
  }
}