@font-face { font-family: "Ubuntu"; font-weight: 700; font-display: swap; src: url("../assets/fonts/Ubuntu-B.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu"; font-weight: 500; font-display: swap; src: url("../assets/fonts/Ubuntu-M.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu"; font-weight: 400; font-display: swap; src: url("../assets/fonts/Ubuntu-R.ttf") format("truetype"); }

:root {
  --navy: #16204a; --night: #0e1438; --sky: #2b3a8f; --sun: #ffc83d; --orange: #ff8a00;
  --red: #ec2d3c; --green: #28af50; --blue: #1e78e6; --cream: #fff7e6; --paper: #fffdf7;
  --ink: #241d3b; --muted: #6b6380; --line: #e7dcc4;
  --r: 22px; --shadow: 0 6px 0 rgba(22, 32, 74, .18), 0 14px 30px rgba(22, 32, 74, .12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Ubuntu, system-ui, sans-serif; color: var(--ink); background: var(--cream); line-height: 1.5; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--night); color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 4px solid var(--navy); border-radius: 16px;
        padding: 4px 12px 6px; text-decoration: none; transform: rotate(-2deg); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.logo b { font-size: 26px; font-weight: 700; letter-spacing: .5px; -webkit-text-stroke: 1px var(--navy); }
.logo b:nth-child(1) { color: var(--red); } .logo b:nth-child(2) { color: var(--orange); }
.logo b:nth-child(3) { color: var(--green); } .logo b:nth-child(4) { color: var(--blue); }
.logo span { color: var(--navy); font-weight: 700; font-size: 15px; margin-left: 8px; line-height: 1.05; }
.top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.top nav a { color: #fff; text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 999px; }
.top nav a:hover, .top nav a:focus-visible { background: rgba(255, 255, 255, .12); }

/* hero */
.hero { background: radial-gradient(1200px 500px at 70% 0%, #3a4bb0 0%, var(--night) 70%); color: #fff; overflow: hidden; position: relative; }
.hero .wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: end; padding-top: 40px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.05; margin: 0 0 14px; color: var(--sun);
           text-shadow: 0 4px 0 var(--navy), 0 0 1px var(--navy); }
.hero p { font-size: 20px; margin: 0 0 22px; max-width: 34em; color: #e9ecff; }
.hero .kids { display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.hero .kids img { width: 48%; max-width: 230px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); }
.hero .pad { padding-bottom: 44px; }
.stars { position: absolute; inset: 0; pointer-events: none;
         background-image: radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 30% 70%, #fff 50%, transparent 51%),
           radial-gradient(3px 3px at 55% 15%, #ffe9a6 50%, transparent 51%), radial-gradient(2px 2px at 80% 40%, #fff 50%, transparent 51%),
           radial-gradient(2px 2px at 92% 10%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 45% 45%, #fff 50%, transparent 51%); opacity: .7; }

.btn { display: inline-flex; align-items: center; gap: 8px; font: 700 18px Ubuntu, sans-serif; text-decoration: none; cursor: pointer;
       border: 3px solid var(--navy); border-radius: 999px; padding: 11px 20px; background: var(--sun); color: var(--navy);
       box-shadow: 0 4px 0 var(--navy); transition: transform .08s; }
.btn:hover { transform: translateY(-2px); } .btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--navy); }
.btn.green { background: var(--green); color: #fff; } .btn.blue { background: var(--blue); color: #fff; }
.btn.white { background: #fff; } .btn[disabled], .btn.soon { background: #ddd8cc; color: #6b6380; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* sections */
section { padding: 48px 0; }
h2 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 8px; color: var(--navy); }
.lede { color: var(--muted); font-size: 18px; margin: 0 0 26px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card { background: var(--paper); border: 3px solid var(--navy); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
        display: flex; flex-direction: column; }
.card a.pic { display: block; aspect-ratio: 16 / 9; background: #ddd; }
.card a.pic img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .ep { font-weight: 700; color: var(--orange); font-size: 14px; letter-spacing: .5px; text-transform: uppercase; }
.card h3 { margin: 0; font-size: 21px; line-height: 1.2; color: var(--navy); }
.card h3 a { color: inherit; text-decoration: none; }
.card .when { color: var(--muted); font-size: 15px; margin: 0; }
.card .btns { margin-top: auto; } .card .btn { font-size: 15px; padding: 8px 14px; }

.feature { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature div { background: #fff; border: 3px solid var(--navy); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.feature h3 { margin: 6px 0 6px; color: var(--navy); } .feature p { margin: 0; color: var(--muted); }
.feature .ico { font-size: 34px; }

.grownups { background: #fff; border-top: 3px dashed var(--line); }
.grownups ul { padding-left: 20px; } .grownups li { margin: 6px 0; }

/* episode page */
.ephead { background: var(--night); color: #fff; }
.ephead .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; padding: 32px 16px; }
.ephead img { border-radius: var(--r); border: 4px solid #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.ephead h1 { margin: 4px 0 10px; font-size: clamp(30px, 4.6vw, 48px); line-height: 1.1; color: var(--sun); text-shadow: 0 3px 0 var(--navy); }
.ephead h1 small { display: block; color: #fff; text-shadow: none; font-size: .55em; margin-top: 6px; }
.ephead p { color: #e3e6fb; font-size: 18px; }
.ephead .ep { color: var(--orange); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.video { aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; border: 4px solid #fff; background: #000; }
.video iframe { width: 100%; height: 100%; border: 0; }

.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.pg { background: #fff; border: 3px solid var(--navy); border-radius: 16px; padding: 10px; text-align: center; box-shadow: var(--shadow); }
.pg img { margin: 0 auto 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.pg .kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.pg .kind.simple { color: var(--green); } .pg .kind.scene { color: var(--blue); }
.pg b { display: block; font-size: 15px; color: var(--navy); line-height: 1.25; margin: 2px 0 8px; }
.pg a.dl { font-weight: 700; font-size: 14px; }

footer { background: var(--night); color: #c9cdf0; padding: 28px 0 36px; font-size: 15px; }
footer a { color: #fff; }

@media (max-width: 760px) {
  .hero .wrap, .ephead .wrap { grid-template-columns: 1fr; }
  .hero .kids img { max-width: 170px; }
  .top nav { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* reader */
.reader { position: fixed; inset: 0; display: flex; flex-direction: column;
          background: radial-gradient(900px 600px at 50% 30%, #fff4d6 0%, #f3d9a4 60%, #d9b27a 100%); }
.reader header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--night); color: #fff; }
.reader header h1 { font-size: 18px; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader header a { color: #fff; font-weight: 700; text-decoration: none; }
#stage { flex: 1; position: relative; min-height: 0; touch-action: pan-y; cursor: pointer; }
#stage canvas { width: 100%; height: 100%; display: block; }
#stage.flat { display: flex; justify-content: center; align-items: center; gap: 0; padding: 12px; }
#stage .flatpage canvas { width: auto; height: auto; max-height: 78vh; max-width: 46vw; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.controls { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 16px 18px; flex-wrap: wrap; }
.controls .btn { font-size: 20px; }
#count { font-weight: 700; color: var(--navy); min-width: 70px; text-align: center; }
#loading[hidden] { display: none; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--navy); }

/* colour online */
body.painting { overflow: hidden; overscroll-behavior: none; }
.painter { position: fixed; inset: 0; display: grid; background: #f3ead6;
           grid-template: "head head head" auto "tools board pal" 1fr / auto 1fr auto; }
.pt-head { grid-area: head; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--night); color: #fff; flex-wrap: wrap; }
.pt-head h1 { font-size: 18px; margin: 0; flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-link { color: #fff; font-weight: 700; text-decoration: none; }
.pt-nav, .pt-actions, .zoom { display: flex; align-items: center; gap: 6px; }
#pgcount { font-weight: 700; min-width: 54px; text-align: center; }
.pt-btn { font: 700 16px Ubuntu, sans-serif; border: 2px solid var(--navy); border-radius: 12px; background: #fff; color: var(--navy);
          padding: 6px 10px; cursor: pointer; min-height: 40px; min-width: 40px; }
.pt-head .pt-btn { border-color: #fff; }
.pt-btn:hover { background: var(--cream); }
.pt-tools { grid-area: tools; display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; background: #fff; border-right: 3px solid var(--navy); overflow-y: auto; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 700 13px Ubuntu, sans-serif; color: var(--navy);
        background: #fff; border: 3px solid transparent; border-radius: 14px; padding: 6px 8px; cursor: pointer; min-width: 66px; }
.tool .ico { font-size: 28px; line-height: 1.1; }
.tool.on { border-color: var(--navy); background: var(--sun); box-shadow: 0 3px 0 var(--navy); }
.tool:disabled { opacity: .35; cursor: default; }
.sizes { display: flex; justify-content: center; gap: 4px; padding: 4px 0; }
.size { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #ccc; background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.size i { display: block; border-radius: 50%; background: var(--navy); }
.size.on { border-color: var(--navy); background: var(--cream); }
.zoom { justify-content: center; flex-wrap: wrap; margin-top: auto; }
#board { grid-area: board; position: relative; overflow: hidden; touch-action: none; cursor: crosshair;
         background: radial-gradient(800px 500px at 50% 40%, #fff7e6, #ead9b4); }
#board[data-tool="fill"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ctext y='26' font-size='24'%3E%F0%9F%AA%A3%3C/text%3E%3C/svg%3E") 4 28, crosshair; }
#paper { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; isolation: isolate;
         box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#lines { mix-blend-mode: multiply; pointer-events: none; }
.pt-palette { grid-area: pal; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 8px; background: #fff;
              border-left: 3px solid var(--navy); overflow-y: auto; }
#current { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--navy); flex: none; box-shadow: inset 0 0 0 3px #fff; }
#swatches { display: grid; grid-template-columns: repeat(2, 42px); gap: 6px; }
.sw { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, .18); background: var(--c); cursor: pointer; padding: 0; }
.sw[aria-checked="true"] { border-color: var(--navy); transform: scale(1.12); box-shadow: 0 0 0 3px var(--sun); }
.more { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
        background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); cursor: pointer; flex: none; }
.more input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
#printimg { display: none; }
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .painter { grid-template: "head" auto "board" 1fr "tools" auto "pal" auto / 1fr; }
  .pt-head { padding: 6px 10px; gap: 6px; }
  .pt-head h1 { font-size: 15px; order: 1; flex-basis: 100%; }
  .pt-actions span { display: none; }
  .pt-actions { margin-left: auto; }
  .pt-tools { flex-direction: row; border-right: 0; border-top: 3px solid var(--navy); padding: 6px; overflow-x: auto; overflow-y: hidden; align-items: center; }
  .tool { min-width: 58px; padding: 4px 6px; font-size: 12px; flex: none; } .tool .ico { font-size: 24px; }
  .zoom { margin: 0 0 0 auto; flex-wrap: nowrap; }
  .pt-palette { flex-direction: row; border-left: 0; padding: 6px 8px 10px; overflow-x: auto; overflow-y: hidden; }
  #swatches { display: flex; gap: 6px; }
  #current { width: 44px; height: 44px; }
  .sw, .more { width: 38px; height: 38px; flex: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .painter { grid-template: "head head head" auto "tools board pal" 1fr / auto 1fr auto; }
  .pt-tools { flex-direction: column; border-top: 0; border-right: 3px solid var(--navy); overflow-y: auto; overflow-x: hidden; }
  .pt-palette { flex-direction: column; border-left: 3px solid var(--navy); overflow-y: auto; overflow-x: hidden; }
  #swatches { display: grid; grid-template-columns: repeat(2, 34px); } .sw, .more { width: 34px; height: 34px; }
  .pt-head h1 { flex-basis: auto; order: 0; }
}
@media print {
  @page { margin: 0; }
  body.painting { background: #fff; overflow: visible; }
  body.painting .painter { display: none; }
  body.painting #printimg { display: block; width: 100%; height: auto; }
}

/* watch links + poster */
.btn.watch { background: var(--red); color: #fff; }
.btn.watch.soonish { background: #fff; color: var(--navy); }
.video.poster { position: relative; display: block; text-decoration: none; }
.video.poster img { width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; box-shadow: none; }
.video.poster .play { position: absolute; left: 50%; top: 50%; width: 84px; height: 60px; margin: -30px 0 0 -42px; border-radius: 16px;
                      background: var(--red); color: #fff; font-size: 30px; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.video.poster .vnote { position: absolute; left: 12px; bottom: 10px; background: rgba(14, 20, 56, .85); color: #fff; font-weight: 700;
                       padding: 4px 12px; border-radius: 999px; font-size: 15px; }
.pgbtns { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pgbtns .btn { font-size: 14px; padding: 6px 12px; }
.reader header .hlinks { display: flex; gap: 14px; }
