:root {
  --gold: #c9a227;
  --gold-deep: #b8860b;
  --gold-soft: #e8d48b;
  --cream: #f7f1e4;
  --cream-deep: #efe4cc;
  --paper: #fffdf8;
  --ink: #2b2418;
  --muted: #7a7164;
  --line: #e4dccb;
  --green: #2f9e44;
  --orange: #d97706;
  --shadow: 0 18px 50px rgba(80, 55, 15, 0.12);
  --radius: 16px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: #f7f1e4;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.backdrop {
  position: absolute;
  top: 0;
  right: 0;
  width: min(62vw, 820px);
  height: 620px;
  pointer-events: none;
  z-index: 0;
}

.backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 42%;
  filter: saturate(0.92) contrast(0.95);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #f7f1e4 0%, rgba(247, 241, 228, 0.72) 28%, rgba(232, 196, 110, 0.18) 62%, rgba(247, 241, 228, 0.2) 100%),
    linear-gradient(180deg, rgba(247, 241, 228, 0.08) 0%, rgba(247, 241, 228, 0.35) 70%, #f7f1e4 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 20px 40px;
  min-height: 100vh;
}

.site-header {
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(140, 100, 20, 0.25);
  background: #d4af37;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.15fr);
  gap: 36px;
  align-items: start;
}

.hero-copy h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 3.4vw, 3.35rem);
  line-height: 1.18;
  font-weight: 700;
  margin: 18px 0 16px;
  max-width: 16ch;
}

.hero-copy em {
  color: var(--gold-deep);
  font-style: italic;
}

.hero-sub {
  color: #5d564b;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 42ch;
  margin: 0 0 22px;
}

.trust-row {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 22px;
  color: #4f493f;
  font-size: 0.9rem;
  font-weight: 500;
}

.trust-row li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trust-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #efe3c4;
  color: var(--gold-deep);
  display: grid;
  place-items: center;
}

.trust-icon svg {
  width: 15px;
  height: 15px;
}

.input-card {
  background: var(--paper);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 2;
}

.input-tabs {
  display: none;
}

.input-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.pane {
  padding: 6px 18px 6px 6px;
}

.pane-chat {
  padding: 6px 6px 6px 22px;
  border-left: 1px solid var(--line);
}

.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.pane-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.pane-head h2 span {
  font-weight: 500;
  color: var(--muted);
}

.pane-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #f4ead0;
  color: var(--gold-deep);
  display: grid;
  place-items: center;
}

.pane-icon svg,
.field-icon svg,
.refine-btn svg,
.chat-send svg,
.privacy-note svg,
.results-star svg,
.btn-search {
  width: 18px;
  height: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.field {
  position: relative;
  display: block;
}

.field-wide {
  grid-column: 1 / -1;
}

.field.is-hidden {
  display: none;
}

.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-deep);
  display: grid;
  pointer-events: none;
}

.field select,
.chat-box textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #ddd4c2;
  border-radius: 10px;
}

.field select {
  height: 48px;
  padding: 0 34px 0 40px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7164' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field select:focus,
.chat-box textarea:focus {
  outline: 2px solid #e4c56a;
  border-color: var(--gold);
}

.btn-primary {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  color: #3b2d08;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(180deg, #e3c25a 0%, #c9a227 100%);
  box-shadow: 0 8px 18px rgba(184, 134, 11, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-search {
  display: none;
}

.chat-form {
  display: flex;
  flex-direction: column;
  height: calc(100% - 42px);
}

.chat-box {
  position: relative;
  flex: 1;
}

.chat-box textarea {
  min-height: 168px;
  height: 100%;
  resize: none;
  padding: 14px 52px 14px 14px;
  background: #f4f1ea;
  line-height: 1.5;
}

.chat-send {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #e3c25a 0%, #c9a227 100%);
  color: #3b2d08;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  margin: 12px 0 0;
}

.results {
  margin-top: 42px;
}

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

.results-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.35rem;
}

.results-star {
  color: var(--gold-deep);
  display: inline-flex;
}

.results-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.refine-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.results-error {
  color: #9b2c2c;
  background: #fdecec;
  border: 1px solid #f4c7c7;
  border-radius: 10px;
  padding: 10px 12px;
}

.scheme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.scheme-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(80, 55, 15, 0.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  border: 1px solid rgba(228, 220, 203, 0.7);
}

.scheme-card.is-hidden {
  display: none;
}

.scheme-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.scheme-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f3e7c8;
  color: var(--gold-deep);
  display: grid;
  place-items: center;
}

.scheme-icon svg {
  width: 20px;
  height: 20px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  transform: translateY(-1px);
}

.badge-likely {
  color: #237a32;
  background: #e8f7ea;
}

.badge-likely::before {
  background: var(--green);
}

.badge-possible {
  color: #b45309;
  background: #fff4e5;
}

.badge-possible::before {
  background: var(--orange);
}

.scheme-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.35;
}

.scheme-dept {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.scheme-desc {
  margin: 0 0 16px;
  color: #4e483e;
  font-size: 0.86rem;
  line-height: 1.55;
  flex: 1;
}

.scheme-link {
  color: var(--gold-deep);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

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

.view-more {
  display: block;
  margin: 22px auto 0;
  background: none;
  border: 0;
  color: var(--gold-deep);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.site-footer {
  margin-top: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-mark {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  display: block;
}

.site-footer strong {
  color: var(--ink);
}

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

@media (max-width: 900px) {
  .backdrop {
    width: 100%;
    height: 340px;
  }

  .backdrop img {
    object-position: center 35%;
  }

  .backdrop::after {
    background:
      linear-gradient(180deg, rgba(247, 241, 228, 0.2) 0%, rgba(247, 241, 228, 0.55) 55%, #f7f1e4 100%),
      linear-gradient(90deg, rgba(247, 241, 228, 0.15), rgba(232, 196, 110, 0.12));
  }

  .page {
    padding: 16px 14px 32px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: 2.05rem;
    margin-top: 8px;
  }

  .hero-sub {
    max-width: none;
  }

  .trust-row {
    gap: 12px 16px;
    font-size: 0.82rem;
  }

  .input-card {
    padding: 14px 14px 18px;
    border-radius: 18px;
  }

  .input-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
  }

  .tab {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 4px 12px;
    font: inherit;
    font-weight: 600;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
  }

  .tab svg {
    width: 18px;
    height: 18px;
  }

  .tab.is-active {
    color: var(--ink);
    border-bottom-color: var(--gold);
  }

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

  .pane,
  .pane-chat {
    display: none;
    padding: 0;
    border: 0;
  }

  .pane.is-active {
    display: block;
  }

  .pane-head {
    display: none;
  }

  .btn-search {
    display: block;
  }

  .scheme-card.desktop-only {
    display: none;
  }

  .scheme-card {
    min-height: 0;
  }

  .scheme-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border: 1.5px solid var(--gold);
    border-radius: 10px;
    background: #fffdf6;
  }

  .refine-btn span,
  .refine-btn {
    font-size: 0.8rem;
  }
}

@media (max-width: 420px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .field select {
    font-size: 0.82rem;
    padding-right: 24px;
  }
}
