@font-face {
  font-family: Manrope;
  src: url('../assets/fonts/manrope.ttf') format('truetype');
  font-weight: 400 800;
  font-display: swap;
}
:root {
  --navy: #10294f;
  --night: #102343;
  --coral: #f47b55;
  --cream: #fcf5e9;
  --sage: #b8cba9;
  --ink: #193654;
  --muted: #526075;
  --line: #e6dac9;
  color: var(--navy);
  background: var(--cream);
  font: 16px/1.5 Manrope, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 92% 45%, #f6e6d080, transparent 35%), var(--cream); }
a { color: inherit; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid #517ec5; outline-offset: 4px; }
.night :focus-visible { outline-color: #fad59d; }
[hidden] { display: none !important; }
.wrap { width: min(calc(100% - 80px), 1200px); margin-inline: auto; }
.skip { position: absolute; z-index: 5; top: -100px; background: white; padding: .6rem; }
.skip:focus { top: .5rem; }

.night {
  color: #fff8ee;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 69% 14%, #254374, transparent 54%),
    linear-gradient(114deg, #102343 15%, #142b51 72%, #1a3157);
}
.night::before, .night::after { content: ''; position: absolute; pointer-events: none; }
.night::before {
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 11% 32%, #e8bd7e 0 1px, transparent 2px),
    radial-gradient(circle at 31% 87%, #b1c3ef 0 1px, transparent 2px),
    radial-gradient(circle at 46% 24%, #afc4ee 0 1px, transparent 2px),
    radial-gradient(circle at 88% 29%, #f1c284 0 1px, transparent 2px),
    radial-gradient(circle at 95% 73%, #c0d0f3 0 1px, transparent 2px),
    radial-gradient(ellipse at 75% 65%, #6888be1f, transparent 44%),
    radial-gradient(ellipse at 23% 69%, #4677ab19, transparent 42%);
}
.night-wash, .night-stars, .shoreline { position: absolute; pointer-events: none; }
.night-wash {
  z-index: -1;
  inset: 0;
  background: url('../assets/hero/paper-grain.webp') repeat;
  opacity: .075;
  mix-blend-mode: soft-light;
}
.night-stars { inset: 0; z-index: -1; }
.night-stars i {
  position: absolute;
  width: 11px;
  aspect-ratio: 1;
  background: #f6d8a8;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  opacity: .65;
}
.night-stars i:nth-child(1) { left: 6%; top: 59%; width: 8px; }
.night-stars i:nth-child(2) { left: 42%; top: 39%; }
.night-stars i:nth-child(3) { right: 6%; top: 54%; width: 8px; }
.night-stars i:nth-child(4) { left: 36%; top: 83%; width: 7px; opacity: .47; }
.night::after, .shoreline {
  inset: auto 0 -1px;
  height: 42px;
  clip-path: polygon(0 56%, 13% 66%, 26% 55%, 43% 30%, 56% 35%, 69% 49%, 83% 29%, 94% 20%, 100% 26%, 100% 100%, 0 100%);
  clip-path: shape(from 0 56%, curve to 26% 55% with 9% 67% / 17% 72%, curve to 56% 35% with 36% 35% / 46% 21%, curve to 83% 29% with 66% 51% / 72% 52%, curve to 100% 26% with 89% 17% / 96% 15%, line to 100% 100%, line to 0 100%, close);
}
.night::after { background: var(--cream); }
.shoreline {
  bottom: 4px;
  background: linear-gradient(100deg, #809ac577, #eaa18995 42%, #edac8888 71%, #8eacd777);
}
.night header { position: relative; z-index: 2; min-height: 79px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.brand img { display: block; width: clamp(216px, 25.2vw, 318px); height: auto; }
nav { display: flex; align-items: center; gap: .25rem; padding: .22rem; border: 1px solid #bed0f232; border-radius: 30px; background: #101f3b75; }
nav a { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 43px; padding: 0 .78rem; border-radius: 25px; text-decoration: none; white-space: nowrap; font-size: .94rem; font-weight: 800; }
nav a:hover, nav a[aria-current] { background: #c4d4f026; }
nav a:last-child { width: 44px; font-size: 1.05rem; padding: 0; background: #c4d4f018; }
.nav-heart { color: #ffc2a7; font-size: 1.5em; line-height: .65; }
.controller { position: relative; width: 1.35em; height: .8em; border-radius: 45% 45% 38% 38%; background: #c3cdfd; color: #182f55; }
.controller::before, .controller::after { position: absolute; top: 50%; transform: translateY(-54%); font: 800 .68em/1 system-ui, sans-serif; }
.controller::before { content: '+'; left: 12%; }
.controller::after { content: '••'; right: 11%; font-size: .51em; letter-spacing: .03em; }
.layers { width: .8em; height: .8em; position: relative; margin: 0 .18em; color: #c4dfbc; }
.layers::before, .layers::after { content: ''; position: absolute; inset: 0; border: 1.7px solid; border-radius: 2px; transform: translateY(-23%) rotate(30deg) skewX(-24deg) scale(.85); }
.layers::after { transform: translateY(12%) rotate(30deg) skewX(-24deg) scale(.85); border-top: 0; border-left: 0; }
.search-icon { width: .93em; height: .93em; border: 2px solid currentColor; border-radius: 50%; position: relative; flex: none; display: inline-block; margin-right: .18em; }
.search-icon::after { content: ''; position: absolute; width: .4em; height: 2px; background: currentColor; transform: rotate(48deg); left: .63em; top: .69em; }

.hero { display: grid; grid-template-columns: .87fr 1.13fr; align-items: center; position: relative; min-height: 352px; padding-bottom: 36px; }
.hero-copy { z-index: 1; padding-block: 10px 25px; }
.hero h1 { margin: 0; font-size: clamp(3.35rem, 6.35vw, 6.1rem); font-weight: 800; letter-spacing: -.078em; line-height: .91; }
.hero .dot { color: #fca27f; margin-inline: .055em; }
.hero em { display: inline-block; position: relative; font-style: normal; color: #ffd4b9; }
.hero em::after {
  content: '';
  position: absolute;
  inset: auto -.055em -.18em .025em;
  height: .18em;
  background: linear-gradient(92deg, #f49a7200, #f49a72 16%, #f5b58e 52%, #f49a72 81%, #f49a7214);
  clip-path: polygon(0 87%, 23% 42%, 48% 33%, 69% 44%, 85% 27%, 100% 0, 83% 52%, 67% 78%, 46% 63%, 23% 66%);
  clip-path: shape(from 0 86%, curve to 48% 29% with 15% 43% / 29% 15%, curve to 100% 0 with 66% 48% / 83% 28%, curve to 49% 64% with 88% 48% / 70% 83%, curve to 0 86% with 30% 44% / 15% 72%, close);
}
.hero-copy p { margin: 1.36rem 0 1rem; color: #e9e9f4; font-weight: 600; font-size: clamp(.99rem, 1.6vw, 1.14rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.hero-art { position: relative; pointer-events: none; min-width: 0; height: clamp(290px, 28vw, 344px); isolation: isolate; }
.hero-art::before, .hero-art::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 12% -11% 6% -8%;
  background: linear-gradient(115deg, #89a8da0a, #a6bce78f 27%, #a9c3fa00 62%, #a6bce780);
  clip-path: shape(from 0 85%, curve to 28% 56% with 11% 93% / 18% 69%, curve to 58% 36% with 38% 44% / 47% 41%, curve to 100% 1% with 74% 29% / 88% 20%, curve to 58% 37% with 89% 21% / 76% 31%, curve to 28% 57% with 46% 43% / 38% 46%, curve to 0 85% with 19% 71% / 11% 93%, close);
}
.hero-art::after {
  inset: 19% -13% 6% -8%;
  background: linear-gradient(115deg, #ef9d760b, #efad9188 31%, #f2a8810b 64%, #ed9c777b);
  clip-path: shape(from 0 75%, curve to 29% 69% with 9% 90% / 20% 83%, curve to 66% 46% with 43% 48% / 51% 58%, curve to 100% 3% with 79% 36% / 91% 23%, curve to 66% 47% with 91% 24% / 80% 38%, curve to 29% 70% with 51% 60% / 42% 50%, curve to 0 75% with 19% 85% / 9% 90%, close);
}
@supports not (clip-path: shape(from 0 0, line to 100% 100%, close)) {
  .hero-art::before, .hero-art::after { background: none; }
}
.hero-art img {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(112%, 640px);
  height: auto;
  mask-image: radial-gradient(ellipse 51% 51% at 50% 49%, black 62%, transparent 99%);
}
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1rem; border: 1px solid transparent; border-radius: 999px; text-decoration: none; font-weight: 800; line-height: 1.2; }
.primary { background: var(--coral); color: #112747; }
.primary:hover { background: #ffa585; }
.hero .primary { padding-inline: 1.2rem; box-shadow: 0 5px 17px #060c2550; }
.play-icon { display: inline-block; width: .71em; height: .8em; margin-right: .55em; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.secondary { color: #fff8ee; background: #e2ebff0e; border-color: #e1ecf657; gap: .42rem; }
.down-arrow { width: .45em; height: .45em; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: translateY(-.1em) rotate(45deg); }
.secondary:hover { background: #e1ecf62f; }
.outline { border-color: #c5d1b8; background: #eef1e5; color: #21463e; }
.outline:hover { background: #dce8d3; }

main > section { scroll-margin-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 11px 0 15px; }
h2 { font-size: clamp(1.65rem, 3vw, 2.55rem); margin: 0; font-weight: 800; letter-spacing: -.065em; line-height: 1.12; }
.section-head h2 { position: relative; }
.section-head h2::after { content: ''; width: 1.14em; margin-left: .3em; height: .27em; display: inline-block; border-top: 3px solid #92ac81; border-radius: 50%; transform: rotate(-10deg) translateY(.2em); vertical-align: middle; }
.library-head h2::after { border-color: #e78d6a; }
.text-action { border: 0; background: transparent; font-weight: 800; min-height: 44px; padding: .25rem; }
.text-action:hover { text-decoration: underline; text-underline-offset: .22em; }
#all-topics { font-size: .88rem; white-space: nowrap; }
.topic-grid, .game-grid { display: grid; gap: .85rem; }
.topic-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.topic {
  display: grid;
  grid-template-rows: clamp(75px, 8.4vw, 117px) auto;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid #10294f12;
  border-radius: 20px;
  overflow: hidden;
  background: #e8eedb;
  text-align: center;
  font-size: clamp(.88rem, 1.46vw, 1.15rem);
  font-weight: 800;
}
.topic:nth-child(2), .topic:nth-child(5) { background: #f9e3d4; }
.topic:nth-child(3), .topic:nth-child(6) { background: #e4eafb; }
.topic:hover, .topic[aria-pressed="true"] { border-color: #688468; box-shadow: 0 3px 0 #829c7450; }
.topic img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 21%; mask-image: linear-gradient(black 70%, transparent 100%); }
.topic span { padding: .05rem .3rem .65rem; }
#library { margin-top: 23px; }
.tools { display: flex; gap: .7rem; flex: 0 1 47%; }
.searchbox { display: flex; align-items: center; flex: 1; min-height: 44px; min-width: 0; gap: .55rem; padding-inline: .85rem; border: 2px solid #a5afbe; background: #fffdfa; border-radius: 999px; box-shadow: 0 2px 5px #10294f0d; }
.searchbox input { border: 0; min-width: 0; width: 100%; color: var(--navy); background: transparent; font-size: .94rem; font-weight: 650; }
.searchbox input::placeholder { color: #526075; }
.searchbox:focus-within { outline: 2px solid #517ec5; }
.searchbox input:focus { outline: none; }
.filter-icon { position: relative; width: .88rem; height: .68rem; display: inline-block; border-block: 1.5px solid currentColor; margin-right: .46rem; }
.filter-icon::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: currentColor; top: -2.5px; left: 3px; box-shadow: 5px 9.5px currentColor; }
#filters { padding: 1rem; margin-bottom: .7rem; border: 1px solid var(--line); background: #fffaf2; border-radius: 18px; }
#filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: .65rem; }
#filter-fields label { display: grid; font-weight: 700; }
select { min-width: 0; background: white; color: var(--navy); min-height: 44px; border: 1px solid #a1a9ad; border-radius: 8px; padding: .25rem; }
.status { margin: .45rem 0; color: var(--ink); }
.status:empty { display: none; }
.game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; overflow: hidden; position: relative; border: 1px solid var(--line); border-radius: 21px; background: #fffaf3; box-shadow: 0 3px 10px #5234150b; }
.cover { width: 100%; height: auto; aspect-ratio: 2.3; display: block; object-fit: cover; object-position: center 29%; }
.heart { position: absolute; right: .55rem; top: .55rem; border: 1px solid #efdacb; background: #fffaf2; color: #a83d33; border-radius: 50%; width: 44px; height: 44px; font-size: 1.6rem; line-height: 1; }
.heart:hover, .heart[aria-pressed="true"] { background: #ffebe2; }
.card-body { flex: 1; display: flex; flex-direction: column; padding: .75rem .85rem .6rem; }
h3 { margin: 0; line-height: 1.24; font-size: 1.1rem; letter-spacing: -.035em; font-weight: 800; }
.meta { display: flex; flex-wrap: wrap; gap: .27rem .52rem; align-items: center; font-size: .77rem; font-weight: 650; color: var(--muted); margin: .43rem 0 .6rem; }
.level { border-radius: 6px; padding: .08rem .42rem; background: #dce9d1; color: #27483e; font-weight: 800; }
.card-actions { display: flex; align-items: center; gap: .15rem .57rem; flex-wrap: wrap; margin-top: auto; }
.card-actions .button { padding-inline: .89rem; font-size: 1.05rem; }
.card-actions .text-action { font-size: .87rem; text-decoration: underline; text-decoration-color: #829473; text-underline-offset: .23em; }
.word-count { font-size: .84rem; color: var(--navy); font-weight: 800; white-space: nowrap; }
footer { padding: 1.6rem 0; font-size: .83rem; color: var(--muted); font-weight: 700; }
dialog { width: min(92vw, 630px); max-height: 85dvh; border: 1px solid var(--line); border-radius: 20px; padding: 1.2rem; background: var(--cream); color: var(--navy); }
dialog::backdrop { background: #0c204b99; }
.close { float: right; width: 44px; padding: 0; font-size: 1.35rem; }
.vocabulary ul { padding-left: 1.3rem; }
.topic-directory { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .55rem; }
.topic-directory .button { width: 100%; flex-wrap: wrap; gap: .35rem; justify-content: space-between; text-align: left; }
.topic-directory span { font-size: .82rem; font-weight: 600; }

@media (max-width: 960px) {
  .wrap { width: calc(100% - 48px); }
  .hero { min-height: 300px; }
  .hero h1 { font-size: clamp(3rem, 7.5vw, 5.2rem); }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topic { grid-template-rows: 96px auto; }
  .tools { flex-basis: 55%; }
}
@media (max-width: 645px) {
  .wrap { width: calc(100% - 30px); }
  .night header { min-height: 0; padding-block: .45rem .36rem; flex-wrap: wrap; gap: .35rem; }
  nav { width: 100%; justify-content: space-between; gap: .1rem; }
  nav a { font-size: .88rem; padding-inline: .35rem; gap: .32rem; }
  .hero { display: block; padding-top: 17px; padding-bottom: 27px; }
  .hero-copy { padding: 0; text-align: center; position: relative; }
  .hero h1 { font-size: clamp(2.88rem, 11.8vw, 4.5rem); }
  .hero-actions { justify-content: center; gap: .4rem; }
  .hero-actions .button { padding-inline: .7rem; font-size: .88rem; }
  .hero-copy p { margin: 1.05rem 0 .67rem; }
  .hero-art { height: clamp(180px, 51vw, 255px); margin-top: -4px; }
  .hero-art img { width: min(116%, 520px); }
  .hero-art::before, .hero-art::after { inset: 16% -7% 12%; }
  .night::after, .shoreline { height: 30px; }
  .night-stars i:nth-child(2) { left: 87%; top: 38%; width: 7px; }
  .section-head { gap: .3rem; }
  .section-head h2::after { width: .67em; }
  .library-head { align-items: stretch; flex-direction: column; }
  .tools { flex-basis: auto; gap: .5rem; }
  .topic-grid, .game-grid { gap: .55rem; }
  .topic { grid-template-rows: clamp(55px, 17vw, 91px) auto; border-radius: 14px; font-size: clamp(.76rem, 3vw, 1rem); }
  .topic span { padding-bottom: .43rem; }
  .card { border-radius: 15px; }
  .card-body { padding: .55rem .58rem .45rem; }
  .heart { right: .25rem; top: .25rem; }
  .card-actions .button { padding-inline: .68rem; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
