:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-soft: #0f172a;
  --border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #132447 0%, var(--bg) 45%);
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.glass-card {
  width: 100%;
  min-height: 0;
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.55) 0%, rgba(15, 23, 42, 0.92) 100%);
  border: 0;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 48px rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(12px);
  border-radius: 0;
  padding: 0;
}

.glass-card > * {
  padding-left: clamp(0.75rem, 2vw, 1.25rem);
  padding-right: clamp(0.75rem, 2vw, 1.25rem);
}

.glass-card > .hero {
  padding-top: clamp(0.85rem, 2.2vw, 1.25rem);
}

.glass-card > :last-child:not(#error-message) {
  padding-bottom: clamp(0.85rem, 2.2vw, 1.25rem);
}

.hero {
  text-align: center;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 auto;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  min-width: min(140px, 100%);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.55);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.tab-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--text);
}

.tab-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tab-btn.is-active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.2);
  color: var(--text);
}

.tab-panel[hidden] {
  display: none !important;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.prompt-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.65);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
  min-height: 5rem;
  margin-bottom: 0.75rem;
}

.prompt-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 1px;
}

.prompt-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.live-suggestions {
  margin: 0.6rem 0 0.35rem;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.45);
}

.live-suggestions__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.live-suggestions__title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.live-suggestions__hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.live-suggestions__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggestion-pill {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.05s ease;
}

.suggestion-pill:hover:not(:disabled) {
  border-color: rgba(37, 99, 235, 0.65);
  background: rgba(37, 99, 235, 0.14);
}

.suggestion-pill:active:not(:disabled) {
  transform: translateY(1px);
}

.suggestion-pill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.live-suggestions__empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.scale-row {
  margin: 0.75rem 0 0.25rem;
}

.select-input {
  width: 100%;
  max-width: 200px;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.65);
  color: var(--text);
  font: inherit;
}

.select-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  text-align: center;
  padding: 2.2rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.75rem;
}

.drop-zone:hover:not(.is-disabled),
.drop-zone.drag-active:not(.is-disabled) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.15);
}

.drop-zone.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.drop-title {
  font-weight: 700;
  margin: 0;
}

.drop-subtitle {
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.result-image-frame {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0b1224;
  overflow: hidden;
  min-height: 120px;
}

.preview-wrapper img,
.compare-grid img,
.result-img {
  display: block;
  width: 100%;
  max-height: min(70vh, 560px);
  border-radius: 0;
  border: none;
  object-fit: contain;
}

.preview-wrapper h2,
.results h2,
.result-block h2 {
  margin: 0 0 0.7rem;
}

.result-block {
  margin-top: 1rem;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: none;
  border-radius: 11px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  margin-top: 0.5rem;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.secondary-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.secondary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.ghost-btn:hover:not(:disabled) {
  border-color: var(--primary);
}

.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.9rem;
  padding: 0.5rem 0;
}

.loading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(148, 163, 184, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.suggestions {
  margin-top: 1.2rem;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.suggestion-card {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  color: var(--muted);
}

.results {
  margin-top: 1.2rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.result-actions {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.error-message {
  margin-top: 1rem;
  margin-left: clamp(0.75rem, 2vw, 1.25rem);
  margin-right: clamp(0.75rem, 2vw, 1.25rem);
  margin-bottom: clamp(0.85rem, 2.2vw, 1.25rem);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-btn {
    min-width: 100%;
  }

  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .drop-zone {
    padding: 1.5rem 0.75rem;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }
}
