@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0d14;
  --bg-surface: #16161f;
  --bg-card: #1c1c28;
  --bg-card-2: #222233;
  --border: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(245, 158, 11, 0.25);

  --amber: #f59e0b;
  --amber-dim: #b45309;
  --amber-glow: rgba(245, 158, 11, 0.12);

  --text: #e2e8f0;
  --text-muted: #8892a4;
  --text-dim: #4a5568;
  --white: #ffffff;

  --tone-calm: #60a5fa;
  --tone-tense: #f87171;
  --tone-ambivalent: #a78bfa;
  --tone-neutral: #94a3b8;

  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.7);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 60% 40% at 20% 10%,
      rgba(245, 158, 11, 0.06) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 60% at 80% 90%,
      rgba(99, 102, 241, 0.06) 0%,
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(13, 13, 20, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--white);
  text-decoration: none;
}

.nav-logo .dot {
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.nav-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--amber);
  background: var(--amber-glow);
  border: 1px solid var(--border-glow);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--amber) 0%, #fcd34d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 3rem;
}

.upload-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.3s;
}

.upload-card:focus-within {
  border-color: var(--border-glow);
}

.upload-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.upload-textarea {
  width: 100%;
  min-height: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 1rem;
  resize: vertical;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.upload-textarea::placeholder {
  color: var(--text-dim);
}

.upload-textarea:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

.upload-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  gap: 1rem;
}

.char-count,
.file-status {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.hidden {
  display: none !important;
}

.input-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.input-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
}

.input-tab:hover {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.input-tab.active {
  background: var(--bg-card-2);
  color: var(--amber);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 2rem;
}

.drop-zone:hover {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.03);
}

.drop-zone.drag-over {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
  transform: scale(1.01);
}

.drop-zone-icon {
  color: var(--text-dim);
  opacity: 0.5;
  transition: all 0.3s;
}

.drop-zone:hover .drop-zone-icon {
  opacity: 0.8;
  color: var(--amber);
  transform: translateY(-2px);
}

.drop-zone.drag-over .drop-zone-icon {
  opacity: 1;
  color: var(--amber);
  transform: translateY(-4px);
}

.drop-zone-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.drop-zone-link {
  color: var(--amber);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  animation: fadeUp 0.3s ease both;
}

.file-preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.file-preview-icon {
  flex-shrink: 0;
  color: var(--amber);
  opacity: 0.8;
}

.file-preview-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

.file-preview-size {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.file-remove-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.file-remove-btn:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber) 0%, #fbbf24 100%);
  color: #0d0d14;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 20, 0.92);
  backdrop-filter: blur(8px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.loading-step {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s;
}

.loading-step.active {
  color: var(--amber);
}

.loading-step.done {
  color: var(--text-muted);
}

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.results-page {
  padding: 2.5rem 1.5rem 4rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.result-header-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-2) 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow:
    var(--shadow),
    0 0 60px rgba(245, 158, 11, 0.05);
  flex-wrap: wrap;
}

.result-header-left {
  flex: 1;
  min-width: 200px;
}

.result-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.result-subject {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.result-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-tone {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.25);
  color: var(--tone-calm);
}

.badge-tone.tense {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.25);
  color: var(--tone-tense);
}

.badge-tone.ambivalent {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.25);
  color: var(--tone-ambivalent);
}

.badge-tone.neutral {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--tone-neutral);
}

.badge-confidence {
  background: var(--amber-glow);
  border-color: var(--border-glow);
  color: var(--amber);
}

.confidence-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 140px;
}

.confidence-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.confidence-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  border-radius: 999px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.confidence-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--amber);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition:
    border-color 0.2s,
    transform 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.card-full {
  grid-column: 1 / -1;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-label-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.summary-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
}

.themes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--amber-glow) 0%,
    rgba(245, 158, 11, 0.05) 100%
  );
  border: 1px solid var(--border-glow);
  color: var(--amber);
  transition: all 0.2s;
}

.theme-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  transform: translateY(-1px);
}

.theme-chip::before {
  content: "#";
  opacity: 0.6;
  font-size: 0.75rem;
}

.tension-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  padding-left: 1rem;
  border-left: 2px solid var(--amber);
}

.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quote-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  transition: border-color 0.2s;
}

.quote-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.quote-mark {
  position: absolute;
  top: -0.6rem;
  left: 1.25rem;
  font-size: 2rem;
  color: var(--amber);
  line-height: 1;
  font-family: "DM Serif Display", serif;
  opacity: 0.7;
}

.quote-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  font-style: italic;
  padding-top: 0.25rem;
}

.results-actions {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.error-bar {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: #fca5a5;
  padding: 0.875rem 1.25rem;
  font-size: 0.85rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 680px;
}

.error-bar.visible {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.fade-up-1 {
  animation-delay: 0.05s;
}

.fade-up-2 {
  animation-delay: 0.12s;
}

.fade-up-3 {
  animation-delay: 0.19s;
}

.fade-up-4 {
  animation-delay: 0.26s;
}

.fade-up-5 {
  animation-delay: 0.33s;
}
