:root {
  font-family: "Trebuchet MS", Arial, sans-serif;
  color: #153d43;
  background: #faf8f2;
  --ink: #153d43;
  --line: #d6dcd3;
  --muted: #526665;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #087f75; outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link:focus { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 12px; background: white; }
.site-header, main { max-width: 1560px; margin: auto; padding-inline: clamp(14px, 2.6vw, 44px); }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 11px; align-items: center; font-size: clamp(19px, 2vw, 26px); letter-spacing: -.7px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; transform: rotate(-5deg); }
.brand-mark i { border-radius: 4px; background: #168777; }
.brand-mark i:nth-child(2) { background: #f2b544; }
.brand-mark i:nth-child(3) { background: #e6775c; }
.brand-mark i:nth-child(4) { background: #9380bd; }
.recent { display: inline-flex; align-items: center; min-height: 44px; font-weight: bold; color: #166c61; }
.library { padding-bottom: 18px; }
.library-heading { display: flex; align-items: baseline; gap: 14px; padding: 16px 0 12px; }
.library-heading h1 { font-size: clamp(25px, 2.2vw, 34px); letter-spacing: -1.1px; margin: 0; }
.library-heading p, .book-label { color: var(--muted); margin: 0; font-size: clamp(14px, 1.25vw, 17px); line-height: 1.25; }
.filter-panel { padding: 8px 12px; background: white; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.filter-first-row, .filter-second-row, .year-filters, .type-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.filter-first-row, .filter-second-row { justify-content: space-between; gap: 6px; }
.filter-second-row { border-top: 1px solid #e9ece5; margin-top: 5px; padding-top: 4px; }
.year-filters button, .type-filters button, .reset-filters, .empty button {
  min-height: 44px; border: 0; padding: 7px 10px; background: transparent; color: var(--ink); border-radius: 8px; font-weight: bold; font-size: clamp(15px, 1.25vw, 17px);
}
.year-filters button[aria-pressed=true], .empty button { background: var(--ink); color: white; }
.type-filters button { display: flex; align-items: center; gap: 7px; }
.type-filters button[aria-pressed=true] { background: #deeee7; color: #12584e; }
.type-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.listening { --button-ink: #176958; --button-bg: #e9f4e9; }
.reading { --button-ink: #805313; --button-bg: #fcf2dc; }
.memory { --button-ink: #664b88; --button-bg: #f1edf8; }
.karuta { --button-ink: #31667a; --button-bg: #e7f2f5; }
.hints { --button-ink: #9b4262; --button-bg: #f9eaf1; }
.story { --button-ink: #87460e; --button-bg: #fff0db; }
.secret-abc { --button-ink: #a42e55; --button-bg: #fff0f5; }
.look-say { --button-ink: #286454; --button-bg: #e1f1e8; }
.knockout { --button-ink: #235f54; --button-bg: #e4f1ed; }
.pairs { --button-ink: #28566b; --button-bg: #e9f1f7; }
.wheel { --button-ink: #754e16; --button-bg: #fff0d9; }
.round-robin { --button-ink: #624786; --button-bg: #f0eaf6; }
.type-dot { color: var(--button-ink); }
.reset-filters { text-decoration: underline; }
.search { display: flex; align-items: center; gap: 8px; background: #f5f6f0; border-radius: 8px; padding: 0 12px; border: 1px solid var(--line); }
.search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.search input { min-width: 0; width: clamp(140px, 19vw, 300px); height: 44px; border: 0; background: transparent; color: var(--ink); }
.search kbd { color: var(--muted); }
.topic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.topic-card { --accent: #8d73b2; --tint: #f0eaf6; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 14px; background: white; box-shadow: 0 2px 0 #143d4310; }
.orange { --accent: #c48247; --tint: #fff0d9; }
.blue { --accent: #518ead; --tint: #e9f1f7; }
.green { --accent: #73934e; --tint: #edf4e1; }
.pink { --accent: #b46b8b; --tint: #faeaf0; }
.yellow { --accent: #caa044; --tint: #fbf3d6; }
.teal { --accent: #478e83; --tint: #e4f1ed; }
.coral { --accent: #c67f62; --tint: #fbebe3; }
.topic-heading { display: flex; align-items: center; gap: 10px; }
.topic-heading > div:last-child { min-width: 0; }
.topic-image { display: grid; place-items: center; flex: 0 0 62px; height: 62px; padding: 5px; border-radius: 16px; background: var(--tint); }
.topic-image img { width: 52px; height: 52px; object-fit: contain; mix-blend-mode: multiply; }
.year-label { display: inline-block; background: var(--tint); padding: 3px 7px; border-radius: 5px; font-size: 13px; font-weight: 700; }
.topic-heading h2 { margin: 4px 0; font-size: clamp(20px, 1.75vw, 26px); line-height: 1.12; letter-spacing: -.5px; }
.game-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.game-link { display: flex; gap: 5px; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 5px; border-radius: 8px; background: var(--button-bg); color: var(--button-ink); font-weight: 700; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.12; text-decoration: none; }
.game-link span { min-width: 0; overflow-wrap: break-word; }
.game-link svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; }
.game-link:only-child { grid-column: 1 / -1; }
.game-link:hover, .filter-panel button:hover { box-shadow: inset 0 0 0 1.5px currentColor; }
.empty { text-align: center; padding: 24px; }
.all-games main { font-size: clamp(17px, 1.4vw, 20px); line-height: 1.38; }
.all-games ul { padding-inline-start: 1.5em; }
.all-games li { margin-block: .18em; }
@media (min-width: 1480px) { .topic-grid { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media (max-width: 1150px) { .topic-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 870px) { .topic-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 570px) {
  .site-header { min-height: 58px; }
  .recent { font-size: 13px; }
  .topic-grid { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .search input { flex: 1; }
  .year-filters button, .type-filters button { padding-inline: 8px; }
  .topic-heading h2 { font-size: 22px; }
}
@media (min-width: 970px) and (max-height: 1100px) {
  .site-header { min-height: 48px; }
  .library { padding-bottom: 8px; }
  .library-heading { padding-block: 6px 4px; }
  .library-heading h1 { font-size: 25px; }
  .filter-panel { padding: 4px 8px; margin-bottom: 7px; }
  .filter-first-row :is(button, .search input) { min-height: 36px; height: 36px; }
  .filter-second-row, .type-filters { gap: 2px; }
  .type-filters button { min-height: 35px; padding: 4px 5px; }
  .type-filters .type-dot, .game-link svg { display: none; }
  .topic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .topic-card { gap: 5px; padding: 6px 7px; }
  .topic-heading { gap: 7px; }
  .topic-image { flex-basis: 36px; height: 36px; border-radius: 9px; }
  .topic-image img { width: 30px; height: 30px; }
  .topic-heading h2 { margin-block: 2px; font-size: clamp(19px, 1.6vw, 25px); }
  .book-label { font-size: 14px; }
  .year-label { padding-block: 1px; }
  .game-links { gap: 4px; }
  .game-link { min-height: 36px; padding: 2px 4px; }
  .single-activity { position: relative; align-self: start; min-height: 74px; justify-content: center; }
  .single-activity .topic-heading { padding-right: 20px; }
  .single-activity .game-link { position: absolute; inset: 0; background: transparent; border-radius: 10px; }
  .single-activity .game-link::after { content: "→"; position: absolute; right: 7px; top: 7px; }
  .single-activity .game-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .single-activity .game-link:focus-visible { outline-offset: -3px; }
}
@media (min-width: 970px) and (max-width: 1179px) and (max-height: 1100px) {
  .game-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-link { min-height: 37px; padding-inline: 2px; }
  .filter-second-row .type-filters button { padding-inline: 3px; }
}
@media (min-width: 1180px) and (max-height: 1100px) {
  .topic-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 970px) and (max-height: 650px) {
  .site-header { min-height: 43px; }
  .library-heading { padding-block: 3px; }
  .library-heading h1 { font-size: 23px; }
  .game-link { min-height: 34px; }
}
@media (min-width: 1180px) and (max-height: 650px) {
  .library-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .library { padding-block: 4px; }
  .topic-grid { row-gap: 4px; }
  .topic-card { padding-block: 5px; }
  .game-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-link { min-height: 37px; padding-inline: 2px; font-size: 15px; }
}
