:root {
  --bg: #f5f3ee;
  --surface: #fcfbf8;
  --surface-2: #f2efe8;
  --ink: #17222c;
  --muted: #66717b;
  --line: #d8d1c6;
  --line-2: #e6e0d7;
  --accent: #1d3557;
  --accent-soft: #eaf0f7;
  --shadow: 0 18px 48px rgba(23, 34, 44, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(29, 53, 87, 0.03), transparent 18%),
    linear-gradient(180deg, #f7f5f0 0%, #f1ede4 100%);
  color: var(--ink);
  font-family: "Inter", "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

textarea,
select,
button,
input {
  font: inherit;
}

.site-frame {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.topbar__eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar__name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.language-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(252, 251, 248, 0.9);
}

.lang-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-button.active {
  background: var(--accent);
  color: #fff;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 20px;
  margin-top: 24px;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  grid-column: 1 / -1;
  overflow: hidden;
}

.hero__inner {
  padding: 36px 38px;
  background:
    linear-gradient(135deg, rgba(252, 251, 248, 0.82), rgba(246, 242, 234, 0.84)),
    radial-gradient(circle at top right, rgba(29, 53, 87, 0.08), transparent 28%),
    url("../bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
}

.hero__kicker,
.panel__eyebrow,
.footer__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__title {
  max-width: 920px;
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero__copy {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.72;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.meta-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.meta-card__label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-card__text {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.panel {
  padding: 28px;
}

.panel__title {
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: 1.85rem;
  line-height: 1.08;
}

.panel__copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.66;
}

.field {
  display: block;
  margin-top: 20px;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

textarea,
select,
input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  padding: 14px 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus,
select:focus,
input[type="url"]:focus {
  outline: none;
  border-color: #afbdd0;
  box-shadow: 0 0 0 4px rgba(29, 53, 87, 0.08);
}

textarea {
  min-height: 240px;
  resize: vertical;
  line-height: 1.6;
}

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

.primary-button {
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.form-message {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--muted);
}

.empty-state,
.prediction-card,
.macro-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.empty-state {
  margin-top: 20px;
  padding: 20px 22px;
  color: var(--muted);
}

.hidden {
  display: none;
}

.result-section + .result-section {
  margin-top: 22px;
}

.result-section__title {
  margin: 20px 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.prediction-list,
.macro-grid {
  display: grid;
  gap: 12px;
}

.prediction-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.prediction-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.prediction-label {
  font-weight: 700;
}

.prediction-probability {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.macro-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.macro-card {
  padding: 14px 16px;
}

.macro-name {
  margin: 0 0 8px;
  font-size: 0.94rem;
  font-weight: 700;
}

.macro-meta {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.91rem;
}

.footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

.footer__orgs {
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: 1rem;
  line-height: 1.7;
}

.footer__contact {
  margin-top: 28px;
}

.footer__contact-text {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  line-height: 1.75;
}

.footer__contact-text p {
  margin: 0;
}

.footer__contact-text p + p {
  margin-top: 4px;
}

.footer__contact-text a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 53, 87, 0.22);
}

.footer__contact-text a:hover {
  border-bottom-color: var(--accent);
}

.footer__sep {
  margin: 0 10px;
  color: #9c9384;
}

.footer__meta {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
}

.technical-access {
  display: none;
}

@media (max-width: 980px) {
  .main-grid,
  .hero__meta,
  .footer__inner {
    grid-template-columns: 1fr;
  }

  .footer__meta {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .site-frame {
    width: min(100% - 20px, 1200px);
    padding-top: 20px;
  }

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

  .hero__inner,
  .panel {
    padding: 22px;
  }

  .field-grid,
  .macro-grid {
    grid-template-columns: 1fr;
  }
}
