:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --ink: #1d1f23;
  --muted: #6d7179;
  --line: #d8d2c5;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --accent: #006d77;
  --accent-dark: #004c54;
  --rose: #b8475b;
  --gold: #b7791f;
  --shadow: 0 20px 60px rgba(38, 35, 29, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.progress-card {
  width: min(260px, 38vw);
  min-width: 180px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
}

#progressText {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ded0;
}

#progressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 180ms ease;
}

.panel,
.survey {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(22px, 4vw, 40px);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 28px;
  align-items: start;
}

.respondent {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.respondent input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--panel-strong);
  color: var(--ink);
  outline: none;
}

.respondent input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.16);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary:hover {
  border-color: #b9b0a1;
}

#startButton {
  margin-top: 26px;
}

.hidden {
  display: none !important;
}

.survey {
  padding: clamp(16px, 3vw, 26px);
}

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

.counter {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.person-card {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.portrait {
  position: relative;
  min-height: 520px;
  background: #2c3436;
}

.portrait img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  display: block;
}

.portrait-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 520px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(0,109,119,0.86), rgba(184,71,91,0.82)),
    #263238;
  font-size: 76px;
  font-weight: 900;
}

.person-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(20px, 4vw, 42px);
}

.person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.person-name {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.person-title {
  max-width: 650px;
  color: var(--muted);
  font-size: 18px;
}

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

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

.choice,
.rate {
  min-height: 58px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.choice[aria-pressed="true"],
.rate[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(0, 109, 119, 0.1);
  color: var(--accent-dark);
}

.rating-wrap {
  display: none;
  padding-top: 4px;
}

.rating-wrap.visible {
  display: block;
}

.question-label {
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 900;
}

.nav-row,
.download-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.download-row {
  justify-content: flex-start;
}

.favorites-note {
  max-width: 720px;
  margin-bottom: 18px;
}

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

.favorite-card {
  position: relative;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  min-height: 112px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.favorite-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(0, 109, 119, 0.08);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.favorite-image,
.favorite-image img,
.favorite-fallback {
  width: 86px;
  height: 86px;
  border-radius: 8px;
}

.favorite-image {
  overflow: hidden;
  align-self: center;
  background: #2c3436;
}

.favorite-image img {
  display: block;
  object-fit: cover;
}

.favorite-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(0,109,119,0.86), rgba(184,71,91,0.82)),
    #263238;
  font-size: 24px;
  font-weight: 900;
}

.favorite-copy {
  display: grid;
  gap: 4px;
  align-content: center;
  min-width: 0;
}

.favorite-name,
.favorite-title,
.favorite-meta {
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-name {
  font-size: 16px;
  font-weight: 900;
}

.favorite-title,
.favorite-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.favorite-rank {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 560px);
    padding-top: 12px;
  }

  .topbar,
  .intro-grid,
  .block-head,
  .person-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .progress-card {
    width: 100%;
  }

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

  .portrait,
  .portrait img,
  .portrait-fallback {
    min-height: 330px;
  }

  .choice-grid,
  .rating-grid,
  .favorites-grid {
    grid-template-columns: 1fr;
  }

  .nav-row {
    position: sticky;
    bottom: 0;
    margin: 18px -16px -16px;
    padding: 12px 16px;
    background: rgba(246, 244, 239, 0.92);
    backdrop-filter: blur(10px);
  }
}
