:root {
  --bg: #f5efe2;
  --paper: rgba(255, 251, 244, 0.82);
  --ink: #1a1a1a;
  --muted: #5b554a;
  --accent: #db4f2c;
  --accent-deep: #8d2c18;
  --line: rgba(26, 26, 26, 0.12);
  --card: rgba(255, 255, 255, 0.74);
  --ok: #0f6f4b;
  --shadow: 0 24px 60px rgba(40, 28, 12, 0.14);
  font-synthesis-weight: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 30%),
    radial-gradient(circle at top left, rgba(219, 79, 44, 0.16), transparent 26%),
    linear-gradient(120deg, #f8f3ea 0%, #ece1ce 100%);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  opacity: 0.36;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px),
    radial-gradient(circle at 78% 72%, rgba(0, 0, 0, 0.045) 0 1px, transparent 1px);
  background-size: 12px 12px, 16px 16px;
  mix-blend-mode: multiply;
  opacity: 0.4;
}

.layout {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
  position: relative;
}

.hero {
  padding: 26px 24px 10px;
}

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

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 900;
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
}

.lead {
  margin: 18px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 15px;
}

.mono {
  color: var(--accent-deep);
}

.panel,
.status-strip {
  backdrop-filter: blur(12px);
  background: var(--paper);
  border: 1px solid rgba(26, 26, 26, 0.08);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: 28px;
  margin: 18px 0 0;
  padding: 24px;
}

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

.lookup-form label,
.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.lookup-form input {
  width: 100%;
  padding: 18px 18px;
  border-radius: 18px;
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: rgba(255, 255, 255, 0.78);
  font: inherit;
  color: var(--ink);
}

.lookup-form select {
  width: 100%;
  padding: 18px 18px;
  border-radius: 18px;
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: rgba(255, 255, 255, 0.78);
  font: inherit;
  color: var(--ink);
}

.lookup-form input:focus {
  outline: 2px solid rgba(219, 79, 44, 0.24);
  border-color: rgba(219, 79, 44, 0.45);
}

.lookup-form select:focus {
  outline: 2px solid rgba(219, 79, 44, 0.24);
  border-color: rgba(219, 79, 44, 0.45);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button,
.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

button {
  background: var(--ink);
  color: #fff7ef;
  box-shadow: 0 14px 28px rgba(26, 26, 26, 0.18);
}

.button.primary {
  background: var(--accent);
  color: #fff8f2;
  box-shadow: 0 14px 28px rgba(219, 79, 44, 0.18);
}

button:hover,
.button:hover {
  transform: translateY(-1px);
}

.button.ghost {
  color: var(--ink);
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: rgba(255, 255, 255, 0.56);
}

.disabled,
.button.disabled {
  pointer-events: none;
  opacity: 0.42;
}

.hint,
.detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.status-strip {
  margin-top: 18px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.status-strip article {
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.64);
}

.status-strip strong {
  display: block;
  margin-top: 10px;
  font-size: 15px;
}

.results-panel {
  padding-bottom: 28px;
}

.save-panel {
  display: grid;
  gap: 16px;
}

.progress-track {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.08);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ef8d54);
  transition: width 180ms ease;
}

.results-head {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
}

.results {
  display: grid;
  gap: 16px;
}

.results.empty {
  place-items: center;
  min-height: 180px;
  border-radius: 22px;
  border: 1px dashed rgba(26, 26, 26, 0.12);
  background: rgba(255, 255, 255, 0.3);
  color: var(--muted);
}

.result-card {
  border-radius: 24px;
  padding: 18px;
  background: var(--card);
  border: 1px solid rgba(26, 26, 26, 0.08);
  display: grid;
  gap: 14px;
}

.result-card.preferred {
  border-color: rgba(219, 79, 44, 0.35);
  box-shadow: inset 0 0 0 1px rgba(219, 79, 44, 0.12);
}

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

.card-top h3 {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent-deep);
  background: rgba(219, 79, 44, 0.12);
  white-space: nowrap;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.meta-grid div {
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  padding-top: 12px;
}

.meta-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
}

.card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card-actions .save-action {
  background: var(--accent);
  color: #fff8f2;
  box-shadow: 0 14px 28px rgba(219, 79, 44, 0.18);
}

.card-actions a {
  color: var(--ink);
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: rgba(255, 255, 255, 0.55);
}

.status-good {
  color: var(--ok);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-head,
  .card-top {
    flex-direction: column;
    align-items: start;
  }

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

@media (max-width: 640px) {
  .layout {
    width: min(100vw - 18px, 1080px);
    padding-top: 20px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

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