.rating-intro { padding-bottom: 42px; }

.scale-band {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(0, 1.35fr);
  gap: 42px;
  align-items: center;
  margin-bottom: 25px;
  padding: 30px 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 28px;
  background:
    radial-gradient(circle at 95% 0, rgba(184, 214, 74, .15), transparent 18rem),
    #0d1715;
  color: white;
  box-shadow: var(--shadow);
}
.scale-band .eyebrow { color: var(--lime); }
.scale-band h2 { margin: 0; max-width: 430px; font-size: clamp(25px, 3vw, 38px); line-height: 1.05; letter-spacing: -.04em; }
.scale { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.scale::before { content: ""; position: absolute; top: 22px; left: 10%; right: 10%; height: 2px; background: linear-gradient(90deg, #b8d64a, #efd45b, #ee9848, #db5e48, #a8323f); opacity: .75; }
.scale li { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; min-width: 0; color: #aab8b4; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.scale b { width: 45px; height: 45px; display: grid; place-items: center; border: 4px solid #0d1715; border-radius: 50%; background: #b8d64a; color: #10231f; font-size: 16px; }
.scale li:nth-child(2) b { background: #efd45b; }
.scale li:nth-child(3) b { background: #ee9848; }
.scale li:nth-child(4) b { background: #db5e48; color: white; }
.scale li:nth-child(5) b { background: #a8323f; color: white; }

.criteria-workspace { display: grid; grid-template-columns: minmax(245px, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-guide {
  position: sticky;
  top: 18px;
  padding: 29px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 254, 249, .92);
  box-shadow: var(--shadow);
}
.grid-guide h2 { margin: 0; font-size: 29px; line-height: 1.08; letter-spacing: -.04em; }
.guide-copy { margin: 18px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.family-nav { display: grid; gap: 7px; }
.family-nav a { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 7px 11px 7px 8px; border: 1px solid transparent; border-radius: 13px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 800; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.family-nav a:hover, .family-nav a.active { border-color: var(--line); background: white; transform: translateX(3px); }
.family-nav a span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #e7eee7; color: var(--forest); font-size: 9px; letter-spacing: .05em; }
.source-note { margin: 23px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.55; }

.criteria-content { min-width: 0; }
.criteria-toolbar { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 0 4px; }
.criteria-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.criteria-toolbar > div { display: flex; gap: 7px; }
.toolbar-button { min-height: 37px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .72); color: var(--ink); font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.toolbar-button.primary { border-color: var(--forest); background: var(--forest); color: white; }
.toolbar-button:hover { filter: brightness(.96); transform: none; }
.toolbar-button:focus-visible, .family-nav a:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

.criteria-grid { display: grid; gap: 24px; }
.family-section {
  --family: var(--forest);
  scroll-margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 254, 249, .94);
  box-shadow: 0 17px 50px rgba(7, 38, 30, .09);
}
.family-section[data-family="aquatique"] { --family: #247fa7; }
.family-section[data-family="exiguite"] { --family: #b86d32; }
.family-section[data-family="equipement"] { --family: #7753a4; }
.family-section[data-family="cheminement"] { --family: #2e8064; }
.family-section[data-family="progression"] { --family: #bd554e; }
.family-header { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 17px; align-items: center; padding: 25px 28px; overflow: hidden; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, color-mix(in srgb, var(--family) 9%, white), rgba(255, 254, 249, .65)); }
.family-header::after { content: ""; position: absolute; width: 180px; height: 180px; right: -80px; top: -100px; border-radius: 50%; background: var(--family); opacity: .08; }
.family-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--family); color: white; font-size: 14px; font-weight: 900; letter-spacing: .08em; box-shadow: 0 9px 25px color-mix(in srgb, var(--family) 28%, transparent); }
.family-title p { margin: 0 0 4px; color: var(--family); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .13em; }
.family-title h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; }
.family-summary { max-width: 430px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.family-count { position: relative; z-index: 1; padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--family) 24%, transparent); border-radius: 999px; color: var(--family); font-size: 10px; font-weight: 850; white-space: nowrap; }

.level-list { margin: 0; padding: 0; list-style: none; }
.level-card { --level: #b8d64a; display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 21px; padding: 23px 28px; border-bottom: 1px solid var(--line); }
.level-card:last-child { border-bottom: 0; }
.level-card.level-2 { --level: #d9c94b; }
.level-card.level-3 { --level: #e79a43; }
.level-card.level-4 { --level: #d66248; }
.level-card.level-5 { --level: #a8323f; }
.level-number { align-self: start; width: 59px; height: 59px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--level) 55%, #22362f); border-radius: 19px; background: color-mix(in srgb, var(--level) 17%, white); color: color-mix(in srgb, var(--level) 72%, #17231f); font-size: 24px; font-weight: 900; }
.level-copy { min-width: 0; }
.level-topline { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.level-topline h3 { margin: 1px 0 7px; color: var(--ink); font-size: clamp(18px, 2.4vw, 23px); line-height: 1.18; letter-spacing: -.025em; }
.level-meter { flex: 0 0 auto; display: flex; gap: 4px; }
.level-meter i { width: 6px; height: 6px; border-radius: 50%; background: #d9dfdc; }
.level-meter i.on { background: var(--level); }
.criterion-description { margin: 0; color: #52635f; font-size: 14px; line-height: 1.58; }
.criterion-advice { display: flex; align-items: flex-start; gap: 9px; margin: 13px 0 0; padding: 11px 13px; border-radius: 12px; background: color-mix(in srgb, var(--family) 7%, #f7f7f2); color: #43534f; font-size: 12px; line-height: 1.48; }
.criterion-advice b { flex: 0 0 auto; color: var(--family); }

.loading-card { display: grid; gap: 14px; padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: white; }
.loading-card span { height: 70px; border-radius: 15px; background: linear-gradient(90deg, #edf0ea, #f8f9f5, #edf0ea); background-size: 220% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -220% 0; } }
.error-card { padding: 35px; border: 1px solid #e4b3ad; border-radius: 24px; background: #fff7f5; color: #7a322c; }
.error-card h2 { margin-top: 0; }

.reading-note { margin: 25px 0 75px; padding: 30px; display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 30px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255, 254, 249, .75); }
.reading-note h2 { margin: 0; font-size: 28px; line-height: 1.1; letter-spacing: -.035em; }
.reading-note > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.footer-links { display: flex; gap: 18px; }

@media (max-width: 850px) {
  .scale-band { grid-template-columns: 1fr; gap: 25px; padding: 25px; }
  .criteria-workspace { grid-template-columns: 1fr; }
  .grid-guide { position: static; padding: 24px; }
  .family-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .family-nav a { min-width: 110px; }
  .reading-note { grid-template-columns: 1fr; gap: 15px; padding: 24px; }
}

@media (max-width: 520px) {
  .rating-intro { padding-bottom: 30px; }
  .scale-band { border-radius: 21px; padding: 22px 17px; }
  .scale span { display: none; }
  .scale b { width: 39px; height: 39px; border-width: 3px; }
  .scale::before { top: 19px; }
  .grid-guide, .family-section, .reading-note { border-radius: 21px; }
  .criteria-toolbar { align-items: flex-start; flex-direction: column; padding: 4px; }
  .criteria-toolbar > div { width: 100%; }
  .toolbar-button { flex: 1; }
  .family-header { grid-template-columns: 48px minmax(0, 1fr); gap: 13px; padding: 20px 17px; }
  .family-mark { width: 48px; height: 48px; border-radius: 15px; font-size: 12px; }
  .family-count { display: none; }
  .family-summary { font-size: 11px; }
  .level-card { grid-template-columns: 48px minmax(0, 1fr); gap: 13px; padding: 20px 17px; }
  .level-number { width: 46px; height: 46px; border-radius: 14px; font-size: 20px; }
  .level-topline { align-items: flex-start; }
  .level-meter { padding-top: 7px; }
  .level-meter i { width: 5px; height: 5px; }
  .criterion-description { font-size: 13px; }
  .criterion-advice { flex-direction: column; gap: 3px; }
  .footer-links { flex-direction: column; gap: 8px; }
}

@media print {
  body { background: white; }
  .site-header, .scale-band, .grid-guide, .criteria-toolbar, .reading-note, footer { display: none !important; }
  main { width: 100%; }
  .rating-intro { padding: 0 0 24px; }
  .rating-intro h1 { font-size: 42px; }
  .criteria-workspace { display: block; }
  .criteria-grid { gap: 14px; }
  .family-section { break-inside: avoid; box-shadow: none; }
  .family-header { padding: 14px 18px; }
  .family-mark { width: 42px; height: 42px; }
  .level-card { padding: 10px 18px; }
  .level-number { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) { .loading-card span { animation: none; } }
