:root {
  color-scheme: light;
  --bg: #f5f4ee;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --ink: #1e2522;
  --muted: #66726d;
  --line: #d7ded8;
  --water: #1b8798;
  --river: #145c72;
  --leaf: #3d7a4a;
  --amber: #c98f22;
  --rust: #b3542d;
  --blue: #315e9f;
  --shadow: 0 18px 42px rgba(30, 37, 34, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(135deg, rgba(27, 135, 152, 0.1), transparent 32rem),
    linear-gradient(225deg, rgba(61, 122, 74, 0.09), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

.survey-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 16px;
}

.topbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  margin-bottom: 18px;
}

.topbar p,
.section-heading p,
.kicker,
.score-label,
.controls span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: clamp(22px, 4vw, 38px);
  line-height: 1;
  margin: 0;
}

.back-link,
.icon-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 8px 20px rgba(30, 37, 34, 0.1);
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  min-width: 42px;
  padding: 0 12px;
  text-decoration: none;
}

.icon-button {
  cursor: pointer;
}

.hero-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  margin-bottom: 14px;
}

.brief,
.verdict-panel,
.controls,
.prototype-card,
.matrix-wrap {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.brief {
  padding: clamp(20px, 4vw, 32px);
}

.brief h2 {
  font-size: clamp(25px, 5vw, 46px);
  line-height: 1.03;
  margin: 0 0 16px;
  max-width: 920px;
}

.brief p:last-child {
  color: #3c4742;
  font-size: 17px;
  line-height: 1.5;
  margin: 0;
  max-width: 780px;
}

.verdict-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.verdict-panel div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.verdict-panel strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.verdict-panel p {
  color: var(--muted);
  margin: 0;
}

.section-tabs,
.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.section-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-button {
  background: #e4eae6;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.tab-button.active {
  background: var(--river);
  border-color: var(--river);
  color: #ffffff;
}

.controls {
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
}

.controls label {
  display: grid;
  gap: 5px;
  min-width: min(260px, 100%);
}

.controls select {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 760;
  min-height: 40px;
  padding: 0 12px;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin: 18px 0 10px;
}

.section-heading h2 {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.05;
  margin: 0;
}

.count-pill {
  background: #e9efe9;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  padding: 7px 10px;
}

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

.app-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(30, 37, 34, 0.08);
  display: grid;
  gap: 12px;
  min-height: 100%;
  padding: 14px;
}

.app-card header {
  display: grid;
  gap: 8px;
}

.badge-row,
.feature-tags,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  align-items: center;
  background: #edf2ef;
  border-radius: 999px;
  color: #33423b;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  min-height: 24px;
  padding: 0 8px;
}

.badge.fit-strong {
  background: rgba(61, 122, 74, 0.14);
  color: #245432;
}

.badge.fit-watch {
  background: rgba(201, 143, 34, 0.18);
  color: #725015;
}

.badge.fit-weak {
  background: rgba(102, 114, 109, 0.14);
  color: #4f5b56;
}

.app-card h3 {
  font-size: 19px;
  line-height: 1.15;
  margin: 0;
}

.app-card p {
  color: #425049;
  line-height: 1.45;
  margin: 0;
}

.feature-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #405047;
  font-size: 12px;
  font-weight: 780;
  padding: 5px 8px;
}

.recommendation {
  border-left: 4px solid var(--water);
  color: #26312d;
  font-weight: 780;
  padding-left: 10px;
}

.link-row {
  margin-top: auto;
}

.link-row a {
  background: var(--river);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 850;
  min-height: 34px;
  padding: 8px 10px;
  text-decoration: none;
}

.link-row a.secondary {
  background: #e7ece8;
  color: var(--ink);
}

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

.prototype-card {
  padding: 14px;
}

.prototype-card h3 {
  font-size: 18px;
  margin: 12px 0 8px;
}

.prototype-card p {
  color: #46534d;
  line-height: 1.45;
  margin: 0 0 10px;
}

.prototype-card strong {
  color: #23332b;
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.phone-mock {
  background: #f8faf9;
  border: 3px solid #1d2420;
  border-radius: 20px;
  height: 210px;
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.capture-flow {
  align-content: start;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}

.capture-flow span {
  align-items: center;
  background: var(--river);
  border-radius: 6px;
  color: #ffffff;
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
}

.input-line {
  background: #dbe5df;
  border-radius: 999px;
  grid-column: 1 / -1;
  height: 15px;
  margin-top: 5px;
  width: 74%;
}

.input-line.wide {
  width: 100%;
}

.input-line.short {
  width: 48%;
}

.contour-flow {
  background: linear-gradient(180deg, #dff0f3, #f7fbf8);
}

.contour-flow i {
  border: 3px solid var(--water);
  border-radius: 50%;
  display: block;
  height: 150px;
  left: 12px;
  position: absolute;
  top: 22px;
  transform: rotate(-18deg);
  width: 220px;
}

.contour-flow i:nth-child(2) {
  border-color: var(--leaf);
  height: 106px;
  left: 36px;
  top: 43px;
  width: 160px;
}

.contour-flow i:nth-child(3) {
  border-color: var(--amber);
  height: 62px;
  left: 69px;
  top: 66px;
  width: 94px;
}

.contour-flow b {
  background: var(--rust);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(30, 37, 34, 0.2);
  height: 24px;
  left: 111px;
  position: absolute;
  top: 78px;
  width: 24px;
}

.forecast-flow {
  display: grid;
  gap: 10px;
}

.forecast-bar {
  border-radius: 999px;
  height: 28px;
}

.forecast-bar.good {
  background: linear-gradient(90deg, var(--leaf) 78%, #dfe6df 78%);
}

.forecast-bar.fair {
  background: linear-gradient(90deg, var(--amber) 54%, #dfe6df 54%);
}

.forecast-bar.poor {
  background: linear-gradient(90deg, var(--rust) 28%, #dfe6df 28%);
}

.forecast-flow span {
  background: #e7ece8;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  padding: 8px;
}

.trip-flow ol {
  counter-reset: stops;
  display: grid;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 6px;
}

.trip-flow li {
  background: #e6ece9;
  border-radius: 999px;
  height: 24px;
  position: relative;
}

.trip-flow li::before {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: #ffffff;
  content: counter(stops);
  counter-increment: stops;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  left: 0;
  position: absolute;
  top: -2px;
  width: 28px;
}

.matrix-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 820px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf2ee;
  color: #35433d;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #34423b;
  line-height: 1.4;
}

.compact .brief p:last-child,
.compact .app-card p,
.compact .recommendation,
.compact .prototype-card p {
  display: none;
}

.compact .app-card,
.compact .prototype-card {
  gap: 8px;
  padding: 10px;
}

@media (max-width: 980px) {
  .hero-grid,
  .app-grid,
  .prototype-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .survey-shell {
    padding: 10px;
  }

  .hero-grid,
  .app-grid,
  .prototype-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
    grid-template-columns: auto 1fr;
  }

  .icon-button {
    grid-column: 2;
    justify-self: end;
  }

  .section-heading {
    align-items: start;
    gap: 10px;
  }

  .brief {
    padding: 18px;
  }
}
