:root {
  color-scheme: dark;
  --gemini-blue: #2e86ff;
  --gemini-blue-soft: #749bff;
  --gemini-green: #00b95c;
  --gemini-yellow: #fbbc04;
  --gemini-red: #fc413d;
  --bg: #0b0f16;
  --bg-glow: radial-gradient(circle at 15% 10%, rgba(46, 134, 255, 0.3), transparent 50%),
    radial-gradient(circle at 80% 15%, rgba(252, 65, 61, 0.18), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(0, 185, 92, 0.2), transparent 45%);
  --panel: #141a24;
  --panel-soft: #1c2431;
  --ink: #f5f7fb;
  --muted: #b5bac7;
  --accent: #2e86ff;
  --accent-deep: #00b95c;
  --cool: #fbbc04;
  --chip: rgba(255, 255, 255, 0.06);
  --input: #0f141d;
  --border: rgba(255, 255, 255, 0.1);
  --grid: rgba(255, 255, 255, 0.04);
  --shadow: 0 30px 80px rgba(3, 6, 12, 0.65);
  --radius: 26px;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-glow: radial-gradient(circle at 10% 10%, rgba(46, 134, 255, 0.2), transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(252, 65, 61, 0.16), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(0, 185, 92, 0.16), transparent 50%);
  --panel: #ffffff;
  --panel-soft: #f0f3f9;
  --ink: #11151c;
  --muted: #4d5460;
  --accent: #2e86ff;
  --accent-deep: #fc413d;
  --cool: #00b95c;
  --chip: rgba(0, 0, 0, 0.04);
  --input: #f6f8fc;
  --border: rgba(0, 0, 0, 0.08);
  --grid: rgba(0, 0, 0, 0.04);
  --shadow: 0 22px 50px rgba(34, 45, 66, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Archivo", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px 56px;
  position: relative;
  overflow: hidden;
  background-image: var(--bg-glow),
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: auto, 140px 140px, 140px 140px;
}

.stage::before,
.stage::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.6;
  z-index: 0;
}

.stage::before {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(46, 134, 255, 0.45), transparent 70%);
  top: -80px;
  right: -40px;
}

.stage::after {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(0, 185, 92, 0.32), transparent 70%);
  bottom: -120px;
  left: -80px;
}

.panel {
  width: min(560px, 100%);
  background: linear-gradient(160deg, var(--panel), var(--panel-soft));
  padding: 32px 28px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
}

.hero {
  display: grid;
  gap: 10px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--cool);
  margin: 0;
  font-family: "Syne", "Trebuchet MS", sans-serif;
}

.hero h1 {
  font-family: "Syne", "Trebuchet MS", sans-serif;
  font-size: clamp(2rem, 6vw, 2.6rem);
  margin: 0;
}

.subhead {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

.search {
  display: grid;
  gap: 16px;
}

.search textarea {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--input);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, height 0.2s ease;
  color: var(--ink);
  min-height: 54px;
  max-height: 200px;
  resize: none;
  overflow-y: auto;
  line-height: 1.5;
  width: 100%;
}

.search textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 134, 255, 0.3);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 12px;
}

button {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

.primary {
  background: linear-gradient(120deg, var(--accent), var(--gemini-green), var(--gemini-yellow));
  color: white;
  box-shadow: 0 14px 30px rgba(46, 134, 255, 0.35);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: 0 8px 20px rgba(46, 134, 255, 0.2);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.toggle {
  background: var(--chip);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.75rem;
  padding: 8px 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  background: var(--chip);
  color: var(--ink);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.chip-active {
  background: var(--accent);
  color: white;
  transform: scale(1.05);
  border-color: var(--accent);
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.history-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost.small {
  font-size: 0.8rem;
  padding: 6px 12px;
}

.settings {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.settings.info {
  background: linear-gradient(140deg, rgba(46, 134, 255, 0.12), rgba(0, 185, 92, 0.08));
}

.settings summary {
  cursor: pointer;
  font-weight: 600;
}

.settings-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.settings input {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: var(--input);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings input.error {
  border-color: var(--gemini-red);
  box-shadow: 0 0 0 2px rgba(252, 65, 61, 0.2);
}

.error-message {
  margin: 4px 0 0;
  color: var(--gemini-red);
  font-size: 0.8rem;
  min-height: 1rem;
  font-weight: 500;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.settings a {
  color: var(--cool);
  text-decoration: none;
}

.settings a:hover {
  text-decoration: underline;
}

.hint span {
  font-weight: 600;
  color: var(--ink);
}

.status {
  min-height: 20px;
  color: var(--cool);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes float-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade-rise {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.reveal {
  animation: fade-rise 0.8s ease-out both;
}

.reveal[data-delay="1"] {
  animation-delay: 0.12s;
}

.reveal[data-delay="2"] {
  animation-delay: 0.22s;
}

.reveal[data-delay="3"] {
  animation-delay: 0.32s;
}

.reveal[data-delay="4"] {
  animation-delay: 0.42s;
}

.reveal[data-delay="5"] {
  animation-delay: 0.52s;
}

.reveal[data-delay="6"] {
  animation-delay: 0.62s;
}

@media (max-width: 520px) {
  .panel {
    padding: 26px 20px 24px;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .actions button[type="submit"] {
    grid-column: 1 / -1;
  }
}
