@font-face {
  font-family: Barlow;
  src: url('../fonts/Barlow-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('../fonts/Barlow-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('../fonts/Barlow-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #121212;
  --muted: #656565;
  --line: #d8d8d8;
  --soft: #f4f4f4;
  --paper: rgba(255, 255, 255, 0.96);
  --danger: #b42318;
  --success: #157347;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #090909; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Barlow, Arial, sans-serif;
  background: #090909;
}
button, input, select { font: inherit; }

.survey-page {
  min-height: 100vh;
  padding: 46px 18px;
  background:
    linear-gradient(rgba(0,0,0,.46), rgba(0,0,0,.70)),
    url('../images/bg01.jpg') center top / cover fixed no-repeat;
}

.survey-card {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 44px clamp(22px, 5vw, 64px) 50px;
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,.34);
  backdrop-filter: blur(8px);
}

.survey-header { text-align: center; position: relative; }
.brand { display: inline-block; line-height: 0; }
.brand img { width: min(360px, 72vw); height: auto; margin-top: 15px; }
.language-switcher {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  padding: 4px;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  background: #fff;
}
.lang-btn {
  min-width: 46px;
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: #555;
  font-weight: 700;
  cursor: pointer;
}
.lang-btn.active { background: #111; color: #fff; }
.lang-btn:focus-visible, .submit-btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(17,17,17,.24);
  outline-offset: 2px;
}

.eyebrow {
  margin: 30px 0 8px;
  color: #6b6b6b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
}
h1 {
  margin: 0 auto;
  max-width: 820px;
  font-size: clamp(25px, 4vw, 39px);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin-top: 20px;
}
.intro {
  max-width: 800px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.instructions, .top-three {
  margin-top: 34px;
  padding: 22px 24px;
  border-radius: 13px;
  background: #f2f2f2;
}
.instructions h2, .top-three h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.instructions ol { margin: 0; padding-left: 22px; }
.instructions li { margin: 6px 0; line-height: 1.45; }

.factor-table {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.factor-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 138px 138px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.factor-row:last-child { border-bottom: 0; }
.factor-row > div {
  min-width: 0;
  padding: 14px 13px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
}
.factor-row > div:last-child { border-right: 0; }
.factor-head {
  background: #161616;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}
.factor-head > div { justify-content: center; }
.factor-head > div:nth-child(2) { justify-content: flex-start; }
.factor-number { justify-content: center; font-weight: 700; color: #555; }
.factor-name { font-size: 15px; line-height: 1.35; }
.input-cell { justify-content: center; }
.number-input {
  width: 84px;
  height: 42px;
  padding: 7px 9px;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #fff;
  color: #111;
  text-align: center;
}
.number-input.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(180,35,24,.08); }
.total-row { background: #f6f6f6; font-weight: 700; }
.total-row > div:nth-child(2) { justify-content: flex-end; }
.total-row > div:last-child { justify-content: center; font-size: 18px; }
#weightTotal.bad { color: var(--danger); }
#weightTotal.good { color: var(--success); }

.validation-summary {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid #f0b6b1;
  border-radius: 9px;
  background: #fff4f2;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.45;
}

.top-three p { margin: 0; color: #444; line-height: 1.45; }
.top-selects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.top-selects label {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 6px;
  align-items: center;
}
.top-selects span { font-weight: 700; }
select, .field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #111;
}
select.invalid, .field input.invalid { border-color: var(--danger); }

.respondent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  margin-top: 28px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-size: 14px; font-weight: 700; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.privacy-note {
  max-width: 620px;
  margin: 0;
  color: #777;
  font-size: 13px;
  line-height: 1.45;
}
.submit-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.submit-btn:hover { transform: translateY(-1px); }
.submit-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.success-panel {
  margin-top: 20px;
  padding: 17px 18px;
  border: 1px solid #b7d8c7;
  border-radius: 9px;
  background: #f0faf5;
  color: #135f3c;
  text-align: center;
}
.success-panel strong { display: block; font-size: 18px; margin-bottom: 2px; }

@media (max-width: 820px) {
  .survey-page { padding: 22px 12px; background-attachment: scroll; }
  .survey-card { padding: 30px 18px 34px; border-radius: 14px; }
  .survey-header { padding-top: 52px; }
  .language-switcher { left: 50%; right: auto; transform: translateX(-50%); }
  .eyebrow { margin-top: 24px; }
  .factor-head { display: none; }
  .factor-table { border: 0; background: transparent; overflow: visible; }
  #factorRows { display: grid; gap: 12px; }
  .factor-row:not(.total-row) {
    grid-template-columns: 42px 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: 11px;
    overflow: hidden;
    background: #fff;
  }
  .factor-row:not(.total-row) > div { border-right: 1px solid var(--line); }
  .factor-row:not(.total-row) > .factor-number { grid-row: 1 / 3; }
  .factor-row:not(.total-row) > .factor-name {
    grid-column: 2 / 4;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .factor-row:not(.total-row) > .input-cell {
    position: relative;
    padding-top: 34px;
  }
  .factor-row:not(.total-row) > .input-cell::before {
    content: attr(data-label);
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding: 0 6px;
    color: #747474;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
  }
  .factor-row:not(.total-row) > .input-cell:last-child { border-right: 0; }
  .total-row { margin-top: 12px; grid-template-columns: 1fr 128px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
  .total-row > div:nth-child(1), .total-row > div:nth-child(3) { display: none; }
  .total-row > div:nth-child(2) { justify-content: flex-start; }
  .top-selects { grid-template-columns: 1fr; }
  .respondent { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .submit-btn { width: 100%; }
}

@media (max-width: 480px) {
  .instructions, .top-three { padding: 18px; }
  .factor-row:not(.total-row) { grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr); }
  .number-input { width: 70px; }
}
