* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

.container {
  width: min(90vw, 700px);
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 4px;
}

.subtitle {
  color: #6b7280;
  margin: 0 0 20px;
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  resize: vertical;
  min-height: 160px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#submitBtn {
  margin-top: 16px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: #2563eb;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#submitBtn:hover {
  background: #1d4ed8;
}

#submitBtn:active {
  transform: scale(0.98);
}

#results {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  background: #fafafa;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}

.card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.card.harmful {
  border-color: #fca5a5;
  background: #fef2f2;
}

.card.harmful h3 {
  color: #b91c1c;
}

.card.alternatives {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.card.alternatives h3 {
  color: #047857;
}

.alt-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alt-option {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
  color: #1a1a1a;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.alt-option:hover {
  border-color: #34d399;
  background: #ecfdf5;
}

.alt-option.selected {
  border-color: #059669;
  background: #d1fae5;
  font-weight: 600;
}

.alt-options.collapsed .alt-option-extra {
  display: none;
}

.more-options-btn,
.toggle-options-btn {
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: #047857;
  background: #ffffff;
  border: 1px dashed #34d399;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.more-options-btn:hover,
.toggle-options-btn:hover {
  background: #ecfdf5;
  border-color: #059669;
}

.more-options-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.card.error {
  border-color: #fcd34d;
  background: #fffbeb;
}

.card.error h3 {
  color: #b45309;
}

.retry-btn {
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #b45309;
  background: #ffffff;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.retry-btn:hover {
  background: #fef3c7;
}

.status-message {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  color: #374151;
  background: #f9fafb;
}

.api-docs {
  margin-top: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  background: #f9fafb;
}

.api-docs summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a1a;
}

.api-docs summary::-webkit-details-marker {
  color: #6b7280;
}

.api-docs[open] summary {
  margin-bottom: 12px;
}

.api-docs h3 {
  margin: 16px 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}

.api-docs h3:first-of-type {
  margin-top: 4px;
}

.api-docs p {
  margin: 0 0 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
}

.api-docs code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 4px;
}

.api-docs pre {
  margin: 0;
  padding: 12px 14px;
  background: #111827;
  border-radius: 8px;
  overflow-x: auto;
}

.api-docs pre code {
  background: none;
  padding: 0;
  color: #e5e7eb;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.api-docs-footer {
  margin-top: 14px !important;
  font-size: 0.85rem !important;
}

.api-docs-footer a {
  color: #2563eb;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.4rem;
  }

  #submitBtn {
    width: 100%;
  }
}
