:root {
  color-scheme: light;
  --bg: #f7f1e6;
  --bg-accent: #efe2c6;
  --surface: rgba(255, 252, 245, 0.9);
  --surface-strong: #fffaf0;
  --text: #1f1b16;
  --muted: #65584a;
  --line: rgba(67, 45, 23, 0.14);
  --accent: #a74316;
  --accent-strong: #7b2d11;
  --shadow: 0 20px 60px rgba(93, 54, 20, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(167, 67, 22, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(126, 76, 21, 0.14), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, #f3ead9 100%);
  font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Avenir Next", "Segoe UI", sans-serif;
}

body.is-loading,
body.is-loading * {
  cursor: progress !important;
}

.shell {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

/* API Key Banner */
.api-banner {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.api-banner[hidden] {
  display: none;
}

.api-banner-inner {
  padding: 24px 28px;
}

.api-banner-text {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.api-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.api-row input {
  font-size: 0.95rem;
  padding: 14px 16px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}

.api-row button {
  font-size: 0.95rem;
}

/* Hero & Cards */
.hero,
.result-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  padding: 32px;
}

.hero-english,
.result-label {
  margin: 0;
  color: var(--accent-strong);
}

.hero-english {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 58ch;
  margin-top: 8px;
}

.result-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
}

h1,
h2,
h3 {
  font-family: "Noto Serif Devanagari", "Kohinoor Devanagari", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  line-height: 1.05;
}

h1 {
  margin: 16px 0 18px;
  font-size: clamp(2.9rem, 7vw, 5.4rem);
  max-width: 10ch;
  color: var(--text);
  line-height: 1;
}

.strike {
  text-decoration: line-through;
  text-decoration-thickness: 0.08em;
}

.intro {
  max-width: 58ch;
  margin: 0 0 14px;
}

.intro,
.status,
.result-section p,
.result-section li {
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.lookup-form {
  margin-top: 28px;
}

.label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input,
button {
  border-radius: 16px;
  border: 1px solid var(--line);
  font: inherit;
}

input {
  width: 100%;
  padding: 16px 18px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.05rem;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--accent);
  color: #fff9f0;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.button-spinner,
.status-spinner {
  border-radius: 999px;
  border-style: solid;
  animation: spin 0.8s linear infinite;
}

.button-spinner {
  width: 20px;
  height: 20px;
  border-width: 3px;
  border-color: rgba(255, 249, 240, 0.35);
  border-top-color: #fff9f0;
}

.status-spinner {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-width: 3px;
  border-color: rgba(167, 67, 22, 0.18);
  border-top-color: var(--accent);
}

.button-spinner[hidden],
.status-spinner[hidden] {
  display: none;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.example-chip {
  padding: 10px 14px;
  background: rgba(255, 248, 236, 0.9);
  color: var(--text);
}

.result-card {
  margin-top: 24px;
  padding: 28px 32px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.result-header h2 {
  margin: 10px 0 0;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  border-radius: 999px;
  padding: 8px 12px;
  background: #fbe2c9;
  color: #723312;
  font-size: 0.9rem;
  white-space: nowrap;
}

.badge.subtle {
  background: #f0e5d1;
  color: #5a4b3d;
}

.result-section + .result-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.result-section h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.result-section p,
.result-section ul {
  margin: 0;
}

.result-section ul {
  padding-left: 20px;
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 4px 0;
}

code {
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 0.92em;
}

/* Key management */
.key-manage {
  margin: 12px 4px 0;
}

.key-manage[hidden] {
  display: none;
}

.key-manage-btn {
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  border-radius: 12px;
}

.key-manage-btn:hover {
  background: var(--bg-accent);
  color: var(--text);
}

/* Poetic button — outline style, inside result card */
.btn-poetic {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  font-size: 0.95rem;
  padding: 12px 18px;
}

.btn-poetic:hover:not(:disabled) {
  background: var(--accent);
  color: #fff9f0;
}

.poetic-cta {
  text-align: center;
}

.poetic-text {
  font-style: italic;
  line-height: 1.8;
}

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 860px);
    padding-top: 18px;
  }

  .hero,
  .result-card {
    padding: 22px;
    border-radius: 20px;
  }

  .lookup-row,
  .api-row {
    grid-template-columns: 1fr;
  }

  .result-header {
    flex-direction: column;
  }

  .api-banner-inner {
    padding: 20px;
  }
}
