/* Berryn Stats (v119). Dark, Berry-tinted; Inter only. */
@font-face { font-family: "Inter"; src: url("/fonts/inter-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("/fonts/inter-display-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("/fonts/inter-display-500-latin.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --surface-0: #110d0f;   /* page */
  --surface-1: #171113;   /* cards, chart surface */
  --surface-2: #211a1d;   /* rows */
  --line: #2c2327;
  --text-primary: #f3f3f3;
  --text-secondary: rgba(243, 243, 243, 0.62);
  --text-muted: rgba(243, 243, 243, 0.42);
  --bar: rgba(213, 81, 129, 0.22);      /* list rows: share of the top value */
  --series-1: #c98500;  /* live answers */
  --series-2: #d55181;  /* AI search indexes; also the single-series colour */
  --series-3: #9085e9;  /* training */
  --good: #3fa35f; --warn: #c98500; --poor: #e66767;
  --r: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--surface-0); }
body { background: var(--surface-0); color: var(--text-primary); font-family: "Inter", system-ui, sans-serif; font-size: 14px; line-height: 20px; letter-spacing: -0.2px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h2, h3, .num { font-family: "Inter Display", "Inter", sans-serif; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; line-height: 16px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; background: rgba(17, 13, 15, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: "Inter Display", sans-serif; font-size: 16px; letter-spacing: -0.5px; }
.brand img { filter: brightness(0) invert(1); opacity: 0.92; }
.brand b { font-weight: 500; color: var(--series-2); }
.live { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(63, 163, 95, 0.18); }
.live.zero i { background: var(--text-muted); box-shadow: none; }
.ranges { margin-left: auto; display: flex; gap: 2px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 20px; padding: 2px; }
.ranges button { padding: 4px 10px; border-radius: 16px; color: var(--text-secondary); font-size: 13px; }
.ranges button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-0); }
.out { color: var(--text-secondary); font-size: 13px; text-decoration: none; white-space: nowrap; }
.out:hover { color: var(--text-primary); }
.jump { max-width: 1240px; margin: 0 auto; padding: 0 24px 10px; display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; }
.jump a { color: var(--text-secondary); text-decoration: none; font-size: 13px; white-space: nowrap; }
.jump a:hover { color: var(--text-primary); }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }
main[aria-busy="true"] .block { opacity: 0.5; }
.block { margin-bottom: 48px; scroll-margin-top: 110px; transition: opacity 0.2s; }
.sec { font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: -0.8px; }
.sec-p { color: var(--text-secondary); max-width: 760px; margin: 4px 0 16px; }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; min-width: 0; }
.card h3 { font-size: 14px; line-height: 18px; font-weight: 500; color: var(--text-secondary); margin-bottom: 10px; letter-spacing: -0.2px; }
.card h3.mt { margin-top: 20px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-h h2 { font-size: 16px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }

/* hero numbers */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.tile .num { font-size: 32px; line-height: 38px; letter-spacing: -1.2px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tile .lab { color: var(--text-secondary); }
.tile .d { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tiles:not(.tiles-4) .tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }

/* list rows: a bar behind each row shows its share of the top row */
.rows { display: flex; flex-direction: column; gap: 4px; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.row > .fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); border-radius: 8px; pointer-events: none; }
.row > * { position: relative; }
.row .nm { flex: 1; min-width: 0; }
.row .nm b { font-weight: 400; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm span { display: block; color: var(--text-secondary); font-size: 12px; line-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .vl { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row .vl small { color: var(--text-secondary); font-size: 12px; margin-left: 4px; }
.mono { width: 26px; height: 26px; border-radius: 7px; background: rgba(243, 243, 243, 0.08); display: grid; place-items: center; font-family: "Inter Display", sans-serif; font-weight: 500; font-size: 12px; color: var(--text-primary); flex: none; }
.row .nm .tag, .tag { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 10px; background: rgba(243, 243, 243, 0.08); color: var(--text-secondary); margin-left: 6px; vertical-align: 1px; }
.more { margin-top: 8px; color: var(--text-secondary); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.empty { color: var(--text-muted); padding: 10px 0; }

/* tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 400; color: var(--text-secondary); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th.n, td.n { text-align: right; }
td.path { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.tbl { margin-top: 10px; }
.tbl summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.tbl > div { max-height: 320px; overflow: auto; margin-top: 8px; }

/* charts */
.chart { position: relative; height: 220px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { fill: var(--text-muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover + g rect, .chart g.on rect { opacity: 0.8; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: #f3f3f3; color: #171113; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); min-width: 120px; }
.tip b { display: block; font-weight: 500; margin-bottom: 2px; }
.tip .k { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .k i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; }

/* vitals */
.vitals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.vital { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.vital .lab { color: var(--text-secondary); font-size: 12px; }
.vital .num { font-size: 26px; line-height: 32px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.vital .st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.vital .st i { width: 8px; height: 8px; border-radius: 50%; }
.vital .sub { color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.st.good i { background: var(--good); } .st.warn i { background: var(--warn); border-radius: 2px; } .st.poor i { background: var(--poor); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }

/* clarity */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 12px 0 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--text-primary); color: var(--surface-0); border-radius: 20px; padding: 6px 14px; text-decoration: none; font-family: "Inter Display", sans-serif; font-weight: 500; }

.foot { padding: 8px 0 40px; max-width: 760px; }
.err { background: rgba(230, 103, 103, 0.12); border: 1px solid rgba(230, 103, 103, 0.4); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }

@media (max-width: 900px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; padding: 10px 16px; }
  .ranges { margin-left: 0; width: 100%; justify-content: space-between; }
  .jump { padding: 0 16px 10px; }
  main { padding: 16px; }
  .live { margin-left: auto; }
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 340px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 28px 24px; }
.login .brand { margin-bottom: 20px; }
.login label { display: block; color: var(--text-secondary); font-size: 13px; margin-bottom: 6px; }
.login input { width: 100%; font: inherit; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; }
.login input:focus { border-color: var(--series-2); }
.login button { width: 100%; margin-top: 14px; justify-content: center; border: 0; font-size: 14px; padding: 9px 14px; }
.login .msg { min-height: 20px; margin-top: 10px; color: var(--poor); font-size: 13px; }
