:root {
  --bg: #f7efe2;
  --bg-deep: #efe0ca;
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: rgba(255, 248, 238, 0.96);
  --line: rgba(103, 73, 50, 0.15);
  --text: #2d1f17;
  --muted: #6c584c;
  --accent: #ca5b2a;
  --accent-strong: #8c2f1b;
  --success: #255f38;
  --warning: #9a3d1f;
  --shadow: 0 24px 70px rgba(82, 55, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI Variable", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(202, 91, 42, 0.18), transparent 22%),
    radial-gradient(circle at right center, rgba(147, 95, 60, 0.14), transparent 18%),
    linear-gradient(160deg, var(--bg) 0%, #f8f2e8 45%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 70%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 40px;
}

.hero {
  margin-bottom: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 248, 238, 0.95), rgba(255, 255, 255, 0.78));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero h1,
.panel h2,
.detail-card h3 {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", serif;
  font-weight: 700;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 68ch;
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.compact-copy {
  margin-top: 12px;
  font-size: 0.95rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(202, 91, 42, 0.12);
  border: 1px solid rgba(202, 91, 42, 0.24);
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms ease, background-color 180ms ease;
}

.auth-link:hover {
  transform: translateY(-1px);
  background: rgba(202, 91, 42, 0.18);
}

.status-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(37, 95, 56, 0.18);
  background: rgba(37, 95, 56, 0.08);
  color: var(--success);
  font-size: 0.92rem;
}

.status-pill.muted {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
}

.status-pill.warning {
  border-color: rgba(154, 61, 31, 0.18);
  background: rgba(154, 61, 31, 0.08);
  color: var(--warning);
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(320px, 1fr);
  gap: 22px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading p,
.muted-copy,
.advanced p {
  color: var(--muted);
  line-height: 1.6;
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
}

label span,
summary {
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(103, 73, 50, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(202, 91, 42, 0.7);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

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

.advanced {
  padding: 14px 16px;
  border: 1px dashed rgba(103, 73, 50, 0.2);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.74);
}

.advanced[open] {
  background: var(--panel-strong);
}

summary {
  cursor: pointer;
}

button {
  padding: 16px 20px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #e27d45 100%);
  color: #fff8f0;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(202, 91, 42, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(202, 91, 42, 0.28);
  filter: saturate(1.05);
}

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

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.detail-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
}

.metric-card.emphasis {
  background: linear-gradient(135deg, rgba(202, 91, 42, 0.12), rgba(255, 255, 255, 0.8));
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.metric-card small {
  color: var(--muted);
}

.detail-card + .detail-card {
  margin-top: 14px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(103, 73, 50, 0.1);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 700;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.option-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(103, 73, 50, 0.14);
  background: rgba(255, 255, 255, 0.78);
}

.option-card-selected {
  border-color: rgba(202, 91, 42, 0.42);
  box-shadow: inset 0 0 0 1px rgba(202, 91, 42, 0.12);
}

.option-card-best {
  background: linear-gradient(135deg, rgba(202, 91, 42, 0.1), rgba(255, 255, 255, 0.82));
}

.option-card-unavailable {
  background: rgba(154, 61, 31, 0.06);
  border-color: rgba(154, 61, 31, 0.14);
}

.option-title {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 1.05rem;
}

.option-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.option-badge {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(103, 73, 50, 0.14);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-best {
  border-color: rgba(37, 95, 56, 0.2);
  background: rgba(37, 95, 56, 0.08);
  color: var(--success);
}

.badge-selected {
  border-color: rgba(202, 91, 42, 0.24);
  background: rgba(202, 91, 42, 0.12);
  color: var(--accent-strong);
}

.badge-requested {
  border-color: rgba(103, 73, 50, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
}

.badge-unavailable {
  border-color: rgba(154, 61, 31, 0.18);
  background: rgba(154, 61, 31, 0.1);
  color: var(--warning);
}

.option-stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.option-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(103, 73, 50, 0.08);
}

.option-stats dt {
  color: var(--muted);
}

.option-stats dd {
  margin: 0;
  font-weight: 700;
}

.option-error {
  margin: 0;
  color: var(--warning);
  line-height: 1.6;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(202, 91, 42, 0.1);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.message-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 18px;
}

.message-box.error {
  background: rgba(154, 61, 31, 0.1);
  color: var(--warning);
}

.message-box.loading {
  background: rgba(37, 95, 56, 0.08);
  color: var(--success);
}

.warning-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.hidden {
  display: none;
}

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

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

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

  .hero,
  .panel {
    padding: 18px;
    border-radius: 24px;
  }

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

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-list div {
    flex-direction: column;
    align-items: flex-start;
  }

  .option-stats div {
    flex-direction: column;
    align-items: flex-start;
  }
}
