* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.6;
  background: #f6f7fb;
  color: #222;
}

.sr-only {
  position: absolute;
  left: -9999px;
}

/* ===== Ad Banner ===== */

.ad-banner {
  width: 100%;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.ad-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: #475569;
}

.ad-label {
  font-weight: 600;
}

.ad-copy {
  opacity: 0.8;
}

/* ===== Header ===== */

.site-header {
  background: #1e293b;
  color: white;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-brand {
  display: flex;
  flex-direction: column;
}

.site-title {
  margin: 0;
  font-size: 20px;
}

.site-tagline {
  margin: 0;
  font-size: 13px;
  opacity: 0.8;
}

/* ===== Tabs ===== */

.site-tabs {
  display: flex;
  gap: 12px;
}

.tab-link {
  appearance: none;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-weight: 500;
  font-size: 15px;
  padding: 0 0 6px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-link:hover {
  color: white;
}

.tab-link-active {
  border-bottom-color: #60a5fa;
  color: white;
}

/* ===== Main Container ===== */

.app-main {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
}

/* ===== Tab Panels ===== */

.tab-panel {
  display: block;
}

.tab-panel-hidden {
  display: none;
}

/* ===== Chat Panel ===== */

.chat-panel {
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-panel-header {
  display: flex;
  flex-direction: column;
}

.panel-title {
  margin: 0;
  font-size: 22px;
}

.panel-subtitle {
  margin: 4px 0 0 0;
  font-size: 14px;
  color: #64748b;
}

/* ===== Download Panel ===== */

.download-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 8px;
}

.download-copy h3 {
  margin: 0;
  font-size: 16px;
}

.download-copy p {
  margin: 6px 0 0 0;
  font-size: 14px;
  color: #475569;
}

.download-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.model-status {
  font-size: 14px;
  color: #64748b;
}

/* ===== Buttons ===== */

.primary-button {
  border: none;
  background: #2563eb;
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.primary-button:hover {
  background: #1d4ed8;
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Chat Transcript ===== */

.chat-transcript-section {
  display: flex;
  flex-direction: column;
}

.chat-messages {
  height: 380px;
  overflow-y: auto;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== Messages ===== */

.chat-message {
  display: flex;
}

.chat-message-inner {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.chat-message-user .chat-message-inner {
  background: #2563eb;
  color: white;
}

.chat-message-assistant {
  justify-content: flex-start;
}

.chat-message-assistant .chat-message-inner {
  background: white;
  border: 1px solid #e2e8f0;
}

/* ===== Chat Input ===== */

.chat-input-form {
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  font-size: 14px;
}

.chat-input:focus {
  outline: none;
  border-color: #2563eb;
}

/* ===== About Panel ===== */

.about-panel {
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  padding: 24px;
}

.about-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
}

.about-list {
  margin: 6px 0 0 0;
  padding-left: 20px;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  .app-main {
    margin: 20px auto;
    padding: 0 12px;
  }

  .chat-panel,
  .about-panel {
    padding: 16px;
  }

  .chat-messages {
    height: 320px;
  }

  .chat-input-form {
    flex-direction: column;
  }

  .chat-message-inner {
    max-width: 85%;
  }
}