/* ═══ Tokens ═══
   Typography varies only where it carries meaning:
   size = rank in the hierarchy · mono = data · grey = labels and absences ·
   italic = a work title in prose · bold = run-in heads only.
   Colour = identity: the hue names the language, the admixture the era.
   Listening state is carried by the shape of the square, never by colour alone. */
:root {
    --bg: #efefec; --ink: #0c0c0c; --mid: #5c5c59;
    --hair: #cfcfca; --hair2: #e1e1dc; --deck: #1b1b1a;
    --c1: #1f9a6c; --c2: #b9851a; --c3: #2f6fd0; --c4: #cc3f37; --c5: #8a55c9;
    --e1: #8c6a2e; --e2: #7f9ab6; --e3: #6e1d3a; --e4: #1e1e1e; --e5: #00a6b5;
    --tint: 9%; --tint-strong: 16%;
    --sans: "Helvetica Neue", Helvetica, "Nimbus Sans", Arial, "Liberation Sans", sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
    --barh: 80px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d0d0d; --ink: #ececea; --mid: #a3a3a0; --hair: #2e2e2d; --hair2: #1f1f1e; --deck: #000;
        --c1: #259a6e; --c2: #b48424; --c3: #4d86e8; --c4: #e2584d; --c5: #9b72dc;
        --e1: #c9a25a; --e2: #a9c2dc; --e3: #c0507a; --e4: #e8e8e8; --e5: #2fd3e0;
        --tint: 13%; --tint-strong: 22%; color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0d0d0d; --ink: #ececea; --mid: #a3a3a0; --hair: #2e2e2d; --hair2: #1f1f1e; --deck: #000;
    --c1: #259a6e; --c2: #b48424; --c3: #4d86e8; --c4: #e2584d; --c5: #9b72dc;
    --e1: #c9a25a; --e2: #a9c2dc; --e3: #c0507a; --e4: #e8e8e8; --e5: #2fd3e0;
    --tint: 13%; --tint-strong: 22%; color-scheme: dark;
}
[data-g="1"] { --lc: var(--c1); } [data-g="2"] { --lc: var(--c2); } [data-g="3"] { --lc: var(--c3); }
[data-g="4"] { --lc: var(--c4); } [data-g="5"] { --lc: var(--c5); }
[data-era="1"] { --et: var(--e1); } [data-era="2"] { --et: var(--e2); } [data-era="3"] { --et: var(--e3); }
[data-era="4"] { --et: var(--e4); } [data-era="5"] { --et: var(--e5); }
[data-g] { --acc: var(--lc); }
[data-g][data-era] { --acc: color-mix(in oklch, var(--lc) 70%, var(--et)); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; touch-action: pan-x pan-y; }
button, .rec { touch-action: manipulation; }
body {
    background: var(--bg); color: var(--ink); overflow: hidden;
    font-family: var(--sans); font-size: 15px; line-height: 1.4;
    -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
.m { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--mid); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* ═══ Top bar ═══ */
.bar {
    position: fixed; z-index: 50; top: 0; left: 0; right: 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ink);
    padding-top: env(safe-area-inset-top);
}
.bar-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--hair); }
.tabs { display: flex; flex: 1; min-width: 0; }
.tabs button {
    flex: 1; background: none; border: none; border-right: 1px solid var(--hair); cursor: pointer;
    font-family: var(--mono); font-size: 12px; padding: 11px 4px 9px; position: relative; white-space: nowrap;
}
.tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--lc, var(--ink)); transform: scaleX(0); transition: transform .3s; }
.tabs button[aria-current="true"]::after { transform: scaleX(1); }
.tabs button .cnt { margin-left: 5px; }
@media (hover: hover) { .tabs button:hover { background: var(--hair2); } }
.fbtn { background: none; border: none; cursor: pointer; padding: 0 14px; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
@media (hover: hover) { .fbtn:hover { background: var(--hair2); } }
.fbtn[aria-expanded="true"] { background: var(--ink); color: var(--bg); }
.bar-row.sub { border-bottom: none; align-items: center; }
.fsum { flex: 1; min-width: 0; padding: 7px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Operas | Singers: the switch between the two archives, top right */
.aswitch { display: flex; align-self: stretch; border-left: 1px solid var(--hair); }
.aswitch a, .aswitch span { font-family: var(--mono); font-size: 12px; padding: 7px 12px; display: flex; align-items: center; color: inherit; text-decoration: none; }
.aswitch a + span, .aswitch span + a { border-left: 1px solid var(--hair); }
@media (hover: hover) { .aswitch a:hover { background: var(--hair2); } }
.aswitch span { background: var(--ink); color: var(--bg); }
.filters { display: none; border-top: 1px solid var(--hair); }
.bar.open .filters { display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .bar.open .filters { grid-template-columns: auto 1fr; } }
.seg { display: flex; border-bottom: 1px solid var(--hair); }
@media (min-width: 900px) { .seg { border-bottom: none; border-right: 1px solid var(--hair); } }
.seg button {
    flex: 1; background: none; border: none; border-right: 1px solid var(--hair2); padding: 10px 10px;
    font-family: var(--mono); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.seg button:last-child { border-right: none; }
@media (hover: hover) { .seg button:hover { background: var(--hair2); } }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.search { display: flex; align-items: center; }
.search label { padding-left: 12px; }
.search input { flex: 1; min-width: 0; background: none; border: none; outline: none; padding: 10px 12px; font-family: var(--mono); font-size: 12px; }
.search input::placeholder { color: var(--mid); }

/* ═══ Deck: one card per language, swiped sideways ═══ */
.deck {
    display: flex; height: 100%; height: 100dvh;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    scrollbar-width: none; isolation: isolate;
    background: var(--deck);
}
.deck::-webkit-scrollbar { display: none; }
.card { flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; position: relative; overflow: hidden; }
.face {
    position: absolute; inset: 0; overflow-y: auto; overscroll-behavior-y: contain;
    background: var(--bg); -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.face-in { padding-top: var(--barh); padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
/* The cube: each card turns on its edge as it leaves or enters, driven by the
   scroll position itself (a view timeline), so it follows the finger exactly.
   Browsers without scroll-driven animations, and readers who prefer reduced
   motion, get a plain slide. */
@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        .card { view-timeline: --card inline; overflow: visible; }
        .face { animation: cube 1ms linear both; animation-timeline: --card; animation-range: cover 0% cover 100%; }
        @keyframes cube {
            0%     { transform: translateX(-50%) perspective(240vw) rotateY(90deg) translateX(50%); }
            50%    { transform: translateX(-50%) perspective(240vw) rotateY(0deg) translateX(50%); }
            50.01% { transform: translateX(50%) perspective(240vw) rotateY(0deg) translateX(-50%); }
            100%   { transform: translateX(50%) perspective(240vw) rotateY(-90deg) translateX(-50%); }
        }
    }
}

/* ═══ Shared blocks ═══ */
.sec { padding: 40px 0 8px; }
.sec-h { display: grid; grid-template-columns: 44px 1fr auto; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin-bottom: 18px; }
.sec-h h2 { font-size: 22px; font-weight: 400; letter-spacing: -0.01em; }

.mast { padding: 36px 0 34px; border-bottom: 1px solid var(--hair); }
.mast h1 { font-weight: 400; letter-spacing: -0.045em; line-height: 0.9; font-size: clamp(50px, 12vw, 156px); }
.mast h1 .nw { white-space: nowrap; }
.mast h1 .sub { display: block; font-size: 0.4em; letter-spacing: -0.03em; line-height: 1.05; margin-top: 0.25em; }
.langstrip { display: flex; gap: 4px; margin-top: 22px; }
.langstrip i { flex: 1; height: 6px; background: var(--lc); }
.mast-body { display: grid; grid-template-columns: 1fr; gap: 28px; margin-top: 30px; }
@media (min-width: 900px) { .mast-body { grid-template-columns: 7fr 5fr; gap: 40px; } }
.lede { font-size: 17px; line-height: 1.45; max-width: 46ch; }
.spec { border-top: 1px solid var(--ink); }
.spec div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--hair); }
.theme { background: none; border: none; cursor: pointer; padding: 0; }

.readout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.readout > div { min-width: 0; }
@media (min-width: 900px) { .readout { grid-template-columns: 5fr 7fr; gap: 40px; } }
.big { font-size: clamp(64px, 14vw, 128px); letter-spacing: -0.045em; line-height: 0.85; }
.big small { font-size: 0.28em; letter-spacing: -0.01em; margin-left: 6px; }
.grade { font-size: 22px; letter-spacing: -0.01em; margin-top: 16px; }
.grade-next { margin-top: 6px; }
.tools { display: flex; flex-wrap: wrap; margin-top: 22px; border: 1px solid var(--ink); width: max-content; max-width: 100%; }
.tools button { background: none; border: none; border-right: 1px solid var(--ink); padding: 9px 12px; cursor: pointer; font-family: var(--mono); font-size: 12px; }
.tools button:last-child { border-right: none; }
@media (hover: hover) { .tools button:hover { background: var(--ink); color: var(--bg); } }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: right; padding: 7px 0 7px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; padding-left: 0; }
table.t thead th { border-bottom: 1px solid var(--ink); font-weight: 400; color: var(--mid); vertical-align: bottom; }
@media (max-width: 560px) { table.t thead th { white-space: normal; } table.t th, table.t td { padding-left: 6px; } table.t .ln { display: none; } }
table.t tfoot td { border-bottom: none; border-top: 1px solid var(--ink); }
.sw { display: inline-block; width: 10px; height: 10px; background: var(--lc); margin-right: 8px; vertical-align: -1px; }

