@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,500;0,700;1,500&display=swap");

:root {
  /* Palette adapted from accelerate-iver.com: warm off-white, ink text,
     rust accent, black pill buttons, editorial serif headings. */
  --bg: #faf8f4;
  --card: #ffffff;
  --border: #e7e2d9;
  --text: #13181f;
  --muted: #746f63;
  --primary: #13181f;
  --primary-hover: #2b323d;
  --accent: #9d2618;
  --accent-hover: #7e1e13;
  --danger: #b3261e;
  --danger-hover: #8f1e18;
  --success: #16a34a;
  --pending: #b45f06;
  --shadow: 0 1px 2px rgba(19, 24, 31, 0.04), 0 6px 16px rgba(19, 24, 31, 0.06);
  --radius: 20px;
  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero {
  position: relative;
  overflow: hidden;
  height: clamp(320px, 44vw, 520px);
  background: #0b0e12;
  margin-bottom: 4px;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 15, 0.05) 0%, rgba(10, 12, 15, 0.25) 45%, rgba(10, 12, 15, 0.75) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.hero-heading {
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.8rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  margin: 0;
  max-width: 640px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 999px;
  padding: 10px 10px 10px 24px;
  box-shadow: var(--shadow);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  height: 20px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.brand-app-name {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.field-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  background: #fbfaf7;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.settings-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fetch-models-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fetch-models-row .muted.error-text {
  color: var(--danger);
}

#addPromptForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.model-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  background: #fbfaf7;
  transition: background 0.15s, border-color 0.15s;
}

.model-chip input {
  accent-color: var(--accent);
}

.model-chip.checked {
  background: #f6e9e6;
  border-color: var(--accent);
  color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f1ede4; }

.btn-danger {
  background: #f6e5e3;
  color: var(--danger);
}
.btn-danger:hover { background: #f0d5d1; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 999px;
}

.filter-bar {
  display: flex;
  gap: 8px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.prompt-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prompt-group-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prompt-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.prompt-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.prompt-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.group-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fbfaf7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.model-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-pending, .status-running {
  background: #fef3c7;
  color: var(--pending);
}

.status-done {
  background: #dcfce7;
  color: var(--success);
}

.status-error {
  background: #fee2e2;
  color: var(--danger);
}

.result-output {
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 260px;
  overflow-y: auto;
}

.result-output.error-text {
  color: var(--danger);
}

.result-time {
  font-size: 0.72rem;
  color: var(--muted);
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 32px 0;
}

.compare-select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.compare-select input {
  accent-color: var(--accent);
}

.result-card.selected-for-compare {
  border-color: var(--accent);
  background: #f6e9e6;
}

.compare-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
  z-index: 20;
}

.compare-bar .muted {
  color: #d1d5db;
}

.compare-bar-actions {
  display: flex;
  gap: 8px;
}

.compare-bar .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.compare-bar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 640px) {
  .compare-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    width: auto;
    justify-content: space-between;
  }
}

.compare-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compare-back {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.compare-back:hover {
  text-decoration: underline;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.compare-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compare-card .prompt-text {
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.ai-summary {
  border-color: var(--accent);
  background: #fdf6f4;
}

.ai-summary h2 {
  color: var(--accent);
}

.ai-summary-body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.ai-summary-body.muted {
  font-style: italic;
}

.ai-summary-body.error-text {
  color: var(--danger);
}

.ai-summary-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .app { padding: 16px 12px 48px; }
  .prompt-group-header { flex-direction: column; }
  .group-actions { align-self: flex-end; }
}

@media (max-width: 480px) {
  .topbar { padding: 8px 8px 8px 14px; gap: 8px; }
  .topbar-brand { gap: 10px; }
  .brand-logo { height: 16px; }
  .brand-app-name { font-size: 0.78rem; }
  .btn-primary#settingsToggle { padding: 8px 14px; font-size: 0.8rem; }
}
