:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --ink: #18181b;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;
  --line: #e4e4e7;
  --brand: #4f46e5;
  --brand-ink: #4338ca;
  --gold-1: #f7e7b0;
  --gold-2: #d4af37;
  --ok: #059669;
  --warn: #b45309;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(24,24,27,.06), 0 12px 32px -12px rgba(24,24,27,.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 50% -200px, #eef2ff 0%, rgba(238,242,255,0) 70%),
    var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

a { color: var(--brand-ink); }

/* ---------- Header / Footer ---------- */
.site-header { padding: 18px 0; }
.site-header .container { display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; }
.brand img { height: 40px; width: auto; display: block; }
.site-header__tag {
  font-size: 13px; color: var(--ink-faint); font-weight: 600;
  padding-left: 14px; border-left: 1px solid var(--line);
}

.main { flex: 1 0 auto; padding: 16px 0 56px; }

.site-footer { padding: 28px 0; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 13px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.site-footer__links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer__links a { color: var(--ink-soft); text-decoration: none; }
.site-footer__links a:hover { color: var(--ink); }
.site-footer__copy { margin: 0; }

/* ---------- Hero (home / not found) ---------- */
.hero { max-width: 640px; margin: 40px auto; text-align: center; }
.hero--narrow { max-width: 560px; }
.hero__badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand-ink); background: #eef2ff; border: 1px solid #e0e7ff;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero__badge--warn { color: var(--warn); background: #fffbeb; border-color: #fde68a; }
.hero__title { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
.hero__lead { font-size: 17px; color: var(--ink-soft); margin: 0 auto 26px; max-width: 520px; }

/* ---------- Search ---------- */
.search { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.search--inline { margin: 30px auto 0; }
.search__input {
  flex: 1; min-width: 0; font-size: 16px; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.search__input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
.search__btn {
  font-size: 16px; font-weight: 600; color: #fff; background: var(--brand);
  border: none; border-radius: 12px; padding: 13px 22px; cursor: pointer; transition: background .15s;
}
.search__btn:hover { background: var(--brand-ink); }

/* ---------- Certificate ---------- */
.cert { max-width: 820px; margin: 8px auto 0; }
.cert__verified {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700;
  color: var(--ok); background: #ecfdf5; border: 1px solid #a7f3d0; padding: 5px 12px; border-radius: 999px;
}
.cert__title { font-size: clamp(24px, 4vw, 32px); margin: 14px 0 4px; letter-spacing: -.02em; }
.cert__summary { margin: 0 0 4px; color: var(--ink-soft); font-size: 16px; }

/* ---------- Label (client-side reconstruction) ---------- */
.label {
  --label-ink: #18181b;
  --label-line: #e4e4e7;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: stretch;
  margin: 22px 0 30px;
  padding: 20px 22px;
  background: linear-gradient(180deg, #ffffff, #fbfbfc);
  color: var(--label-ink);
  border: 1px solid var(--label-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  container-type: inline-size;
}
.label--gold {
  --label-ink: #f5e9c8;
  --label-line: rgba(212,175,55,.35);
  background:
    radial-gradient(120% 140% at 0% 0%, #2a2620 0%, #14130f 60%, #0c0b09 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.5);
}
.label__cert {
  position: absolute; top: 12px; right: 16px;
  font-size: 11px; letter-spacing: .12em; font-weight: 700; color: var(--ink-faint);
}
.label--gold .label__cert { color: rgba(245,233,200,.6); }
.label__info { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.label__line { font-size: 17px; font-weight: 600; letter-spacing: .01em; overflow-wrap: anywhere; }
.label__line--genre { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.label--gold .label__line--genre { color: var(--gold-2); }
.label__brand {
  margin-top: 12px; font-size: 13px; font-weight: 800; letter-spacing: .22em;
  color: var(--ink-faint);
}
.label--gold .label__brand {
  background: linear-gradient(90deg, var(--gold-1), var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.label__grade {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding-left: 18px; border-left: 1px solid var(--label-line); min-width: 116px;
}
.label__grade-name { font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--ink-faint); }
.label--gold .label__grade-name { color: var(--gold-2); }
.label__grade-value { font-size: clamp(46px, 12cqw, 72px); font-weight: 800; line-height: .95; letter-spacing: -.03em; }
.label__sub { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; width: 100%; }
.label__sub li { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--ink-soft); }
.label--gold .label__sub li { color: rgba(245,233,200,.75); }
.label__sub b { font-variant-numeric: tabular-nums; color: var(--label-ink); }

@container (max-width: 460px) {
  .label { grid-template-columns: 1fr; }
  .label__grade { border-left: none; border-top: 1px solid var(--label-line); padding: 14px 0 0; flex-direction: row; gap: 14px; }
  .label__sub { width: auto; }
}

/* ---------- Panels: details + population ---------- */
.cert__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .cert__grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.panel__title { font-size: 14px; font-weight: 700; margin: 0 0 14px; letter-spacing: .02em; }
.panel__sub { margin: -8px 0 14px; font-size: 13px; color: var(--ink-faint); }

.specs { margin: 0; }
.specs__row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.specs__row:first-child { border-top: none; }
.specs dt { color: var(--ink-soft); font-size: 14px; }
.specs dd { margin: 0; font-weight: 600; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Population report ---------- */
.pop { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.pop__row { display: grid; grid-template-columns: 30px 1fr 44px; align-items: center; gap: 10px; padding: 3px 6px; border-radius: 8px; }
.pop__row--current { background: #eef2ff; }
.pop__grade { font-size: 12px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pop__row--current .pop__grade { color: var(--brand-ink); }
.pop__track { height: 8px; background: #f1f1f4; border-radius: 999px; overflow: hidden; }
.pop__fill { display: block; height: 100%; background: #d4d4d8; border-radius: 999px; min-width: 2px; }
.pop__row--current .pop__fill { background: var(--brand); }
.pop__count { font-size: 12px; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pop__row--current .pop__count { color: var(--brand-ink); font-weight: 700; }