/* ═══ Charts (plain HTML) ═══ */
.charts { display: grid; grid-template-columns: 1fr; gap: 34px 40px; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } .charts .wide { grid-column: 1 / -1; } }
.chart h4 { font-weight: 400; font-family: var(--mono); font-size: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--hair); margin-bottom: 10px; display: flex; justify-content: space-between; gap: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; display: inline-block; }
.hrow { display: grid; grid-template-columns: minmax(84px, 160px) 1fr 52px; gap: 10px; align-items: center; min-height: 24px; }
.hrow .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hrow .val { text-align: right; }
.track { height: 10px; background: var(--hair2); display: flex; gap: 2px; border-radius: 0 3px 3px 0; overflow: hidden; }
.track b { display: block; height: 100%; flex: none; }
.track b:last-child { border-radius: 0 3px 3px 0; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--ink); }
.col { flex: 1; height: 100%; position: relative; min-width: 2px; }
.col .avail { position: absolute; left: 0; right: 0; bottom: 0; background: var(--hair2); border-radius: 2px 2px 0 0; }
.col .stack { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column-reverse; gap: 2px; }
.col .stack b { display: block; flex: none; }
.col .stack b:last-child { border-radius: 2px 2px 0 0; }
@media (hover: hover) { .col:hover .avail { background: var(--hair); } }
.axis { display: flex; justify-content: space-between; margin-top: 5px; }
.hint { margin-top: 8px; }
[data-tip] { cursor: default; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 12px; padding: 6px 9px; max-width: 260px; opacity: 0; transition: opacity .12s; }
.tip.on { opacity: 1; }

