/* Homepage title screen: starry purple-to-pink sky, a big centred gold logo,
   a square pixel PLAY button and a row of pixel tiles matching the in-game UI.
   Fits one screen on phones, iPads and desktops. */

body.home2{ background:#2b1550; }
body.home2::before, body.home2 #candy-sky, body[data-page] #candy-sky{ display:none; }

.ts{ position:relative; overflow:hidden; min-height:100vh; min-height:100svh; box-sizing:border-box;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  padding:max(12px, env(safe-area-inset-top)) 16px 28px; text-align:center; border-bottom:0 !important;
  background:radial-gradient(ellipse at 50% 16%, rgba(255,255,255,.38) 0, rgba(255,255,255,0) 44%),
             radial-gradient(circle at 12% 80%, rgba(255,95,162,.5) 0, rgba(255,95,162,0) 40%),
             radial-gradient(circle at 88% 75%, rgba(70,180,255,.45) 0, rgba(70,180,255,0) 42%),
             linear-gradient(180deg, #3b1d78 0%, #7a3dc4 38%, #ff7eb6 78%, #ffc2df 100%) !important; }
.ts::after{ display:none; }
.ts-snow{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; image-rendering:pixelated; }

.ts-inner{ position:relative; z-index:2; width:min(1180px, 100%); display:flex; flex-direction:column;
  align-items:center; gap:18px; }
.ts-head{ display:flex; flex-direction:column; align-items:center; gap:16px; min-width:0; width:100%; }

/* Big gold pixel logo, optically centred. The letterforms sit 18px left of the
   1488px canvas mid (more transparent padding on the right); the Muddle sits on QUEST.
   Logo PNG files are not modified — only scale and position. */
.ts .brand-logo.ts-logo{
  margin:0 auto; width:min(1240px, 94vw); max-width:100%;
  position:relative; left:calc(18 / 1488 * 100%);
}
.ts .brand-logo.ts-logo .bl-wrap,
.ts .brand-logo.ts-logo img{ max-width:100%; }
.ts-logo .bl-wrap{
  display:block; width:100% !important; position:relative; overflow:visible;
  filter:drop-shadow(3px 3px 0 #2a2233);
}
.ts-logo .bl-wrap img{ display:block; width:100%; height:auto; image-rendering:pixelated; }
/* pixel plus-shaped sparkles around the logo (no soft shine sweep) */
.ts-logo .bl-wrap::before{ content:''; position:absolute; inset:-12% -4% -4%; pointer-events:none;
  background:
    linear-gradient(#fff6b0,#fff6b0) 8% 18%/10px 3px no-repeat,
    linear-gradient(#fff6b0,#fff6b0) calc(8% + 3.5px) calc(18% - 3.5px)/3px 10px no-repeat,
    linear-gradient(#ffe066,#ffe066) 92% 12%/12px 3px no-repeat,
    linear-gradient(#ffe066,#ffe066) calc(92% + 4.5px) calc(12% - 4.5px)/3px 12px no-repeat,
    linear-gradient(#fff,#fff) 96% 42%/8px 2px no-repeat,
    linear-gradient(#fff,#fff) calc(96% + 3px) calc(42% - 3px)/2px 8px no-repeat,
    linear-gradient(#fff6b0,#fff6b0) 4% 62%/8px 2px no-repeat,
    linear-gradient(#fff6b0,#fff6b0) calc(4% + 3px) calc(62% - 3px)/2px 8px no-repeat;
  animation:spark 1.8s steps(2, end) infinite; }
@keyframes spark{ 0%,100%{ opacity:.35; } 50%{ opacity:1; } }

/* square pixel PLAY, matching in-game action buttons */
.hero-cta{ display:flex; flex-wrap:wrap; justify-content:center; align-items:flex-start; margin-top:2px; }
.play-wrap{ position:relative; display:inline-block; overflow:visible; }
.ts .play-btn.mega{ display:inline-flex; align-items:center; gap:.35em; font-size:clamp(2rem, 6vw, 3.2rem); font-weight:900; letter-spacing:.06em;
  padding:.28em 1.25em .32em; border-radius:0 !important; border:5px solid var(--ink) !important; color:#fff;
  text-shadow:2px 2px 0 #0c5a3a; overflow:visible !important;
  background:#2fc79a !important;
  box-shadow:inset -6px -6px 0 #14895f, inset 6px 6px 0 #8ff3d0, 6px 6px 0 var(--ink) !important; }
.ts .play-btn.mega::after{ display:none !important; }
.ts .play-btn.mega:hover{ transform:translate(-2px,-2px); box-shadow:inset -6px -6px 0 #14895f, inset 6px 6px 0 #8ff3d0, 8px 8px 0 var(--ink) !important; }
.ts .play-btn.mega:active{ transform:translate(3px,3px); box-shadow:inset -6px -6px 0 #14895f, 2px 2px 0 var(--ink) !important; }
.mega-ico{ width:0; height:0; border-left:.62em solid #fff; border-top:.38em solid transparent; border-bottom:.38em solid transparent; filter:drop-shadow(0 3px 0 #0c5a3a); }

/* square pixel page tiles */
.home-tiles{ display:grid; grid-template-columns:repeat(8, minmax(0, 1fr)); gap:12px; width:100%; max-width:1180px; }
.htile{ --a:#e8335a; --b:#a8173f; position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  min-height:108px; padding:10px 6px 8px; border:5px solid var(--ink); border-radius:0; text-decoration:none; color:#fff;
  font-weight:900; font-size:clamp(.78rem, 1.3vw, 1rem); line-height:1.15;
  text-shadow:2px 2px 0 rgba(42,34,51,.55); background:var(--a);
  box-shadow:inset -5px -5px 0 var(--b), inset 5px 5px 0 rgba(255,255,255,.28), 5px 5px 0 var(--ink);
  transition:transform .08s, box-shadow .08s; }
.htile::before{ display:none; }
.htile img.ht-ico{ width:46px; height:46px; image-rendering:pixelated; filter:drop-shadow(2px 2px 0 rgba(42,34,51,.45)); position:relative; }
.htile span{ position:relative; }
.htile:hover, .htile:focus-visible{ transform:translate(-2px,-2px); }
.htile:active{ transform:translate(2px,2px); box-shadow:inset -3px -3px 0 var(--b), 2px 2px 0 var(--ink); }
.htile:focus-visible{ outline:4px solid #fff; outline-offset:3px; }
.t-how{ --a:#2f9be0; --b:#1f6fb3; } .t-mud{ --a:#8e4fd9; --b:#6230a8; } .t-skill{ --a:#f5b81f; --b:#c4860c; }
.t-score{ --a:#f58a2b; --b:#c25f12; } .t-real{ --a:#ff5fa2; --b:#c73577; } .t-teach{ --a:#2fc79a; --b:#1a8a66; }
.t-rate{ --a:#ffc21f; --b:#d18f00; } .t-clips{ --a:#ef5350; --b:#b3261e; }

.ts-note{ margin:2px 0 0; color:#fff; text-shadow:1px 1px 0 rgba(42,34,51,.6); font-size:.85rem !important; max-width:44em;
  background:rgba(42,34,51,.55); border:3px solid #120e1f; border-radius:0; padding:6px 14px; }
.hero-read-wrap{ margin:0; }
.ts .hero-read{ margin:0; background:transparent !important; border:0 !important; box-shadow:none !important; color:#fff !important;
  text-shadow:1px 1px 0 rgba(42,34,51,.6); font-size:.9rem; font-weight:800; text-decoration:underline; text-underline-offset:3px;
  padding:.2em .4em; overflow:visible; border-radius:0 !important; }
.ts .hero-read::after{ display:none !important; }
.ts .hero-read:hover, .ts .hero-read:focus-visible{ transform:none; background:rgba(255,255,255,.15) !important; border-radius:0 !important; }

@media (max-width:979px){
  .home-tiles{ grid-template-columns:repeat(4, minmax(0, 1fr)); max-width:680px; }
  .ts-inner{ max-width:720px; }
}
@media (max-width:560px){
  .ts{ justify-content:flex-start; padding-top:max(14px, env(safe-area-inset-top)); }
  .ts-inner{ gap:12px; }
  .ts .brand-logo.ts-logo{ width:min(100%, 94vw); }
  .home-tiles{ gap:8px; }
  .htile{ min-height:76px; border-width:3px; padding:8px 2px 6px; font-size:.72rem; }
  .htile img.ht-ico{ width:34px; height:34px; }
  .ts .play-btn.mega{ font-size:clamp(1.7rem, 9vw, 2.3rem); padding:.25em 1em; }
}
@media (max-width:360px){
  .home-tiles{ grid-template-columns:repeat(4, minmax(0, 1fr)); gap:6px; }
  .htile{ font-size:.64rem; }
}

/* short landscape phones: logo + PLAY on the left, tiles on the right */
@media (orientation:landscape) and (max-height:540px){
  .ts{ justify-content:center; padding:6px 12px 8px; min-height:100svh; }
  .ts-inner{ gap:8px 14px; flex-direction:row; flex-wrap:nowrap; justify-content:center; align-items:center; }
  .ts-head{ width:auto; flex:0 1 46%; gap:8px; }
  .home-tiles{ flex:0 1 50%; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:6px; max-width:none; }
  .ts .brand-logo.ts-logo{ width:min(320px, 46vw); }
  .ts .play-btn.mega{ font-size:1.45rem; padding:.16em .85em .18em; border-width:4px !important; box-shadow:inset -4px -4px 0 #14895f, inset 4px 4px 0 #8ff3d0, 4px 4px 0 var(--ink) !important; }
  .htile{ min-height:58px; border-width:3px; font-size:.64rem; padding:5px 2px; }
  .htile img.ht-ico{ width:24px; height:24px; }
  .ts-note, .hero-read-wrap{ display:none; }
}

/* loading intro (once a session, skippable) */
.intro{ position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; background:linear-gradient(180deg, #3b1d78, #ff7eb6); transition:opacity .35s; }
.intro[hidden]{ display:none; } .intro.out{ opacity:0; pointer-events:none; }
.intro-box{ width:min(440px, 86vw); text-align:center; }
.intro-logo{ width:100%; height:auto; image-rendering:pixelated; }
.intro-bar{ height:24px; margin:18px 0 8px; border:4px solid var(--ink); border-radius:0; background:#fff; overflow:hidden; box-shadow:4px 4px 0 var(--ink); }
.intro-fill{ display:block; height:100%; width:0; background:repeating-linear-gradient(45deg, #ff5fa2 0 14px, #ffd6ec 14px 28px); border-radius:0; animation:fill 1.5s ease-out forwards; }
@keyframes fill{ to{ width:100%; } }
.intro-tip{ color:#fff; font-weight:bold; text-shadow:2px 2px 0 rgba(42,34,51,.5); margin:4px 0 12px; }
.intro-skip{ font:inherit; font-weight:bold; background:#fff; color:var(--ink); border:3px solid var(--ink); border-radius:0; padding:4px 16px; box-shadow:3px 3px 0 var(--ink); cursor:pointer; }

/* Muddles page cards stay square and paper-like */
body[data-page="muddles"] .muddle{ border-radius:0; background:#fff; transition:transform .08s; }
body[data-page="muddles"] .muddle:hover{ transform:translate(-2px,-2px); }
body[data-page="muddles"] main, body[data-page="muddles"] .mini-hero, body[data-page="muddles"] footer{ position:relative; z-index:1; }

@media (prefers-reduced-motion: reduce){
  .ts-logo .bl-wrap, .intro-logo, .intro-fill, .ts-logo .bl-wrap::before{ animation:none !important; }
  .ts-logo .bl-wrap::before{ opacity:.8; }
  .intro-fill{ width:100%; }
  .htile:hover, .htile:focus-visible, .ts .play-btn.mega:hover, .ts .play-btn.mega:active{ transform:none; }
  body[data-page="muddles"] .muddle:hover{ transform:none; }
}

/* ---- Inner pages: same starry sky, square pixel panels, Home + Play ---- */
body[data-page]:not([data-page="home"]):not([data-page="journal"]){
  background:
    radial-gradient(#ffffff 1px, transparent 1.2px),
    radial-gradient(#fff6b0 1.2px, transparent 1.4px),
    radial-gradient(ellipse at 50% 0, rgba(255,255,255,.28) 0, rgba(255,255,255,0) 42%),
    linear-gradient(180deg, #3b1d78 0%, #7a3dc4 36%, #ff7eb6 78%, #ffd6ec 100%) fixed !important;
  background-size:28px 28px, 52px 52px, auto, auto; background-position:0 0, 16px 10px, 0 0, 0 0;
}
body[data-page]:not([data-page="home"]) .mini-hero,
body[data-page]:not([data-page="home"]) .jump,
body[data-page]:not([data-page="home"]) main,
body[data-page]:not([data-page="home"]) footer,
body[data-page]:not([data-page="home"]) .bar{ position:relative; z-index:1; }
body[data-page]:not([data-page="home"]) .topnav{ z-index:60; }

body[data-page] .mini-hero{
  background:transparent; border-bottom:0; flex-direction:column; gap:10px; padding:18px 16px 22px; text-align:center;
}
body[data-page] .mini-hero .tag{
  margin:0; font-weight:900; font-size:clamp(1.5rem, 4vw, 2.4rem); letter-spacing:.03em;
  color:#fff6c8; -webkit-text-fill-color:#fff6c8;
  -webkit-text-stroke:.06em var(--ink); paint-order:stroke fill;
  background-image:none !important; background-clip:border-box !important; -webkit-background-clip:border-box !important;
  text-shadow:0 3px 0 var(--ink);
}
body[data-page] .mh-cta{ display:flex; flex-wrap:wrap; justify-content:center; gap:12px; margin:0; }
.home-btn, body[data-page] .home-btn{
  display:inline-flex; align-items:center; justify-content:center; font:inherit; font-weight:900; font-size:1.15rem;
  letter-spacing:.03em; text-decoration:none; color:var(--ink);
  padding:.35em 1.15em; border-radius:0; border:4px solid var(--ink);
  background:#ffd23f;
  box-shadow:inset -4px -4px 0 #c4860c, inset 4px 4px 0 #fff6c8, 4px 4px 0 var(--ink);
  text-shadow:none;
}
.home-btn:hover, body[data-page] .home-btn:hover{ transform:translate(-2px,-2px); }
.home-btn:active, body[data-page] .home-btn:active{ transform:translate(2px,2px); box-shadow:inset -2px -2px 0 #c4860c, 2px 2px 0 var(--ink); }

body[data-page] .card,
body[data-page="home"] .card,
body[data-page="home"] .muddle,
body[data-page="home"] .hero-text{
  border-radius:0 !important;
  background:var(--paper);
  box-shadow:8px 8px 0 rgba(42,34,51,.85);
}
body[data-page="home"] main > .card::before{ display:none; }
body[data-page] .play-btn, body[data-page] .more-btn, body[data-page] .read-btn,
body[data-page] .rv-form button[type=submit]{
  border-radius:0 !important;
  background:var(--blue);
  box-shadow:inset -4px -4px 0 #2462b0, inset 4px 4px 0 #7fd0ff, 4px 4px 0 var(--ink);
}
body[data-page] .play-btn, body[data-page]:not([data-page="home"]) .play-btn{
  background:#2fc79a;
  box-shadow:inset -4px -4px 0 #14895f, inset 4px 4px 0 #8ff3d0, 4px 4px 0 var(--ink);
}
body[data-page] .play-btn::after, body[data-page] .more-btn::after{ display:none !important; }
body[data-page] .what-muddle, body[data-page] .skill-ways li, body[data-page] .skill-chips li,
body[data-page] .rl-grid li, body[data-page] .vstep, body[data-page] .inside li, body[data-page] .steps3 .step{
  border-radius:0 !important;
}
body[data-page] .num, body[data-page] .clip-btn{ border-radius:0 !important; }

@media (prefers-reduced-motion: reduce){
  .home-btn:hover, body[data-page] .home-btn:hover{ transform:none; }
}
@media print{
  body[data-page]{ background:#fff !important; }
  body[data-page]::before, #candy-sky{ display:none !important; }
}
