:root {
  color-scheme: light;
  --bg: #f4efe4;
  --bg-accent: #e5dbc5;
  --panel: rgba(255, 250, 240, 0.86);
  --panel-strong: rgba(255, 246, 230, 0.96);
  --line: rgba(68, 52, 28, 0.14);
  --text: #2f2417;
  --muted: #76624a;
  --brand: #9c4f1d;
  --brand-dark: #6f3511;
  --ok: #356b4f;
  --shadow: 0 24px 60px rgba(72, 52, 27, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 32%),
    radial-gradient(circle at bottom right, rgba(193, 120, 52, 0.16), transparent 28%),
    linear-gradient(135deg, var(--bg) 0%, #efe4d0 48%, var(--bg-accent) 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(60, 45, 25, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 45, 25, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 90%);
}

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

.hero {
  padding: 8px 4px 28px;
  animation: rise-in 0.5s ease;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(40px, 8vw, 72px);
  line-height: 0.95;
}

.intro {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 0.5s ease;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), transparent);
}

.ask-panel {
  padding: 22px;
}

.query-form {
  display: grid;
  gap: 14px;
}

.label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 132px;
  padding: 18px 20px;
  border: 1px solid rgba(84, 58, 27, 0.16);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: rgba(156, 79, 29, 0.5);
  box-shadow: 0 0 0 4px rgba(156, 79, 29, 0.1);
  transform: translateY(-1px);
}

.actions,
.panel-head,
.item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, #c26b31 100%);
  color: #fff7ef;
  font: inherit;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(156, 79, 29, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(156, 79, 29, 0.28);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.ghost-button {
  background: rgba(111, 53, 17, 0.08);
  color: var(--brand-dark);
  box-shadow: none;
}

.status-pill,
.meta,
.item-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  background: rgba(111, 53, 17, 0.08);
  color: var(--brand-dark);
}

.status-pill.loading {
  background: rgba(156, 79, 29, 0.12);
}

.status-pill.ok {
  background: rgba(53, 107, 79, 0.12);
  color: var(--ok);
}

.status-pill.error {
  background: rgba(159, 44, 30, 0.12);
  color: #9f2c1e;
}

.panel-head {
  padding: 20px 22px 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.meta,
.item-tag {
  background: rgba(111, 53, 17, 0.08);
  color: var(--muted);
}

.answer,
.health {
  margin: 0;
  padding: 18px 22px 22px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.7;
}

.list {
  padding: 10px 16px 18px;
  display: grid;
  gap: 12px;
}

.list.empty {
  color: var(--muted);
  padding-top: 0;
}

.item-card {
  border: 1px solid rgba(84, 58, 27, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  padding: 16px;
}

.item-title,
.item-subtitle {
  margin: 0;
}

.item-title {
  font-size: 16px;
}

.item-subtitle {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.item-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.item-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

.item-link:hover {
  text-decoration: underline;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

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

  .grid {
    grid-template-columns: 1fr;
  }

  .actions,
  .panel-head,
  .item-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  button,
  .ghost-button {
    width: 100%;
    justify-content: center;
  }
}
