:root {
  --bg: #070b16;
  --bg-raised: #0d1425;
  --bg-panel: #101a30;
  --border: #1e2a44;
  --text: #f4f7fc;
  --text-muted: #93a1bd;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --danger: #f87171;
  --radius: 14px;
  font-size: 16px;
}

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

body {
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 22, 0.85);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
}

.brand-mark span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.brand-mark span:nth-child(4) {
  background: var(--accent);
}

.brand-name {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  font-weight: 400;
}

.brand-name strong {
  font-weight: 700;
}

.header-tag {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Layout */
main {
  flex: 1;
  width: min(1060px, 92vw);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
  background:
    radial-gradient(600px 220px at 50% 0%, rgba(59, 130, 246, 0.16), transparent 70%);
  padding-top: 1rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
}

.hero p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Upload card */
.upload-card {
  background: var(--bg-raised);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.6rem 2rem;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-card.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-idle svg {
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.upload-idle p {
  line-height: 1.7;
}

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

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.upload-busy .spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 1rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.upload-error {
  color: var(--danger);
  margin-top: 1rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Results */
.results {
  margin-top: 2.5rem;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.results-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

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

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

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

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 0;
}

.panel h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.panel h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.2rem 0 0.5rem;
}

.panel dl {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 0.45rem 1rem;
  font-size: 0.95rem;
}

.panel dt {
  color: var(--text-muted);
}

.panel dd {
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  background: var(--accent-soft);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
}

.chip.entity-people { border-color: rgba(52, 211, 153, 0.4); color: #a7f3d0; background: rgba(52, 211, 153, 0.12); }
.chip.entity-locations { border-color: rgba(251, 191, 36, 0.4); color: #fde68a; background: rgba(251, 191, 36, 0.1); }

#text-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  max-height: 300px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
