/* ============================================================
   THE OTHER GAMES — section tabs, Connections, Krillion.
   Loaded after style.css; reuses its tokens and components.
============================================================ */

:root {
  --cn-Y: #f9df6d;
  --cn-G: #a0c35a;
  --cn-B: #b0c4ef;
  --cn-P: #ba81c5;
  --cn-Y-ink: #8a6d00;
  --cn-G-ink: #4d6b1c;
  --cn-B-ink: #3d5a9c;
  --cn-P-ink: #7a3f88;
  /* Krillion's own tier palette (krillion.io, dark theme) */
  --kt-plankton: #a9bbd9;
  --kt-tooclever: #ffa94d;
  --kt-schooler: #4de3ff;
  --kt-rare: #ff6b8b;
  --kt-deepcut: #a98bff;
  --kt-krillion: #ffd166;
  --kt-miss: #3d4f6e;
}

/* Which-game-is-showing switches */
[data-for] { display: none; }
body[data-game="wordle"] [data-for="wordle"],
body[data-game="connections"] [data-for="connections"],
body[data-game="krillion"] [data-for="krillion"] { display: revert; }
body[data-game="wordle"] .np-tiles[data-for="wordle"],
body[data-game="connections"] .np-conn,
body[data-game="krillion"] .np-krill { display: flex; }
body:not([data-game="wordle"]) [data-for="wordle"],
body:not([data-game="connections"]) [data-for="connections"],
body:not([data-game="krillion"]) [data-for="krillion"] { display: none !important; }
/* The Wordle lead's drop cap looks wrong on decks that open with a number. */
.conn-lead .lead-text .deck::first-letter,
.krill-hero .lead-text .deck::first-letter { float: none; font-size: 1em; padding: 0; font-family: inherit; font-weight: inherit; font-style: inherit; color: inherit; }
.cr-main .player-cell, .krr-main .player-cell { display: flex; align-items: baseline; gap: 10px; }
.pane[hidden] { display: none !important; }
.pane { animation: paneIn 420ms cubic-bezier(.2,.7,.2,1) both; }
@keyframes paneIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* The period bar only drives Wordle stats. */
body:not([data-game="wordle"]) .period-bar { display: none; }
body:not([data-game="wordle"]) { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ============================================================
   SECTION TABS
============================================================ */
.game-tabs {
  position: sticky;
  top: 0;
  z-index: 40 !important;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: -24px -8px 22px;
  padding: 8px 8px 0;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.gt-tab {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px;
  border: 0;
  border-right: 1px dotted var(--rule-soft);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  font: inherit;
  position: relative;
  transition: background 160ms ease, color 160ms ease;
}
.gt-tab:last-child { border-right: 0; }
.gt-tab:hover { background: rgba(184,142,63,0.08); }
.gt-tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.gt-tab[aria-selected="true"]::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom: 0; border-top-color: var(--ink);
}
.gt-tab:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
.gt-text { display: grid; line-height: 1.15; min-width: 0; }
.gt-sec {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; opacity: .7;
}
.gt-name {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 30, 'wght' 600;
  font-size: 21px;
  letter-spacing: -0.01em;
}
.gt-live {
  font-family: var(--serif-body); font-style: italic; font-size: 12.5px; opacity: .8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gt-glyph { flex-shrink: 0; display: inline-grid; gap: 2px; }
.gt-glyph i { display: block; width: 11px; height: 11px; border-radius: 1px; }
.gt-wordle { grid-template-columns: repeat(3, 11px); }
.gt-wordle i:nth-child(1) { background: #6aaa64; }
.gt-wordle i:nth-child(2) { background: #c9b458; }
.gt-wordle i:nth-child(3) { background: #787c7e; }
.gt-conn { grid-template-columns: repeat(2, 11px); }
.gt-conn i:nth-child(1) { background: var(--cn-Y); }
.gt-conn i:nth-child(2) { background: var(--cn-G); }
.gt-conn i:nth-child(3) { background: var(--cn-B); }
.gt-conn i:nth-child(4) { background: var(--cn-P); }
.gt-krill {
  font-size: 22px; width: 30px; height: 30px; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1f4f7a, #071427 70%);
  box-shadow: 0 0 0 1px rgba(77,227,255,.35) inset;
}

/* ============================================================
   NAMEPLATES — Connections & Krillion
============================================================ */
.np-conn, .np-krill { justify-content: center; flex-wrap: nowrap; gap: clamp(3px, 0.5vw, 6px); margin-top: 14px; }
.cn-tile {
  display: grid; place-items: center;
  width: clamp(26px, 6.2vw, 74px); aspect-ratio: 1 / 1;
  border-radius: 6px;
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial Black', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(15px, 3.6vw, 42px);
  color: #1a1410;
  box-shadow: 0 2px 0 rgba(20,16,12,.16), 0 8px 18px -8px rgba(40,30,20,.4);
  animation: tileFlip 600ms cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i) * 45ms + 60ms);
}
.cn-tile.c-G + .cn-tile.c-B, .cn-tile.c-Y + .cn-tile.c-G, .cn-tile.c-B + .cn-tile.c-P { margin-left: clamp(4px, 1vw, 12px); }

.kn-tile {
  display: grid; place-items: center;
  width: clamp(34px, 8.2vw, 92px); aspect-ratio: 1 / 1;
  border-radius: 50%;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 700;
  font-size: clamp(20px, 4.6vw, 52px);
  color: #eaf6ff;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.35), transparent 34%),
              linear-gradient(180deg, hsl(calc(190 + var(--i) * 9) 85% 48%), hsl(calc(205 + var(--i) * 10) 70% 22%));
  box-shadow: 0 0 0 1px rgba(125,234,255,.35) inset, 0 10px 24px -10px rgba(0,0,0,.7);
  animation: bob 4.2s ease-in-out infinite, tileFlip 600ms cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i) * -0.5s), calc(var(--i) * 55ms);
}
.kn-shrimp { align-self: center; font-size: clamp(26px, 5vw, 56px); margin-left: 6px; animation: swim 5s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes swim { 0%, 100% { transform: translateX(0) rotate(-6deg); } 50% { transform: translateX(-8px) rotate(4deg); } }

/* ============================================================
   CONNECTIONS — colour chips & grids
============================================================ */
.c-Y { background: var(--cn-Y); } .c-G { background: var(--cn-G); }
.c-B { background: var(--cn-B); } .c-P { background: var(--cn-P); }
.t-Y { color: var(--cn-Y-ink); } .t-G { color: var(--cn-G-ink); }
.t-B { color: var(--cn-B-ink); } .t-P { color: var(--cn-P-ink); }

.cg { display: inline-grid; gap: 3px; flex-shrink: 0; }
.cg-row { display: grid; grid-template-columns: repeat(4, 14px); gap: 3px; }
.cg-row i { display: block; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset; }
.cg-row.miss { opacity: .78; }
.cg.xs { gap: 1px; }
.cg.xs .cg-row { grid-template-columns: repeat(4, 5px); gap: 1px; }
.cg.xs .cg-row i { height: 5px; border-radius: 0; box-shadow: none; }

.conn-lead .lead-text { min-width: 0; }
.conn-results {
  list-style: none; margin: 0; padding: 0;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
}
.conn-results li {
  display: grid; grid-template-columns: 56px 1fr auto; column-gap: 18px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--rule-soft);
}
.conn-results li:last-child { border-bottom: 0; }
.conn-results li.empty { display: block; text-align: center; }
.conn-results .rank {
  font-family: var(--serif-display); font-variation-settings: 'opsz' 96, 'SOFT' 0, 'wght' 600;
  font-style: italic; font-size: 24px; line-height: 1; text-align: right; padding-right: 6px;
}
.conn-results li.gold .rank { color: var(--oxblood); }
.cr-main { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.cr-verdict {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 2px; background: var(--paper-deep); color: var(--ink-soft);
}
.cr-verdict.v-perfect { background: var(--moss); color: var(--paper); }
.cr-verdict.v-close { background: var(--kraft); color: var(--paper); }
.cr-verdict.v-miss { background: var(--oxblood-deep); color: var(--paper); }
.cr-note {
  font-family: var(--serif-body); font-style: italic; font-size: 14.5px; color: var(--ink-soft);
  quotes: '“' '”'; max-width: 36ch;
}

.conn-solution { margin-top: 18px; }
.sol { display: grid; gap: 6px; margin-top: 8px; }
.sol-bar {
  display: grid; justify-items: center; text-align: center; gap: 1px;
  padding: 9px 12px; border-radius: 6px; color: #1a1410;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.sol-title { font-family: 'Helvetica Neue', Arial, system-ui, sans-serif; font-weight: 800; font-size: 13.5px; letter-spacing: .03em; }
.sol-words { font-family: 'Helvetica Neue', Arial, system-ui, sans-serif; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.sealed-card {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px dashed var(--rule-soft); background: rgba(227,214,186,.35);
  font-size: 14.5px; color: var(--ink-soft);
}
.seal-icon { font-size: 22px; color: var(--oxblood); }

.conn-table .th-sub { display: block; font-size: 8.5px; letter-spacing: .12em; opacity: .7; }
.conn-prose { font-size: 15.5px; color: var(--ink-soft); margin: 0 0 14px; max-width: 60ch; }
.conn-prose strong[class^="t-"] { font-weight: 700; }

/* Solve-order bars */
.order-grid { display: grid; gap: 10px; }
.order-row { display: grid; grid-template-columns: minmax(110px, 0.9fr) 2fr; gap: 12px; align-items: center; }
.or-name { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline;
  font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 16px; }
.or-name small { grid-column: 2; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 400; }
.or-name:not(:has(.swatch)) small { grid-column: 1 / -1; }
.or-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.order-head .or-bars b { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-align: center; color: var(--ink-fade); }
.ob { display: flex; height: 26px; border-radius: 3px; overflow: visible; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.ob i { display: block; height: 100%; min-width: 3px; }
.ob i:first-child { border-radius: 3px 0 0 3px; }
.ob i:last-child { border-radius: 0 3px 3px 0; }
.order-row:nth-child(2) .ob { height: 34px; }

/* Tangles */
.tangles { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.tangles li {
  display: grid; grid-template-columns: auto 9.5em 1fr 2.5em; gap: 12px; align-items: center;
  padding: 10px 2px; border-bottom: 1px dotted var(--rule-soft);
}
.tangles li:last-child { border-bottom: 0; }
.tg-pair { display: inline-flex; align-items: center; gap: 4px; }
.tg-pair i { width: 16px; height: 16px; border-radius: 3px; display: block; }
.tg-x { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.tg-label { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 500; font-size: 15px; }
.tg-bar { height: 8px; background: var(--paper-deep); border-radius: 4px; overflow: hidden; }
.tg-bar span { display: block; height: 100%; background: var(--ink-soft); border-radius: 4px; }
.tg-n { font-family: var(--mono); font-weight: 700; font-size: 14px; text-align: right; }

/* Toughest / breeziest */
.conn-ext { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.conn-ext li {
  display: grid; grid-template-columns: 24px auto 1fr auto; gap: 14px; align-items: center;
  padding: 11px 4px; border-bottom: 1px dotted var(--rule-soft); cursor: pointer;
}
.conn-ext li:hover { background: rgba(184,142,63,.08); }
.conn-ext li:last-child { border-bottom: 0; }
.conn-ext li.empty { display: block; text-align: center; cursor: default; }
.conn-ext .ex-rank { font-family: var(--serif-display); font-style: italic; font-size: 18px; color: var(--ink-fade); text-align: center; }
.ce-main { display: grid; line-height: 1.15; }
.ce-num { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 17px; }
.ce-date { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.ce-purple { font-family: 'Helvetica Neue', Arial, sans-serif; font-weight: 700; font-size: 12px; letter-spacing: .03em; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; min-width: 0; }
.ce-purple i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.ce-avg { font-family: var(--serif-display); font-variation-settings: 'opsz' 60, 'wght' 700; font-size: 22px; text-align: right; line-height: 1; }
.ce-avg small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 400; }

/* Case files */
.cases { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.case { border-bottom: 1px dotted var(--rule-soft); scroll-margin-top: 90px; transition: background 600ms ease; }
.case:last-child { border-bottom: 0; }
.case.flash { background: rgba(186,129,197,.18); }
.case summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 6.2em 7.5em 1fr auto 14px; gap: 14px; align-items: center;
  padding: 11px 4px;
}
.case summary::-webkit-details-marker { display: none; }
.case summary::after { content: '+'; font-family: var(--mono); color: var(--ink-fade); text-align: center; }
.case[open] summary::after { content: '–'; }
.case summary:hover { background: rgba(184,142,63,.08); }
.case-num { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 16px; }
.case-date { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-fade); }
.case-thumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.case-thumb { display: grid; justify-items: center; gap: 2px; padding: 2px 2px 0; }
.case-thumb small { font-family: var(--mono); font-size: 8.5px; letter-spacing: .04em; color: var(--ink-fade); border-top: 2px solid var(--pc); padding-top: 1px; max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cases-more { display: block; width: 100%; padding: 12px; border: 0; border-top: 1px dotted var(--rule-soft); background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--oxblood); }
.cases-more:hover { background: rgba(184,142,63,.08); }
.cases.collapsed .case:nth-child(n + 11) { display: none; }
.case-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.case-body { padding: 4px 4px 18px; display: grid; grid-template-columns: minmax(0, 1.1fr) 1fr; gap: 22px; align-items: start; }
.case-body .sol { margin-top: 0; }
.case-grids { display: flex; flex-wrap: wrap; gap: 16px 22px; }
.case-grid { display: grid; gap: 5px; justify-items: start; max-width: 15em; }
.cgd-name { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 15px; display: flex; gap: 6px; align-items: baseline; }
.case-grid .cr-note { font-size: 13.5px; }

/* ============================================================
   KRILLION — the deep-sea supplement
============================================================ */
html:has(body[data-game="krillion"]), body[data-game="krillion"] { background: #040b18; }
body[data-game="krillion"] {
  --paper:      #0a1930;
  --paper-warm: #0e2140;
  --paper-deep: #152b4d;
  --ink:        #e8f3ff;
  --ink-soft:   #bcd0ea;
  --ink-fade:   #8ea6c8;
  --ink-faint:  #6d86aa;
  --rule:       #3a5b85;
  --rule-soft:  #24406a;
  --oxblood:    #4de3ff;
  --oxblood-deep: #1aa7c9;
  --gold:       #ffd166;
  --moss:       #4de3ff;
  --kraft:      #ff9f43;
}
body[data-game="krillion"] .paper {
  background:
    radial-gradient(900px 420px at 50% -60px, rgba(77,227,255,.16), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, rgba(169,139,255,.08), transparent 70%),
    var(--paper);
  box-shadow: 0 0 0 1px rgba(77,227,255,.12), 0 30px 80px -20px rgba(0,0,0,.8);
}
body[data-game="krillion"] .grain { opacity: .18; mix-blend-mode: screen; }
body[data-game="krillion"] .nameplate .np-the,
body[data-game="krillion"] .nameplate .np-name {
  color: var(--ink);
  text-shadow: 0 0 30px rgba(77,227,255,.25);
}
body[data-game="krillion"] .gt-tab:hover { background: rgba(77,227,255,.08); }
body[data-game="krillion"] .lb-table tbody tr:hover td { background: rgba(77,227,255,.06); }
body[data-game="krillion"] [data-tooltip]::after { background: #e8f3ff; color: #0a1930; }
body[data-game="krillion"] .swatch { box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset, 0 0 8px currentColor; }

.krill-hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 36px; align-items: start;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule);
}
.krill-hero .lead-text { min-width: 0; }
.krill-hero .kicker { color: var(--kt-schooler); border-color: var(--kt-schooler); }

.kt {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px; font-size: 17px; line-height: 1;
  background: rgba(255,255,255,.04);
  box-shadow: 0 0 0 1.5px var(--kc, var(--kt-miss)) inset;
}
.kt-plankton { --kc: var(--kt-plankton); }
.kt-tooclever { --kc: var(--kt-tooclever); }
.kt-schooler { --kc: var(--kt-schooler); background: rgba(77,227,255,.08); }
.kt-rare { --kc: var(--kt-rare); background: rgba(255,107,139,.12); box-shadow: 0 0 0 1.5px var(--kc) inset, 0 0 12px rgba(255,107,139,.35); }
.kt-deepcut { --kc: var(--kt-deepcut); background: rgba(169,139,255,.14); box-shadow: 0 0 0 1.5px var(--kc) inset, 0 0 14px rgba(169,139,255,.45); }
.kt-krillion { --kc: var(--kt-krillion); background: rgba(255,209,102,.16); box-shadow: 0 0 0 1.5px var(--kc) inset, 0 0 18px rgba(255,209,102,.6); }
.kt-miss { --kc: var(--kt-miss); background: rgba(0,0,0,.25); font-size: 12px; opacity: .75; }

.kr-results { list-style: none; margin: 18px 0 0; padding: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.kr-results li { display: grid; grid-template-columns: 48px 1fr auto; column-gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.kr-results li:last-child { border-bottom: 0; }
.kr-results .rank { font-family: var(--serif-display); font-style: italic; font-variation-settings: 'opsz' 96, 'wght' 600; font-size: 22px; text-align: right; padding-right: 4px; color: var(--ink-fade); }
.kr-results li.gold .rank { color: var(--kt-krillion); }
.krr-main { display: grid; gap: 6px; min-width: 0; }
.krr-tiles { display: flex; gap: 3px; flex-wrap: wrap; }
.krr-tiles .kt { width: 26px; height: 26px; font-size: 14px; border-radius: 6px; }
.krr-score { text-align: right; line-height: 1.05; }
.krr-score b { display: block; font-family: var(--serif-display); font-variation-settings: 'opsz' 96, 'wght' 700; font-size: 28px; color: var(--ink); }
.krr-score small { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--kt-schooler); }
.kr-results .cr-note { font-size: 14px; }

/* Sounding chart */
.sounding { margin: 0; position: relative; }
.sounding svg { width: 100%; height: auto; display: block; border-radius: 4px; overflow: visible; }
.sd-band { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.sd-m { font-family: var(--mono); font-size: 9px; fill: var(--ink-faint); }
.sd-surface { font-family: var(--mono); font-size: 9.5px; letter-spacing: .24em; fill: var(--kt-schooler); }
.sd-name { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 13px; fill: var(--ink); }
.sd-depth { font-family: var(--mono); font-size: 10px; fill: var(--ink-fade); }
.sd-diver { animation: descend 1.6s cubic-bezier(.3,.7,.2,1) both; animation-delay: var(--d); }
.sd-ring { animation: sonar 2.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.sd-wave { animation: wave 6s linear infinite; }
.sd-bubble { fill: rgba(170,230,255,.35); animation: rise var(--s) linear infinite; animation-delay: calc(var(--b) * -1); }
@keyframes descend { from { transform: translateY(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sonar { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-24px); } }
.sounding svg .sd-bubble { animation-name: bubbleUp; }
@keyframes bubbleUp { from { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } to { transform: translateY(-400px); opacity: 0; } }

/* Prompt-by-prompt */
.kr-prompts { --kp-cols: 4; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); overflow-x: auto; }
.kp-row {
  display: grid; grid-template-columns: minmax(200px, 1fr) repeat(var(--kp-cols), 64px) 56px;
  align-items: center; gap: 6px; padding: 8px 4px; border-bottom: 1px dotted var(--rule-soft);
  min-width: min-content;
}
.kp-row:last-child { border-bottom: 0; }
.kp-head { padding: 10px 4px 8px; background: var(--paper-warm); border-bottom: 1px solid var(--rule); }
.kp-head .kp-q, .kp-who, .kp-head .kp-pts { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.kp-who { text-align: center; border-bottom: 2px solid var(--pc); padding-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp-q { font-family: var(--serif-body); font-size: 15.5px; color: var(--ink); display: flex; gap: 10px; align-items: baseline; }
.kp-q b { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); font-weight: 700; }
.kp-cell { display: grid; place-items: center; }
.kp-pts { font-family: var(--mono); font-size: 13px; font-weight: 700; text-align: right; color: var(--ink-soft); }
.kp-hard { background: linear-gradient(90deg, rgba(61,79,110,.35), transparent 70%); }
.kp-hard .kp-q::after { content: 'blind spot'; font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--kt-miss); background: var(--ink-faint); color: var(--paper); padding: 1px 5px; border-radius: 2px; }
.kp-sealed { color: var(--ink-faint); font-style: italic; }
.kp-seal { display: inline-block; padding: 8px 12px; border: 1px dashed var(--rule); color: var(--ink-soft); font-style: normal; }
.kp-rich { background: linear-gradient(90deg, rgba(255,209,102,.08), transparent 70%); }
.kp-rich .kp-pts { color: var(--kt-krillion); }

/* Logbook / field guide / past dives */
.haul-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.haul { display: inline-flex; align-items: center; gap: 2px; }
.haul .kt { width: 24px; height: 24px; font-size: 13px; border-radius: 5px; }
.haul small { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.kr-tiers { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.kr-tiers li { display: grid; grid-template-columns: 36px 1fr auto; column-gap: 12px; align-items: center; padding: 9px 2px; border-bottom: 1px dotted var(--rule-soft); }
.kr-tiers li:last-child { border-bottom: 0; }
.ktr-name { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 16px; }
.ktr-pts { font-family: var(--mono); font-size: 11px; color: var(--ink-fade); text-align: right; }
.ktr-blurb { grid-column: 2 / -1; font-style: italic; font-size: 13.5px; color: var(--ink-fade); }
.kr-log { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.kr-log li { display: grid; grid-template-columns: 4.2em 1fr auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 1px; align-items: center; padding: 9px 6px; border-bottom: 1px dotted var(--rule-soft); }
.kr-log .kl-num { grid-row: 1 / span 2; font-size: 18px; }
.kr-log .kl-date { grid-column: 2; grid-row: 1; }
.kr-log .kl-best { grid-column: 2; grid-row: 2; font-family: var(--serif-body); font-size: 15px; }
.kr-log .kl-best em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--kt-schooler); margin-left: 4px; }
.kr-log .kl-avg { grid-column: 3; grid-row: 1 / span 2; }
.kr-log li:last-child { border-bottom: 0; }
.kr-log li.empty { display: block; text-align: center; }
.kl-num { font-family: var(--serif-display); font-variation-settings: 'wght' 600; }
.kl-date, .kl-avg { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-fade); }
.kl-best { display: flex; gap: 6px; align-items: baseline; }


/* ============================================================
   SHARED — qualifying line, sub-figures
============================================================ */
.lb-table tr.lb-divider td {
  padding: 10px 6px 6px !important; border-bottom: 1px dotted var(--rule-soft);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint);
  text-align: left; background: transparent !important;
}
.lb-table tr.unranked td { opacity: .62; }
.lb-table tr.unranked .rank-col { font-style: normal; }
.lb-table td.muted-col { color: var(--ink-fade); font-size: 12px; }
.lb-table .sub-m { display: block; font-size: 9.5px; font-weight: 400; letter-spacing: .06em; color: var(--ink-faint); margin-top: 1px; }
.conn-results li.lost .rank { color: var(--ink-faint); }

/* ============================================================
   CONNECTIONS — THE RECORD (player × day ledger)
============================================================ */
.ledger {
  --cell: 15px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 10px 0 12px;
}
.lg-side { display: grid; grid-auto-rows: var(--cell); row-gap: 4px; }
.lg-side .lg-h, .lg-months { height: 16px; }
.lg-side .lg-h { margin-bottom: 0; }
.lg-name { display: flex; align-items: center; gap: 7px; font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 14px; white-space: nowrap; line-height: 1; }
.lg-name .swatch { top: 0; }
.lg-sum { font-family: var(--mono); font-size: 10.5px; color: var(--ink-fade); line-height: var(--cell); text-align: right; white-space: nowrap; }
.lg-sum b { color: var(--ink); font-weight: 700; }
.lg-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.lg-grid { display: grid; grid-auto-rows: var(--cell); row-gap: 4px; min-width: calc(var(--n) * 8px); }
.lg-months, .lg-row { display: grid; grid-template-columns: repeat(var(--n), minmax(6px, 1fr)); column-gap: 2px; }
.lg-months { align-items: end; }
.lg-months span { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); border-left: 1px solid var(--rule-soft); padding-left: 4px; white-space: nowrap; overflow: hidden; }
.lc { display: block; height: 100%; border-radius: 2px; background: rgba(120,100,70,.08); }
.lg-legend .lc { width: 11px; height: 11px; display: inline-block; vertical-align: -1px; }
.lc[data-n] { cursor: pointer; }
.lc[data-n]:hover { outline: 1.5px solid var(--ink); outline-offset: 1px; }
.lc-perfect { background: #4f7d2c; }
.lc-m1 { background: #93b85e; }
.lc-m2 { background: #d9c45e; }
.lc-m3 { background: #d58b3d; }
.lc-lost { background: var(--oxblood); }
.lg-today { grid-row: 1; font-size: 10px; line-height: 1; color: var(--oxblood); text-align: center; align-self: end; }
.lg-months span { grid-row: 1; }
.lg-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-fade); align-items: center; }
.lg-legend span { display: inline-flex; gap: 6px; align-items: center; }
.lg-legend .lg-note { margin-left: auto; text-transform: none; letter-spacing: 0; font-family: var(--serif-body); font-style: italic; font-size: 12.5px; }

/* ============================================================
   KRILLION — day stepper, totals, records, log, depth record
============================================================ */
.kp-sechead { display: grid; grid-template-columns: 1fr auto; column-gap: 18px; align-items: end; }
.kp-sechead .subdeck { grid-column: 1 / -1; }
.day-nav { display: inline-flex; align-items: center; gap: 4px; }
.dn-btn {
  width: 34px; height: 34px; border: 1px solid var(--rule); background: transparent; color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer; border-radius: 3px;
}
.dn-btn:hover:not(:disabled) { background: rgba(77,227,255,.1); border-color: var(--oxblood); }
.dn-btn:disabled { opacity: .3; cursor: default; }
.dn-label { display: grid; justify-items: center; min-width: 7.5em; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-fade); line-height: 1.25; }
.dn-label b { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 17px; letter-spacing: 0; color: var(--ink); text-transform: none; }
.kp-seal .btn-link { margin-left: 4px; color: var(--oxblood); }
.kp-q > span { min-width: 0; }
.kp-foot { background: var(--paper-warm); border-top: 1px solid var(--rule); }
.kp-foot .kp-q { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.kp-tot { text-align: center; font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--ink); }
.kp-foot .kp-pts { color: var(--ink); }

.kr-records { list-style: none; margin: 0 0 16px; padding: 0; border-top: 2px solid var(--ink); }
.kr-records li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 9px 2px; border-bottom: 1px dotted var(--rule-soft); cursor: pointer; }
.kr-records li:hover, .kr-log li:hover { background: rgba(77,227,255,.06); }
.rec-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--kt-schooler); }
.rec-v { grid-column: 1; font-family: var(--serif-body); font-size: 15px; color: var(--ink); }
.rec-day { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--mono); font-size: 10.5px; color: var(--ink-fade); }
.kr-log li { cursor: pointer; }
.kr-log li.on { background: rgba(77,227,255,.09); box-shadow: inset 3px 0 0 var(--kt-schooler); }

.depth-record { margin: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 8px 0; }
.depth-record svg { display: block; width: 100%; height: auto; }
.dr-grid { stroke: rgba(160,200,255,.12); stroke-dasharray: 2 4; }
.dr-ax { font-family: var(--mono); font-size: 10px; fill: var(--ink-faint); letter-spacing: .04em; }
.dr-fam { fill: none; stroke: rgba(232,243,255,.55); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dr-lab { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 13px; }
.dr-fam-lab { fill: var(--ink-fade); font-family: var(--mono); font-size: 10px; font-weight: 400; }
.dr-line polyline { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; opacity: .9; }
.dr-line circle { fill: var(--c); stroke: var(--paper); stroke-width: 2; }
.dr-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 6px; font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'wght' 600; font-size: 14px; }
.dr-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dr-legend .swatch { top: 0; }
.dr-legend-fam { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-fade); font-weight: 400; }
.dr-legend-fam i { display: inline-block; width: 22px; border-top: 1.5px dashed rgba(232,243,255,.55); }
.dr-line:hover polyline { stroke-width: 3.5; opacity: 1; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 980px) {
  .game-tabs { margin: -12px -6px 18px; }
  .krill-hero { grid-template-columns: 1fr; gap: 18px; }
  .sounding { max-width: 520px; margin: 0 auto; width: 100%; }
  .case-body { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .rule .rule-label { white-space: nowrap; letter-spacing: .22em; padding: 0 12px; }
  .game-tabs { margin: -12px -6px 14px; padding: 6px 4px 0; }
  .gt-tab { flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px; text-align: center; }
  .gt-text { justify-items: center; }
  .gt-sec { display: none; }
  .gt-name { font-size: 15px; }
  .gt-live { font-size: 11px; max-width: 100%; }
  .gt-glyph i { width: 8px; height: 8px; }
  .gt-wordle { grid-template-columns: repeat(3, 8px); }
  .gt-conn { grid-template-columns: repeat(2, 8px); }
  .gt-krill { width: 22px; height: 22px; font-size: 15px; }

  .np-conn, .np-krill { margin-top: 8px; gap: 2px; }
  .cn-tile { width: clamp(22px, 7.4vw, 34px); font-size: clamp(13px, 4.4vw, 19px); border-radius: 4px; }
  .cn-tile.c-G + .cn-tile.c-B, .cn-tile.c-Y + .cn-tile.c-G, .cn-tile.c-B + .cn-tile.c-P { margin-left: 4px; }
  .kn-tile { width: clamp(30px, 9.6vw, 44px); font-size: clamp(17px, 5.4vw, 24px); }
  .kn-shrimp { font-size: 24px; margin-left: 2px; }

  .conn-results li { grid-template-columns: 38px 1fr auto; column-gap: 12px; }
  .conn-results .rank { font-size: 20px; }
  .cg-row { grid-template-columns: repeat(4, 11px); gap: 2px; }
  .cg { gap: 2px; }
  .cg-row i { height: 11px; }
  .cg.xs .cg-row { grid-template-columns: repeat(4, 5px); gap: 1px; }
  .cg.xs .cg-row i { height: 5px; }

  .conn-table th:nth-child(6), .conn-table td:nth-child(6),
  .conn-table th:nth-child(7), .conn-table td:nth-child(7),
  .conn-table th:nth-child(8), .conn-table td:nth-child(8) { display: none; }
  .ledger { --cell: 13px; column-gap: 8px; }
  .lg-name { font-size: 12.5px; gap: 5px; }
  .lg-grid { min-width: calc(var(--n) * 9px); }
  .lg-legend { gap: 6px 10px; }
  .lg-legend .lg-note { margin-left: 0; width: 100%; }
  .kp-sechead { grid-template-columns: 1fr; row-gap: 8px; }
  .kp-sechead .day-nav { grid-row: 2; justify-self: start; }
  .kp-sechead .subdeck { grid-row: 3; }
  .kp-tot { font-size: 11px; }
  .order-row { grid-template-columns: 1fr; gap: 4px; }
  .order-head { display: none; }
  .or-bars { gap: 4px; }
  .order-row .or-bars::before { content: none; }
  .ob { height: 20px; }
  .order-row:nth-child(2) .ob { height: 26px; }
  .order-row:nth-child(2) { padding-bottom: 6px; border-bottom: 1px dotted var(--rule-soft); }
  .order-grid::before {
    content: '1st → 2nd → 3rd → 4th group found';
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  }
  .tangles li { grid-template-columns: auto 1fr 2em; }
  .tangles .tg-bar { grid-column: 1 / -1; grid-row: 2; }
  .conn-ext li { grid-template-columns: 18px auto 1fr auto; gap: 10px; }
  .ce-purple { font-size: 11px; }

  .case summary { grid-template-columns: auto 1fr auto 12px; grid-template-rows: auto auto; gap: 4px 10px; }
  .case-num { grid-column: 1; grid-row: 1; }
  .case-date { grid-column: 2; grid-row: 1; }
  .case-meta { grid-column: 3; grid-row: 1; }
  .case summary::after { grid-column: 4; grid-row: 1; }
  .case-thumbs { grid-column: 1 / -1; grid-row: 2; }
  .case-grids { gap: 14px 18px; }

  .kr-results li { grid-template-columns: 34px 1fr auto; column-gap: 10px; }
  .krr-tiles .kt { width: 24px; height: 24px; font-size: 13px; }
  .krr-score b { font-size: 24px; }
  .kp-row { grid-template-columns: minmax(104px, 1fr) repeat(var(--kp-cols), 34px) 34px; gap: 4px; padding: 7px 2px; }
  .kp-cell .kt { width: 30px !important; height: 30px !important; font-size: 16px !important; }
  .kp-pts { font-size: 12px; }
  .kr-table th:nth-child(5), .kr-table td:nth-child(5),
  .kr-table th:nth-child(6), .kr-table td:nth-child(6),
  .kr-table th:nth-child(7), .kr-table td:nth-child(7) { display: none; }
  .kr-table .player-cell { flex-wrap: nowrap; gap: 6px; }
  .kr-table .player-name { white-space: nowrap; font-size: 15.5px; }
  .kr-table td { padding: 10px 6px !important; }
  .haul-wrap { flex-wrap: wrap; gap: 3px 5px; max-width: 132px; }
  .haul .kt { width: 20px; height: 20px; font-size: 11px; border-radius: 4px; }
  .haul small { font-size: 9.5px; }
  .kp-q { font-size: 14px; gap: 6px; }
  .kp-hard .kp-q::after { display: none; }
  .kp-who { font-size: 9px; letter-spacing: .04em; }
  .kl-avg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kn-tile, .kn-shrimp, .sd-ring, .sd-wave, .sd-bubble, .sd-diver, .pane { animation: none !important; }
}
