:root {
  color-scheme: light;
  --ink: #161c1a;
  --muted: #62716b;
  --line: #d9e4df;
  --paper: #fbfcf8;
  --mint: #dff4e8;
  --coral: #e97862;
  --blue: #4267b2;
  --gold: #e7b84b;
  --white: #ffffff;
  --danger: #b9412d;
  --shadow: 0 24px 70px rgba(31, 49, 41, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(216, 227, 221, 0.78);
  background: rgba(251, 252, 248, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.header-action {
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.96fr);
  min-height: calc(100vh - 74px);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
  padding: clamp(44px, 7vw, 90px) clamp(20px, 4vw, 56px) 34px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
li {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(64px, 13vw, 174px);
  line-height: 0.85;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 12px;
  font-size: 25px;
}

.lead {
  max-width: 680px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 25px);
  line-height: 1.42;
}

.hero-actions,
.recorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 13px 18px;
  border: 1px solid var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.primary {
  background: var(--ink);
  color: var(--white);
}

.button.secondary {
  background: transparent;
  color: var(--ink);
}

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.hero-visual img {
  width: min(100%, 620px);
  filter: drop-shadow(0 26px 45px rgba(42, 61, 53, 0.18));
}

.diagnostic,
.result,
.section {
  padding: clamp(64px, 9vw, 116px) clamp(20px, 4vw, 56px);
}

.diagnostic {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(320px, 0.76fr);
  gap: 34px;
  align-items: start;
  background: #eef6f1;
  border-bottom: 1px solid var(--line);
}

.diagnostic-copy p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.58;
}

.recorder-panel,
.result-card,
.method-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.recorder-panel {
  padding: clamp(24px, 4vw, 36px);
}

.recorder-status {
  min-height: 58px;
  padding: 18px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  font-weight: 800;
  line-height: 1.4;
}

.meter {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 96px;
  margin: 26px 0 0;
}

.meter span {
  width: 100%;
  min-width: 18px;
  border-radius: 8px 8px 0 0;
  background: var(--coral);
  animation: pulse 1.1s ease-in-out infinite;
}

.meter span:nth-child(1) {
  height: 32%;
}

.meter span:nth-child(2) {
  height: 68%;
  animation-delay: 0.12s;
  background: var(--blue);
}

.meter span:nth-child(3) {
  height: 46%;
  animation-delay: 0.24s;
  background: var(--gold);
}

.meter span:nth-child(4) {
  height: 82%;
  animation-delay: 0.36s;
  background: var(--coral);
}

.meter span:nth-child(5) {
  height: 54%;
  animation-delay: 0.48s;
  background: var(--blue);
}

@keyframes pulse {
  0%,
  100% {
    transform: scaleY(0.72);
  }
  50% {
    transform: scaleY(1);
  }
}

audio {
  width: 100%;
  margin-top: 22px;
}

.microcopy {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.result {
  display: grid;
  grid-template-columns: minmax(0, 0.74fr) minmax(320px, 1fr);
  gap: 34px;
  align-items: start;
}

.result-card {
  min-height: 260px;
  padding: clamp(24px, 4vw, 40px);
}

.result-card.empty,
.result-card.loading {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.58;
}

.result-card.error {
  border-color: rgba(185, 65, 45, 0.38);
  color: var(--danger);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.score-grid div {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.score-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
}

.result-block {
  margin-top: 22px;
  color: var(--muted);
  line-height: 1.58;
}

.result-block h3 {
  color: var(--ink);
}

.result-block ul,
.result-block ol {
  margin: 0;
  padding-left: 22px;
}

.result-block li + li {
  margin-top: 8px;
}

.result-block.roast {
  padding: 18px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--ink);
}

.result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 34px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.method-grid article {
  padding: 28px;
}

.icon {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--ink);
  font-weight: 900;
  margin-bottom: 28px;
}

.method-grid p {
  color: var(--muted);
  line-height: 1.58;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(20px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .hero,
  .diagnostic,
  .result,
  .section-heading,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 300px;
  }

  .score-grid,
  .result-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .site-header {
    padding: 14px 16px;
  }

  .header-action {
    display: none;
  }

  h1 {
    font-size: 62px;
  }

  .button {
    width: 100%;
  }

  .footer {
    flex-direction: column;
  }
}
