:root {
  --ink: #1B1F2A;
  --ink-soft: #262B3A;
  --paper: #F5F1E6;
  --paper-dim: #E8E2D1;
  --amber: #E8A33D;
  --teal: #4FA79A;
  --text-muted: #A9B0BE;
  --line: rgba(245, 241, 230, 0.14);
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .lamp-glow { transition: opacity 0.6s ease; }
}

.lamp-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 700px;
  background: radial-gradient(ellipse at center, rgba(232, 163, 61, 0.16) 0%, rgba(232, 163, 61, 0.04) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.site-header {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 32px;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-mark {
  font-family: 'Source Serif 4', serif;
  font-size: 28px;
  color: var(--amber);
}

.brand-name {
  font-family: 'Source Serif 4', serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tagline {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.search-panel {
  margin-bottom: 40px;
}

#search-form {
  display: flex;
  gap: 10px;
  background: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
}

#query-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 14px;
}

#query-input::placeholder {
  color: var(--text-muted);
}

#search-btn {
  background: var(--amber);
  color: var(--ink);
  border: none;
  border-radius: 2px;
  padding: 0 22px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

#search-btn:hover { filter: brightness(1.08); }
#search-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#search-btn:focus-visible, .chip:focus-visible, #query-input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--teal);
  color: var(--paper);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.stamp {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  border: 1.5px solid var(--amber);
  color: var(--amber);
  padding: 6px 14px;
  border-radius: 50% / 50%;
  transform: rotate(-6deg);
  margin-bottom: 18px;
  opacity: 0.85;
}

.empty-state p {
  max-width: 420px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.6;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.paper-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  animation: card-in 0.35s ease backwards;
}

.paper-card:nth-child(1) { animation-delay: 0.02s; }
.paper-card:nth-child(2) { animation-delay: 0.08s; }
.paper-card:nth-child(3) { animation-delay: 0.14s; }
.paper-card:nth-child(4) { animation-delay: 0.20s; }
.paper-card:nth-child(5) { animation-delay: 0.26s; }

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

.card-score {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--teal);
  margin-bottom: 8px;
}

.card-title {
  font-family: 'Source Serif 4', serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

.answer-block {
  border-left: 2px solid var(--amber);
  padding-left: 20px;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.answer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.pulse-dot.done {
  background: var(--teal);
  animation: none;
  opacity: 1;
}

#answer-text {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 0;
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  border-top: 1px solid var(--line);
}

@media (max-width: 600px) {
  .site-header { padding: 40px 20px 24px; }
  .brand-name { font-size: 26px; }
  #search-form { flex-direction: column; }
  #search-btn { padding: 12px; }
  .cards-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