/* ═══ Trophies ═══ */
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.tro { background: var(--bg); padding: 14px 12px 12px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 4px; min-height: 150px; }
.tro .ic { font-size: 30px; line-height: 1; filter: grayscale(1) opacity(.35); }
.tro.won .ic { filter: none; }
.tro .nm { font-size: 15px; margin-top: 6px; }
.tro .ds { font-size: 13px; }
.tro:not(.won) .nm, .tro:not(.won) .ds { color: var(--mid); }
.tro .pg { display: flex; align-items: center; gap: 8px; }
.tro .pg span:first-child { flex: 1; height: 4px; background: var(--hair2); position: relative; }
.tro .pg span:first-child i { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.tro.new .ic { animation: troNew 1.2s cubic-bezier(.2,1.6,.4,1); }
@keyframes troNew { 0% { transform: scale(.2) rotate(-30deg); } 60% { transform: scale(1.4) rotate(8deg); } 100% { transform: none; } }

/* ═══ Matrix ═══ */
/* Each cell holds up to ten squares: two rows of five on a phone, one row of
   ten where there is room. A phone column needs about 45px for five squares,
   well inside its share of even a 320px screen, so cells cannot overlap. */
.matrix { display: grid; grid-template-columns: 34px repeat(5, minmax(0, 1fr)); gap: 3px 8px; }
@media (min-width: 700px) { .matrix { grid-template-columns: 48px repeat(5, minmax(0, 1fr)); gap: 2px 12px; } }
.matrix .h { padding-bottom: 6px; border-bottom: 1px solid var(--ink); margin-bottom: 4px; }
.matrix .d { color: var(--mid); align-self: center; }
.matrix .d.c { color: var(--ink); }
.cell { position: relative; display: grid; grid-template-columns: repeat(5, 7px); gap: 2px; align-content: center; padding: 3px 0; background: none; border: none; cursor: pointer; min-height: 14px; min-width: 0; }
@media (min-width: 700px) { .cell { grid-template-columns: repeat(10, 8px); gap: 3px; } }
.cell:disabled { cursor: default; }
.cell i { width: 7px; height: 7px; box-shadow: inset 0 0 0 1px var(--hair); }
@media (min-width: 700px) { .cell i { width: 8px; height: 8px; } }
.cell i.l1 { box-shadow: inset 0 0 0 2px var(--lc); }
.cell i.l2 { background: var(--lc); box-shadow: none; }
.cell i.l3 { background: var(--lc); box-shadow: inset 0 0 0 1px var(--lc), inset 0 0 0 2px var(--bg); }   /* live: drawn inside the square, never past it */
/* The decade-complete mark sits just after the squares: 5 × 7px + 4 gaps on a phone, 10 × 8px + 9 gaps on wide screens */
.cell b { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 9px; font-weight: 400; }
@media (min-width: 700px) { .cell b { left: 112px; } }
.cell.out { opacity: .25; }
.mlegend { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 14px; }
.mlegend span { display: inline-flex; align-items: center; gap: 6px; }
.mlegend i { width: 9px; height: 9px; display: inline-block; --lc: var(--mid); }

/* ═══ Language card ═══ */
.lmast { background: color-mix(in oklch, var(--lc) var(--tint-strong), var(--bg)); border-bottom: 1px solid var(--ink); }
.lmast .wrap { padding-top: 36px; padding-bottom: 28px; }
.lmast h2 { font-weight: 400; font-size: clamp(64px, 17vw, 200px); letter-spacing: -0.05em; line-height: 0.86; }
.lmast .lsub { font-size: 22px; letter-spacing: -0.01em; margin-top: 10px; }
.lmast .lstats { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; }
.lmini { display: grid; grid-template-columns: 1fr; gap: 26px 40px; margin-top: 26px; }
@media (min-width: 900px) { .lmini { grid-template-columns: 3fr 2fr; } }
.lmast .cols { height: 90px; }
.lmast .track, .lmast .col .avail { background: color-mix(in oklch, var(--lc) 14%, var(--bg)); }
.lmast .chart h4 { border-bottom-color: var(--ink); }

/* Decades: coloured by group and era */
/* Centuries hold decades; both fold. Size alone marks the level:
   century 64px, decade 44px. The sign at the right says open (−) or folded (+). */
details > summary { list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
details > summary::-webkit-details-marker { display: none; }
.dis::before { content: "+"; }
details[open] > summary .dis::before { content: "−"; }
.dis { width: 14px; text-align: right; }
.cen { border-bottom: 1px solid var(--ink); scroll-margin-top: var(--barh); }
.cen > summary { padding-top: 34px; padding-bottom: 10px; }
.cen-h { display: grid; grid-template-columns: auto 1fr auto auto; align-items: end; gap: 16px; }
.cen-h h3 { font-size: 64px; font-weight: 400; letter-spacing: -0.045em; line-height: 0.85; }
@media (hover: hover) { .cen > summary:hover h3, .dec > summary:hover h4 { color: var(--mid); } }
.dec { background: color-mix(in oklch, var(--acc) var(--tint), var(--bg)); border-top: 1px solid var(--hair); scroll-margin-top: var(--barh); }
.dec > summary { padding-top: 22px; padding-bottom: 8px; }
.dec:not([open]) > summary { padding-bottom: 14px; }
.dec .recs { padding-bottom: 12px; }
.dec-h { display: grid; grid-template-columns: auto 1fr auto auto; align-items: end; gap: 16px; border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
.dec:not([open]) .dec-h { border-bottom-color: transparent; }
.dec-h h4 { font-size: 44px; font-weight: 400; letter-spacing: -0.04em; line-height: 0.9; }
.dec-h .era { display: inline-flex; align-items: center; gap: 6px; }
.dec-h .era i { width: 10px; height: 10px; background: var(--acc); display: inline-block; }
.dec.flash .dec-h h4 { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 35% { opacity: .2; } 100% { opacity: 1; } }

.rec { display: grid; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid color-mix(in oklch, var(--acc) 25%, var(--hair)); grid-template-columns: 30px 1fr; grid-template-areas: "st id" "st work" "st ref"; }
.rec:last-child { border-bottom: none; }
@media (min-width: 900px) { .rec { grid-template-columns: 30px 118px 1fr minmax(0, 0.95fr); grid-template-areas: "st id work ref"; gap: 0 18px; } }
.rec.hit { animation: hit 2.4s ease-out; }
@keyframes hit { 0%, 45% { background: color-mix(in oklch, var(--acc) 24%, transparent); } 100% { background: transparent; } }
.st { grid-area: st; } .rid { grid-area: id; } .work { grid-area: work; min-width: 0; } .ref { grid-area: ref; min-width: 0; }
@media (max-width: 899px) { .ref { margin-top: 8px; padding-top: 8px; border-top: 1px dashed color-mix(in oklch, var(--acc) 35%, var(--hair)); } }
/* The whole row is the control. The square shows the level by its shape:
   open (empty) · heard of (ring with a dot) · heard (filled) ·
   heard many times (filled, with a second square stacked behind) ·
   and, independently, seen live (ringed). */
.rec { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s; }
@media (hover: hover) { .rec:hover { background: color-mix(in oklch, var(--acc) 7%, transparent); } }
/* No :active tint: on a touch screen it lights up whatever is under the
   finger as soon as a scroll begins. A completed tap flashes instead (.tapped). */
.rec.tapped { animation: tapped .35s ease-out; }
@keyframes tapped { 0% { background: color-mix(in oklch, var(--acc) 16%, transparent); } 100% { background: transparent; } }
.stb { width: 22px; height: 22px; border: 1px solid var(--ink); background: transparent; cursor: pointer; display: grid; place-items: center; margin-top: 1px; position: relative; isolation: isolate; }
.stb::after { content: ""; width: 12px; height: 12px; transform: scale(.3); transition: transform .3s cubic-bezier(.2,1.6,.4,1), background .15s; }
.stb[data-l="1"] { border: 2px solid var(--acc); }
.stb[data-l="1"]::after { background: var(--acc); transform: scale(.4); border-radius: 50%; }
.stb[data-l="2"], .stb[data-l="3"] { border-color: var(--acc); }
.stb[data-l="2"]::after, .stb[data-l="3"]::after { background: var(--acc); transform: scale(1); }
.stb[data-l="3"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--acc); }
.stb:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.rid .state { margin-top: 3px; }
.rec[data-l="0"] .rid .state { color: var(--mid); }
@media (max-width: 899px) { .rid { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; } .rid .state { margin-top: 0; } }
.work .ti { font-size: 21px; letter-spacing: -0.015em; line-height: 1.18; }
.work .orig { font-size: 15px; margin-top: 2px; }
.work .cmp { font-size: 15px; margin-top: 3px; }
.work .meta, .ref .rm { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.work .syn { font-size: 14px; line-height: 1.45; margin-top: 6px; max-width: 52ch; }
.work .note { font-size: 13px; margin-top: 5px; }
.ref .lbl { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ref .cond { font-size: 15px; }
.ref .cast { font-size: 13px; margin-top: 2px; line-height: 1.4; }
.tag { display: inline-block; padding: 1px 5px; border: 1px solid currentColor; line-height: 1.3; }
.gap { padding: 14px 0; }
.none-msg { padding: 40px 0; }

body.f-open .rec:not([data-l="0"]), body.f-known .rec:not([data-l="1"]),
body.f-heard .rec:not([data-l="2"]), body.f-live .rec:not([data-l="3"]), body.f-fav .rec:not([data-fav="1"]), body.f-dis .rec:not([data-fav="-1"]) { display: none; }

/* Notes */
.notes { display: grid; grid-template-columns: 1fr; gap: 26px; padding: 8px 0 20px; }
@media (min-width: 900px) { .notes { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.notes h4 { padding-bottom: 6px; border-bottom: 1px solid var(--ink); margin-bottom: 10px; font-weight: 400; }
.notes p { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.notes p b { font-weight: 700; }
.schema div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.eras div { display: grid; grid-template-columns: 16px 110px 1fr; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--hair); }
.eras i { width: 12px; height: 12px; background: var(--et); }
.foot { border-top: 1px solid var(--ink); padding: 14px 0; margin-top: 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ═══ Console & effects ═══ */
.console {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 70;
    max-width: min(420px, calc(100vw - 32px)); background: var(--ink); color: var(--bg);
    padding: 10px 14px; font-family: var(--mono); font-size: 12px;
    transform: translateY(14px); opacity: 0; pointer-events: none; transition: transform .25s cubic-bezier(.2,1.4,.4,1), opacity .2s;
}
.console.on { transform: none; opacity: 1; }
.console .ln2 { margin-top: 3px; }
.fx { position: fixed; z-index: 65; pointer-events: none; left: 0; top: 0; line-height: 1; will-change: transform, opacity; }
.fx.ring { border: 1px solid var(--fxc); border-radius: 50%; }
.fx.blk { background: var(--fxc); }
.fx.word { font-family: var(--mono); font-size: 12px; white-space: nowrap; color: var(--ink); }
.fx.glyph { color: var(--fxc); }
.trophy-pop { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; pointer-events: none; }
.trophy-pop > div { background: var(--bg); border: 1px solid var(--ink); padding: 26px 34px; text-align: center; animation: popIn 2.8s cubic-bezier(.2,1.4,.4,1) both; }
.trophy-pop .ic { font-size: 64px; line-height: 1; }
.trophy-pop .nm { font-size: 24px; margin-top: 10px; }
.trophy-pop .ds { margin-top: 6px; }
@keyframes popIn { 0% { transform: scale(.3); opacity: 0; } 12% { transform: scale(1.06); opacity: 1; } 18%, 82% { transform: none; opacity: 1; } 100% { transform: translateY(-20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .fx { display: none; }
    .rec.hit, .dec.flash .dec-h h4, .tro.new .ic { animation: none !important; }
}

/* A quiet pulse on the square when a work is logged */
.stb.pulse { animation: pulse .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes pulse { 0% { transform: scale(.82); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .stb.pulse { animation: none; } }

/* Kernel density estimates drawn over the columns */
.colwrap { position: relative; }
.kde { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; overflow: visible; }
.kde path { fill: none; vector-effect: non-scaling-stroke; }
.kde .ka { stroke: var(--mid); stroke-width: 1.25; stroke-dasharray: 3 3; }
.kde .kh { stroke: var(--ink); stroke-width: 2; }
.legend .ln { width: 16px; height: 0; border-top: 2px solid var(--ink); }
.legend .ln.da { border-top: 1.25px dashed var(--mid); }

/* Switch between the two archives */
.switch { display: inline-flex; border: 1px solid var(--ink); margin-top: 22px; }
.switch a, .switch span, .switch button { font-family: var(--mono); font-size: 12px; padding: 7px 12px; color: inherit; text-decoration: none; background: none; border: none; cursor: pointer; }
.switch button + button { border-left: 1px solid var(--ink); }
@media (hover: hover) { .switch a:hover, .switch button:hover { background: color-mix(in oklch, var(--ink) 8%, transparent); } }
.switch.fold { margin-top: 18px; }
.switch span { background: var(--ink); color: var(--bg); }

/* Moving between the two archives cross-fades instead of cutting, and the
   top bar stays put (cross-document view transitions; ignored elsewhere). */
@view-transition { navigation: auto; }
.bar { view-transition-name: bar; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* The singers' archive colours its voices with a palette of its own,
   validated for colour-blind readers in both themes and kept apart from the
   language hues: soprano magenta, mezzo olive, tenor cyan, baritone orange,
   bass indigo. */
:root[data-palette="voices"] { --c1: #c23b7d; --c2: #7a8f12; --c3: #0091b0; --c4: #e0700f; --c5: #4a3fb5; }
@media (prefers-color-scheme: dark) {
    :root[data-palette="voices"]:not([data-theme="light"]) { --c1: #d0589a; --c2: #8ea01e; --c3: #1aa2c0; --c4: #cf7a22; --c5: #7a70e0; }
}
:root[data-palette="voices"][data-theme="dark"] { --c1: #d0589a; --c2: #8ea01e; --c3: #1aa2c0; --c4: #cf7a22; --c5: #7a70e0; }

/* Favourite: a star beside the state, offered once an entry is heard.
   Filled when chosen, an outline otherwise (grey: not yet a value). */
.fav { display: none; background: none; border: none; padding: 6px 8px; margin: -2px 0 0 -8px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--mid); -webkit-tap-highlight-color: transparent; }
.fav::before { content: "☆"; }
.fav[aria-pressed="true"] { color: var(--ink); }
.fav[aria-pressed="true"]::before { content: "★"; }
.rec[data-l="2"] .fav, .rec[data-l="3"] .fav { display: block; }
@media (max-width: 899px) { .rec[data-l="2"] .fav:not(.thumb), .rec[data-l="3"] .fav:not(.thumb) { margin: -4px -8px -4px auto; } }
/* Like / dislike (singers): two thumbs, outlined until chosen, then filled */
.ops { display: none; gap: 2px; margin: 2px 0 0 -8px; }
.rec[data-l="2"] .ops, .rec[data-l="3"] .ops { display: flex; }
@media (max-width: 899px) { .rec[data-l="2"] .ops, .rec[data-l="3"] .ops { margin: -6px -8px -6px auto; } }
.fav.thumb { margin: 0; padding: 6px; }
.fav.thumb::before, .fav.thumb[aria-pressed="true"]::before { content: none; }
.fav.thumb svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.fav.thumb[aria-pressed="true"] svg { fill: currentColor; }
.fav.thumb.down svg { transform: rotate(180deg); }
.fav:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
