/* Self-hosted Fredoka (latin + latin-ext, variable 400-700). No Google Fonts. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* DeusAma Learning - styles */
:root {
  --ink: #3b2b5a;
  --ink-soft: #6f6390;
  --purple: #8f7bff;
  --purple-d: #6a55e0;
  --pink: #ff7eb6;
  --pink-d: #e0579a;
  --mint: #5fd4a8;
  --mint-d: #36ad82;
  --sunny: #ffd166;
  --sky: #8fd0ff;
  --card: #ffffff;
  --radius: 26px;
  --shadow: 0 10px 30px rgba(90, 60, 160, .16);
  font-family: 'Fredoka', 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(180deg, #bfe6ff 0%, #e6dcff 55%, #ffe3f1 100%) fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
p { margin: .3em 0 .8em; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }
[hidden] { display: none !important; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }
.ico.flip { transform: scaleX(-1); }

/* ---------- sky + clouds ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; width: 180px; height: 60px; background: #fff; border-radius: 60px; opacity: .7; animation: drift 60s linear infinite; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 80px; height: 80px; left: 25px; top: -40px; }
.cloud::after { width: 60px; height: 60px; left: 90px; top: -28px; }
.c1 { top: 8%; left: -200px; }
.c2 { top: 30%; left: -200px; animation-delay: -25s; transform: scale(.7); animation-duration: 80s; }
.c3 { top: 70%; left: -200px; animation-delay: -45s; transform: scale(.85); animation-duration: 70s; }
@keyframes drift { to { left: 110%; } }

/* ---------- layout ---------- */
#app { max-width: 1180px; margin: 0 auto; padding: 14px clamp(10px, 2.5vw, 26px) 40px; }
.has-demo #app { padding-top: 44px; }
.demo-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center;
  background: repeating-linear-gradient(135deg, #ffd166 0 18px, #ffc84a 18px 36px);
  color: #5a3d00; font-weight: 600; font-size: .9rem; padding: 6px 10px; letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 600; color: inherit; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2.4vw, 26px); margin-bottom: 18px; }
.center-card { max-width: 720px; margin: 20px auto; text-align: center; }
.big-title { text-align: center; margin: 12px 0 20px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 0; border-radius: 18px; padding: .7em 1.2em; font-weight: 600; font-size: 1.05rem;
  background: #efeaff; color: var(--ink); box-shadow: 0 5px 0 #d6ccf7; transition: transform .08s, box-shadow .08s, filter .15s;
  min-height: 48px; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #d6ccf7; }
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-go { background: linear-gradient(180deg, #a08fff, var(--purple)); color: #fff; box-shadow: 0 5px 0 var(--purple-d); }
.btn-go:active:not(:disabled) { box-shadow: 0 1px 0 var(--purple-d); }
.btn-soft { background: #fff; box-shadow: 0 5px 0 #ddd3fa, 0 0 0 2px #ebe5ff inset; }
.btn-danger { background: #fff0f3; color: #c2335d; box-shadow: 0 5px 0 #f5c2d0; }
.btn-wide { width: 100%; }
.btn-big { font-size: 1.3rem; padding: .8em 1.4em; }
.btn-icon { width: 48px; padding: 0; background: #fff; box-shadow: 0 4px 0 #ddd3fa; }
.btn:focus-visible, .tab:focus-visible, .area:focus-visible, .key:focus-visible { outline: 4px solid #ffd166; outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-height: 56px; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; flex: 1; }
.tb-right { justify-content: flex-end; flex-wrap: wrap; }
.tb-title { font-weight: 700; font-size: 1.3rem; text-align: center; white-space: nowrap; }
.brand { font-weight: 700; font-size: 1.6rem; background: linear-gradient(90deg, #ff7eb6, #8f7bff, #4fb6f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 1.1rem; box-shadow: 0 3px 0 #ddd3fa; }
.btn-player { padding: 4px 14px 4px 4px; min-height: 48px; background: #fff; box-shadow: 0 4px 0 #ddd3fa; border-radius: 999px; }
.btn-player .mini { width: 40px; height: 40px; border-radius: 50%; background: #f1ecff; display: grid; place-items: center; overflow: hidden; }
.btn-player .mini svg { width: 40px; height: 40px; }

/* ---------- welcome ---------- */
.welcome { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; align-items: center; min-height: 80vh; }
.welcome-top { display: flex; justify-content: flex-start; margin: 0 0 4px; }  /* sign-in page: About Us button, top-left */
.welcome-top + .welcome { min-height: calc(80vh - 64px); }
.about-btn { font-size: 1.15rem; min-height: 56px; padding: .7em 1.3em; }
.welcome-foot { grid-column: 1 / -1; text-align: center; margin: 0; }  /* sign-in footer: Privacy / DMCA (grown-up screens only) */
.welcome-foot a { color: var(--purple-d); font-weight: 600; }
.welcome-foot .sep { margin: 0 .55em; color: var(--ink-soft); font-weight: 500; }
.hero { text-align: center; }
.hero-pets { display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.hero-pets svg { width: min(30%, 190px); height: auto; }
.logo { font-size: clamp(3rem, 8vw, 5rem); margin: 10px 0 0; background: linear-gradient(90deg, #ff7eb6, #8f7bff 55%, #4fb6f0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 rgba(255,255,255,.9)); }
.tagline { font-size: 1.35rem; font-weight: 500; color: var(--ink-soft); }
.auth-card { max-width: 460px; width: 100%; justify-self: center; }
.tabs { display: flex; gap: 6px; background: #f3efff; border-radius: 18px; padding: 5px; margin-bottom: 16px; }
.tab { flex: 1; border: 0; background: none; padding: 10px; border-radius: 14px; font-weight: 600; color: var(--ink-soft); min-height: 44px; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 3px 10px rgba(90,60,160,.12); }
.form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.form.narrow { max-width: 380px; margin: 0 auto; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
.form label small { font-weight: 400; color: var(--ink-soft); }
.form input, .inline-form input {
  border: 3px solid #e3dcfb; border-radius: 16px; padding: 12px 14px; font-size: 1.1rem; background: #fcfbff; outline: none; min-height: 50px;
}
.form input:focus { border-color: var(--purple); background: #fff; }
.form-msg { min-height: 1.2em; margin: 0; font-weight: 500; }
.form-msg.err { color: #c2335d; }
.form-msg.ok { color: var(--mint-d); }
.demo-try { margin-top: 18px; padding-top: 16px; border-top: 2px dashed #ebe5ff; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: center; text-align: center; }
.invite-row { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.code-input { font-size: 1.4rem !important; letter-spacing: .12em; text-transform: uppercase; text-align: center; font-weight: 600; }
.demo-try small { width: 100%; color: var(--ink-soft); }

/* ---------- profiles ---------- */
.profile-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.profile-card {
  width: 210px; border: 0; background: #fff; border-radius: 30px; padding: 18px; box-shadow: var(--shadow), 0 7px 0 #e3dcfb;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s;
}
.profile-card:hover { transform: translateY(-4px) rotate(-1deg); }
.profile-card .avatar { width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff 0, #efe8ff 70%); display: grid; place-items: center; }
.profile-card .avatar svg { width: 130px; height: 130px; }
.pc-name { font-size: 1.5rem; font-weight: 700; }
.pc-stars { display: flex; align-items: center; gap: 4px; color: var(--ink-soft); font-weight: 600; }

/* ---------- PIN ---------- */
.pin-screen { display: grid; place-items: center; min-height: 75vh; }
.pin-card { position: relative; text-align: center; width: min(420px, 100%); }
.pin-x { position: absolute; left: 14px; top: 14px; }
.pin-avatar svg { width: 120px; height: 120px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 10px 0 4px; }
.pin-dots i { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #cfc4ea; transition: background .1s, transform .1s; }
.pin-dots i.on { background: var(--purple); border-color: var(--purple); transform: scale(1.1); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ---------- number pad ---------- */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 330px; margin: 10px auto; }
.key {
  border: 0; border-radius: 20px; background: #fff; font-size: 1.8rem; font-weight: 600; min-height: 64px;
  box-shadow: 0 5px 0 #ddd3fa, 0 0 0 2px #efeaff inset; transition: transform .06s, box-shadow .06s;
}
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 #ddd3fa; }
.key-del { background: #fff4f7; }
.key-ok { background: linear-gradient(180deg, #7fe6bf, var(--mint)); color: #fff; box-shadow: 0 5px 0 var(--mint-d); }
.pinpad { margin-bottom: 14px; }

/* ---------- hatching ---------- */
.hatch h1 { margin-top: 6px; }
.egg-row { display: flex; justify-content: center; gap: clamp(10px, 3vw, 30px); flex-wrap: wrap; margin: 20px 0; }
.egg-pick { border: 0; background: radial-gradient(circle, #fff 0 55%, transparent 70%); border-radius: 50%; padding: 10px; transition: transform .15s; }
.egg-pick:hover { transform: scale(1.06); }
.egg-pick svg { width: clamp(110px, 18vw, 170px); height: auto; }
.egg-big { border: 0; background: none; padding: 0; display: block; margin: 10px auto; }
.egg-big svg { width: clamp(200px, 32vw, 280px); height: auto; }
.wobble-slow { animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.shake-egg { animation: eggshake .35s; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes eggshake { 20% { transform: rotate(-10deg); } 50% { transform: rotate(9deg); } 80% { transform: rotate(-5deg); } }
.burst { animation: burst .55s forwards; }
@keyframes burst { to { transform: scale(1.35); opacity: 0; filter: brightness(2); } }
.pop-in { animation: popin .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes popin { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hatch-pet svg, .modal-pet svg { width: 180px; height: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { border: 0; background: #f3efff; border-radius: 999px; padding: 8px 14px; font-weight: 600; min-height: 40px; }
.chip-btn:hover { background: #e6deff; }

/* ---------- creature animation ---------- */
.creature .c-bob { animation: bob 2.6s ease-in-out infinite; transform-origin: 100px 188px; }
.creature .c-eyes { animation: blink 4.5s infinite; transform-origin: 100px 110px; transform-box: view-box; }
.creature .c-tail { animation: tail 1.8s ease-in-out infinite; transform-origin: 152px 160px; }
.creature .c-wings { animation: flap 1.4s ease-in-out infinite; transform-origin: 100px 110px; }
.mood-happy .c-bob { animation: hop .6s ease-in-out infinite; }
.mood-eat .c-bob { animation: munch .25s ease-in-out infinite; }
.bob1 .c-bob { animation-delay: -.8s; } .bob3 .c-bob { animation-delay: -1.6s; }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-5px) scale(1.02, .98); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px); } }
@keyframes munch { 50% { transform: scale(1.04, .95); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes tail { 50% { transform: rotate(10deg); } }
@keyframes flap { 50% { transform: scaleX(1.06) translateY(-2px); } }

/* ---------- home ---------- */
.home { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start; }
.pet-card { text-align: center; background: linear-gradient(180deg, #fff 0, #fff 60%, #f7f2ff 100%); }
.pet-head { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pet-head h2 { margin: 0; font-size: 1.8rem; }
.stage-tag { background: #ffe8f3; color: var(--pink-d); border-radius: 999px; padding: 3px 12px; font-weight: 600; }
.pet-stage { border: 0; background: radial-gradient(ellipse 42% 9% at 50% 93%, #d8f3df 0 96%, transparent 100%), radial-gradient(circle at 50% 50%, #fff4cc 0, rgba(255,244,204,0) 62%); padding: 0; width: 100%; display: block; border-radius: 24px; }
.pet-stage svg { width: min(100%, 290px); height: auto; }
.jump { animation: jumpup .5s; }
@keyframes jumpup { 40% { transform: translateY(-14px) scale(1.04); } }
.grow p { margin: 6px 0 12px; color: var(--ink-soft); }
.bar { height: 18px; background: #efeaff; border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(90,60,160,.12); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9ec7, #ffb86b, #ffd166); border-radius: 999px; transition: width .5s cubic-bezier(.3, 1.4, .5, 1); min-width: 18px; }
.pet-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.map-card { padding: 16px; }
.map-card h2 { margin: 4px 8px 12px; }
.map { position: relative; aspect-ratio: 1000 / 640; border-radius: 22px; overflow: hidden; }
.map-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.area {
  position: absolute; transform: translate(-50%, -50%); border: 0; background: rgba(255,255,255,.9); border-radius: 22px;
  padding: 6px 10px 8px; width: clamp(110px, 17%, 160px); display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 6px 0 rgba(90,60,160,.18), 0 8px 20px rgba(90,60,160,.18); transition: transform .15s;
}
.area-art svg { width: 100%; height: auto; max-height: 90px; display: block; }
.area-art { width: 100%; }
.area-name { font-weight: 700; font-size: clamp(.85rem, 1.5vw, 1.05rem); white-space: nowrap; }
.area-sub { font-size: .78rem; color: var(--ink-soft); white-space: nowrap; }
.area.open { animation: glow 2.4s ease-in-out infinite; }
.area.open:hover { transform: translate(-50%, -54%) scale(1.05); }
.area.open .area-sub { color: var(--purple-d); font-weight: 600; }
.area.soon { filter: saturate(.35); opacity: .85; }
.area.soon .area-sub { background: #efeaff; border-radius: 999px; padding: 0 8px; }
@keyframes glow { 0%, 100% { box-shadow: 0 6px 0 rgba(90,60,160,.18), 0 0 0 0 rgba(255,209,102,.0); } 50% { box-shadow: 0 6px 0 rgba(90,60,160,.18), 0 0 0 8px rgba(255,209,102,.6); } }

/* ---------- closet ---------- */
.closet { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.closet-preview { text-align: center; position: sticky; top: 50px; }
.closet-preview svg { width: 100%; max-width: 260px; height: auto; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 18px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch, .acc-item { position: relative; border: 3px solid transparent; background: #f7f4ff; border-radius: 20px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; }
.swatch.on, .acc-item.on { border-color: var(--purple); background: #fff; box-shadow: 0 4px 12px rgba(143,123,255,.3); }
.swatch .dot { width: 50px; height: 50px; border-radius: 50%; box-shadow: inset 0 -4px 0 rgba(0,0,0,.1); }
.acc-pic svg { width: 90px; height: 90px; }
.locked { opacity: .6; }
.locked .dot, .locked .acc-pic { filter: grayscale(.8); }
.need { position: absolute; top: 6px; right: 6px; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 7px; font-size: .78rem; display: flex; align-items: center; gap: 2px; }
.need .ico { width: 1em; height: 1em; }
.sw-name { font-size: .9rem; }

/* ---------- area pages ---------- */
.area-hero { display: flex; align-items: center; gap: 18px; }
.ah-art { width: 140px; flex: none; }
.ah-art svg { width: 100%; }
.woods-hero { background: linear-gradient(120deg, #e4fbe9, #fff 70%); }
.caves-hero { background: linear-gradient(120deg, #ece6ff, #fff 70%); }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.list-card { margin: 0; }
.word-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.wchip { border-radius: 999px; padding: 3px 11px; font-weight: 500; font-size: .95rem; background: #f1eeff; }
.wchip.new { background: #f1eeff; color: var(--ink-soft); }
.wchip.learning { background: #fff2cc; color: #8a6200; }
.wchip.tricky { background: #ffe1ea; color: #b1305a; }
.wchip.known { background: #d9f7ea; color: #1f7a57; }
.legend { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.list-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.op-card { border: 0; border-radius: 26px; padding: 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; box-shadow: 0 7px 0 rgba(0,0,0,.14), var(--shadow); transition: transform .15s; }
.op-card:hover { transform: translateY(-4px); }
.op-card:active { transform: translateY(3px); }
.op-sign { font-size: 3.4rem; font-weight: 700; line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,.12); }
.op-name { font-size: 1.3rem; font-weight: 700; }
.op-level { background: rgba(255,255,255,.3); border-radius: 999px; padding: 2px 12px; font-weight: 600; }
.op-pink { background: linear-gradient(160deg, #ff9ec7, #ff6fa8); }
.op-sky { background: linear-gradient(160deg, #8fd0ff, #4fa8f0); }
.op-sunny { background: linear-gradient(160deg, #ffd166, #ffab3d); }
.op-mint { background: linear-gradient(160deg, #7fe6bf, #3fbf8f); }
.op-lavender { background: linear-gradient(160deg, #c4a8ff, #8f6bff); }

/* ---------- game cards ---------- */
.game-card { max-width: 760px; margin: 0 auto; text-align: center; background-color: #fff; }
.woods-card { background-image: radial-gradient(circle at 0 100%, #e4fbe9 0 120px, transparent 121px), radial-gradient(circle at 100% 0, #fff2cc 0 90px, transparent 91px); }
.cave-card { background-image: radial-gradient(circle at 100% 100%, #ece6ff 0 140px, transparent 141px), radial-gradient(circle at 0 0, #e3f4ff 0 90px, transparent 91px); }
.list-name { color: var(--ink-soft); font-weight: 600; margin-top: 10px; }
.listen-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.btn-sound { background: linear-gradient(180deg, #ffb3d3, var(--pink)); color: #fff; box-shadow: 0 6px 0 var(--pink-d); }
.btn-sound .ico { width: 1.6em; height: 1.6em; }
.meaning { color: var(--ink-soft); min-height: 1.4em; font-size: 1.05rem; }
.tiles { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 10px; margin: 8px 0; }
.tile { width: 44px; height: 54px; display: grid; place-items: center; border-radius: 12px; font-size: 1.7rem; font-weight: 700; animation: popin .35s both; }
.tile.ok { background: #d9f7ea; color: #1f7a57; box-shadow: 0 4px 0 #a6e6c9; }
.tile.fix { background: #fff2cc; color: #a36a00; box-shadow: 0 4px 0 #ffd98a; outline: 3px dashed #ffb84d; }
.spell-form { display: flex; gap: 10px; max-width: 540px; margin: 10px auto; }
.spell-input { flex: 1; min-width: 0; border: 4px solid #e3dcfb; border-radius: 20px; padding: 12px 18px; font-size: 1.8rem; text-align: center; letter-spacing: .06em; outline: none; background: #fcfbff; }
.spell-input:focus { border-color: var(--purple); background: #fff; }
.feedback { font-size: 1.25rem; font-weight: 600; min-height: 2.4em; margin-top: 10px; text-align: center; }
.feedback small { display: block; font-size: .95rem; font-weight: 500; color: var(--ink-soft); margin-top: 4px; }
.feedback.good { color: var(--mint-d); animation: popin .3s; }
.feedback.try { color: #d0781f; }
.feedback.show { color: var(--purple-d); }
.prompt { font-size: 1.2rem; margin-top: 12px; }
.meaning-card { display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff8e1; border-radius: 22px; padding: 18px; font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 600; margin: 6px auto 16px; max-width: 600px; box-shadow: 0 5px 0 #ffe29a; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; margin: 0 auto; }
.choice { font-size: 1.5rem; min-height: 70px; background: #fff; box-shadow: 0 6px 0 #ddd3fa, 0 0 0 3px #ebe5ff inset; }
.choice.right { background: #d9f7ea; box-shadow: 0 6px 0 #8fdcb9; animation: jumpup .5s; }
.choice.nope { animation: shake .4s; }

.dots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 10px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; background: #efeaff; transition: all .2s; }
.dots i.now { background: #fff; box-shadow: 0 0 0 3px var(--purple); }
.dots i.good { background: var(--mint); }
.dots i.ok { background: var(--sunny); }
.level-tag { display: inline-block; background: #efeaff; color: var(--purple-d); border-radius: 999px; padding: 3px 14px; font-weight: 600; }
.problem { font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 700; margin: 12px 0 6px; font-variant-numeric: tabular-nums; }
.problem.pop { animation: popin .35s; }
.vertical { display: inline-block; text-align: right; line-height: 1.1; }
.vrow { display: flex; justify-content: space-between; gap: 18px; }
.vsign { color: var(--pink-d); }
.hsign { color: var(--pink-d); margin: 0 .15em; }
.vline { height: 6px; background: var(--ink); border-radius: 4px; margin-top: 4px; }
.answer { display: inline-block; min-width: 200px; font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 700; border-radius: 20px; background: #f7f4ff; border: 4px dashed #cfc4ea; padding: 4px 20px; font-variant-numeric: tabular-nums; }
.answer .placeholder { color: #cfc4ea; }
.vmath { display: inline-grid; grid-template-columns: auto 1fr; column-gap: .3em; justify-items: end; align-items: baseline; text-align: right; line-height: 1.1; font-variant-numeric: tabular-nums;
  width: calc((var(--vw, 3) + 1.5) * 1ch); padding: 0 24px; box-sizing: content-box; vertical-align: top; }
.vm-top { grid-column: 2; }
.vm-op { grid-column: 1; justify-self: start; color: var(--pink-d); }
.vm-line { grid-column: 1 / -1; justify-self: stretch; height: max(4px, .09em); background: var(--ink); border-radius: 4px; margin: .08em 0 .12em; }
.vm-ans { grid-column: 1 / -1; justify-self: end; }
.vm-q { display: inline-block; min-width: 1.4em; padding: 0 .2em; border: 3px dashed #cfc4ea; border-radius: 12px; background: #f7f4ff; color: #b7a9e0; text-align: center; }
.vm-q.done { color: var(--ink); border-style: solid; border-color: #5fd4a8; background: #e9fbf3; }
/* lesson: the answer box lines up under the stacked numbers (same font, same width, digits right-aligned) */
.cave-card.v-mode .problem { margin-bottom: 0; }
.cave-card.v-mode .answer { font-size: clamp(2.6rem, 7vw, 4rem); min-width: 0; width: calc((var(--vw, 3) + 1.5) * 1ch); box-sizing: content-box; text-align: right; padding: 0 20px; line-height: 1.15; }
/* boss fight: a stacked problem with a ? box under the line */
.boss-q.v-mode .boss-q-text { font-size: clamp(1.9rem, 4.2vw, 2.6rem); margin: 0 0 8px; }
.boss-q.v-mode .vmath { padding: 0 12px; }
/* Timed Challenge: the typed answer lines up under the stacked numbers */
.timed-run.v-mode .t-q { margin: 10px 0 0; }
.timed-run.v-mode .t-ans { font-size: clamp(2.2rem, 7vw, 3.4rem); max-width: none; width: calc((var(--vw, 3) + 1.5) * 1ch); padding: 0 24px; box-sizing: content-box; text-align: right; line-height: 1.15; border-bottom-color: transparent; }
.wiggle { animation: shake .4s; }
.btn-next { margin-top: 10px; font-size: 1.3rem; }

/* ---------- reward ---------- */
.reward-pet svg { width: 200px; height: auto; }
.reward .big { font-size: 1.3rem; }
.reward-stars { display: flex; justify-content: center; gap: 12px; margin: 10px 0; }
.rstar { display: inline-block; animation: starpop .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.rstar .ico { width: 84px; height: 84px; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }
.reward-treats { font-size: 1.3rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.reward-treats .ico { width: 1.6em; height: 1.6em; }
.reward-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- parent ---------- */
.parent-bar .tb-title { font-size: 1.4rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.stat-k { color: var(--ink-soft); font-weight: 500; }
.stat-v { font-size: 1.6rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stat-v.small-v { font-size: 1.15rem; }
.table-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 1rem; }
.ptable th { text-align: left; color: var(--ink-soft); font-weight: 600; padding: 8px; border-bottom: 2px solid #efeaff; }
.ptable td { padding: 9px 8px; border-bottom: 1px solid #f3f0ff; vertical-align: top; }
.ptable small { color: var(--ink-soft); }
.ptable tr.dim td { color: #aaa1c4; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid #f3f0ff; }
.activity li span:first-child { font-weight: 600; }
.manage { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.inline-form { background: #faf8ff; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.inline-form h3 { font-size: 1.05rem; margin: 0; }
.danger-row { display: flex; gap: 10px; flex-wrap: wrap; }
.kid-tabs { max-width: 520px; margin: 0 auto 10px; }

/* ---------- modal / toast / fx ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(59, 43, 90, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .2s; }
.modal { background: #fff; border-radius: 30px; padding: 26px; max-width: 440px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(59,43,90,.35); animation: popin .35s cubic-bezier(.3, 1.5, .5, 1); }
.modal-btns { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.modal-art svg { width: 150px; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 600; z-index: 120; animation: popin .3s; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.toast.out { opacity: 0; transition: opacity .4s; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 110; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: fall 2s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); } }
.float-text { position: fixed; transform: translate(-50%, 0); font-size: 1.6rem; font-weight: 700; color: var(--pink-d); animation: floatup 1.3s ease-out forwards; display: flex; align-items: center; gap: 4px; text-shadow: 0 2px 0 #fff; }
.float-text .ico { width: 1.2em; height: 1.2em; }
.heart { color: #ff5c8a; }
@keyframes floatup { to { transform: translate(-50%, -80px); opacity: 0; } }

/* ---------- loading ---------- */
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--ink-soft); }
.loading-egg { width: 70px; height: 90px; background: #fff; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; border: 5px solid #ffa6d2; animation: wobble 1s ease-in-out infinite; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .home { grid-template-columns: 1fr; }
  .pet-card { display: grid; grid-template-columns: 200px 1fr; grid-template-areas: "stage head" "stage grow" "stage actions"; align-items: center; text-align: left; gap: 0 16px; }
  .pet-head { grid-area: head; justify-content: flex-start; }
  .pet-stage { grid-area: stage; }
  #grow { grid-area: grow; }
  .pet-actions { grid-area: actions; justify-content: flex-start; }
  .closet { grid-template-columns: 1fr; }
  .closet-preview { position: static; }
  .closet-preview svg { max-width: 180px; }
}
@media (max-width: 760px) {
  .welcome { grid-template-columns: 1fr; min-height: 0; gap: 10px; }
  .two-col { grid-template-columns: 1fr; }
  .tb-title { display: none; }
  .pname { display: none; }
  .btn-player { padding: 4px; }
}
@media (max-width: 560px) {
  .pet-card { grid-template-columns: 1fr; grid-template-areas: "head" "stage" "grow" "actions"; text-align: center; }
  .pet-head, .pet-actions { justify-content: center; }
  .map { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: #bfeaff; padding: 10px; }
  .map-bg { display: none; }
  .area { position: static; transform: none; width: auto; }
  .area.open:hover { transform: none; }
  .choices { grid-template-columns: 1fr; }
  .spell-form { flex-direction: column; }
  .area-hero { flex-direction: column; text-align: center; }
  .chip { padding: 5px 9px; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- creature collection + eggs from sections ---------- */
.credit { font-size: .85rem; color: var(--ink-soft); font-style: italic; margin: 2px 0 6px; }
.egg-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: linear-gradient(90deg, #fff7d6, #fff); }
.egg-banner h2 { margin: 0; }
.egg-banner .eb-egg svg { width: 70px; height: auto; }
.egg-banner .btn { margin-left: auto; }
.coll-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.coll-card { text-align: center; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 4px solid transparent; }
.coll-card h2 { margin: 2px 0 0; }
.coll-card p { margin: 0; }
.coll-card .btn { margin-top: auto; }
.coll-card.is-active { border-color: var(--sunny); background: linear-gradient(180deg, #fffbe8, #fff); }
.coll-art svg { width: 150px; height: auto; }
.coll-card.mystery .coll-art svg { filter: grayscale(1) opacity(.45); }
.active-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding: 6px 14px; border-radius: 99px; background: #fff1bf; font-weight: 600; }
.section-prog { margin: 6px 0 10px; font-size: .95rem; }
.section-prog .bar { margin: 4px 0; }
.section-prog.done { color: var(--mint-d); }
.locked-list { opacity: .75; filter: grayscale(.4); }
.section-done, .lesson-find { background: linear-gradient(180deg, #fff7d6, #fff); border-radius: 20px; padding: 12px; margin-bottom: 10px; }
.section-done .sd-egg svg, .lesson-find .sd-egg svg { width: 110px; height: auto; }
.catchup-eggs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.catchup-eggs .sd-egg svg { width: 84px; height: auto; }
.dot-pic { background-size: 160% !important; background-position: 50% 70% !important; background-repeat: no-repeat !important; background-color: #f4f0ff !important; }

/* ---------- vocabulary sections ---------- */
.woods-sub { margin: 18px 4px 4px; }
.woods-sub-p { margin: 0 4px 12px; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 10px; }
.sec-card { margin: 0; }
.sec-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec-card.locked { opacity: .7; filter: grayscale(.5); }
.sec-card.finished { border: 3px solid #bdeed8; }
.fin-tag { font-size: .85rem; background: #e3fbf2; color: var(--mint-d); padding: 2px 10px; border-radius: 99px; }
.subj-line { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.subject-chip { font-size: .8rem; background: #efeaff; color: var(--ink-soft); padding: 2px 10px; border-radius: 99px; font-weight: 600; }
.dbg-btn { margin-top: 8px; font-size: .85rem; }
.debug-note { background: #fff1f1; border: 2px dashed #ff8a8a; border-radius: 14px; padding: 8px 12px; }
.debug-badge { font-size: .7rem; background: #ff6b6b; color: #fff; padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.pick-word { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pick-word h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
.meaning-choices { grid-template-columns: 1fr 1fr; max-width: 780px; }
.mchoice { text-align: left; font-size: 1.02rem; line-height: 1.3; white-space: normal; min-height: 64px; }
.reveal { background: #f7f2ff; border-radius: 18px; padding: 12px 16px; margin: 10px 0; text-align: left; }
.reveal h3 { margin: 0 0 4px; }
.m-general { display: block; }
.m-bible { display: block; margin-top: 6px; padding-top: 6px; border-top: 2px dotted #d9cff7; color: #6a4fb5; }
.meaning .m-bible { font-size: .95rem; }
@media (max-width: 560px) { .meaning-choices { grid-template-columns: 1fr; } }

/* ---------- nicknames + leaderboard (items 12 and 2) ---------- */
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 4px 12px; }
.map-head h2 { margin: 4px; }
.nick-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: linear-gradient(90deg, #efe8ff, #fff); }
.nick-banner h2 { margin: 0; }
.nick-banner .nb-ico .ico, .nick-trophy .ico, .board-trophy .ico { width: 56px; height: 56px; }
.nick-banner .nb-text { flex: 1 1 260px; }
.nick-banner .nb-btns { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.nick-pick { max-width: 620px; }
.nick-pick #nick { font-size: 1.4rem; text-align: center; font-weight: 700; letter-spacing: .02em; }
.nick-pick .chips { justify-content: center; }
.nick-name { color: #6a4bd6; }
.board { max-width: 760px; margin: 0 auto; }
.board-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.board-head h1 { margin: 0 0 4px; }
.board-head p { margin: 0 0 8px; }
.board-subj { margin-bottom: 12px; }
.chip-btn.on { background: #6a4bd6; color: #fff; }
.board-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.board-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: #f7f4ff; font-weight: 600; font-size: 1.1rem; }
.board-list li.mine { background: #eefaf5; }
.board-list li.me { background: #fff7d6; box-shadow: inset 0 0 0 2px #ffd166; }
.board-list .bn { flex: 1; overflow-wrap: anywhere; }
.board-list .bs { display: inline-flex; align-items: center; gap: 4px; }
.board-list .rank, .board-list .medal { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; background: #e6deff; color: #5a3fc0; flex: none; }
.board-list .medal.m1 { background: #ffd23f; color: #7a5200; }
.board-list .medal.m2 { background: #dfe6ee; color: #4a5866; }
.board-list .medal.m3 { background: #f3b58a; color: #6b3410; }
.you-tag { font-size: .75rem; background: #ffd166; color: #6b4b00; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.nick-card h2 { display: flex; align-items: center; gap: 8px; }
.nick-card .nick-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.nick-pending { background: #fff7d6; border-radius: 14px; padding: 10px 12px; }
.nick-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #ff6b8b; color: #fff; font-size: .8rem; margin-left: 4px; }
.pin-ask .pin-input { font-size: 1.4rem; text-align: center; letter-spacing: .4em; max-width: 180px; margin: 6px auto 12px; display: block; }

/* ---------- admin tools (Lance only) ---------- */
.admin-card { border: 2px dashed #c9b8ff; }
.admin-tag { display: inline-block; vertical-align: middle; margin-left: 6px; font-size: .75rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; background: #ede7ff; color: #5b3fc4; border-radius: 999px; padding: 2px 9px; }
.admin-card h3 { margin: 18px 0 8px; }
.admin-card { scroll-margin-top: 12px; }
.admin-jump { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border: 2px dashed #c9b8ff; padding: 12px 16px; margin-bottom: 16px; }
.admin-jump .small { display: block; margin-top: 2px; }
.admin-jump-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-small { padding: 5px 12px; font-size: .9rem; min-height: 0; }
.inv-new { background: #f4fff9; border: 2px solid #9fe3c4; border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.inv-new p { margin: 4px 0; }
.inv-code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-code { font-size: 1.5rem; font-weight: 700; letter-spacing: .08em; background: #fff; border-radius: 10px; padding: 6px 12px; user-select: all; }
.inv-table td, .nick-admin-table td, .removed-table td { vertical-align: middle; }
.form label.check-row { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form label.check-row input { min-height: 0; width: 22px; height: 22px; accent-color: var(--purple); }
/* PIN boxes (js/pin.js): masked without type=password so password managers ignore them */
.pin-input { -webkit-text-security: disc; text-security: disc; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.pin-input::placeholder { letter-spacing: normal; }
.pin-input.pin-js-mask { -webkit-text-security: none; }
.form + .pin-block { margin-top: 12px; }

/* ---------- Lesson Buddy (top of every lesson card, in the normal flow so it never covers the question or buttons) ---------- */
.buddy { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 92px; margin: -8px 0 16px; }
.buddy-pet { width: 90px; height: auto; flex: none; transform-origin: 50% 100%; }
.buddy-pet svg { width: 90px; height: auto; display: block; }
.buddy-say { margin: 0; background: #f3efff; border-radius: 18px; padding: 8px 14px; font-weight: 600; position: relative; max-width: 420px; text-align: left; transition: background .2s; }
.buddy-say::before { content: ''; position: absolute; left: -8px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-left: 0; border-right-color: #f3efff; transition: border-color .2s; }
.buddy[data-mood="cheer"] .buddy-say { background: #ddf7ea; } .buddy[data-mood="cheer"] .buddy-say::before { border-right-color: #ddf7ea; }
.buddy[data-mood="sad"] .buddy-say { background: #fff1dc; } .buddy[data-mood="sad"] .buddy-say::before { border-right-color: #fff1dc; }
.buddy-pet.cheer { animation: buddyHop .55s ease-out 2; }
.buddy-pet.sad { animation: buddyDroop 1.3s ease-in-out forwards; }
@keyframes buddyHop { 0%, 100% { transform: translateY(0) scale(1); } 35% { transform: translateY(-18px) scale(1.06, .96); } 60% { transform: translateY(0) scale(1.04, .94); } }
@keyframes buddyDroop { 0% { transform: none; } 25% { transform: translateY(5px) rotate(-6deg) scale(1, .96); } 50% { transform: translateY(5px) rotate(5deg) scale(1, .96); } 75% { transform: translateY(4px) rotate(-3deg) scale(1, .97); } 100% { transform: translateY(3px) scale(1, .98); } }
/* Wide screens (iPad landscape, desktop): the buddy sits in the empty space LEFT of the lesson card, so the card is
   no taller than before (the keypad and Next stay on screen on iPad landscape). */
@media (min-width: 1100px) {
  .game-card { position: relative; }
  .buddy { position: absolute; right: calc(100% + 14px); top: 18px; width: 150px; flex-direction: column; gap: 8px; margin: 0; min-height: 0; }
  .buddy-pet { width: 104px; height: auto; } .buddy-pet svg { width: 104px; }
  .buddy-say { text-align: center; max-width: 150px; }
  .buddy-say::before { left: 50%; top: -8px; margin: 0 0 0 -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: #f3efff; }
  .buddy[data-mood="cheer"] .buddy-say::before { border-right-color: transparent; border-bottom-color: #ddf7ea; }
  .buddy[data-mood="sad"] .buddy-say::before { border-right-color: transparent; border-bottom-color: #fff1dc; }
}
@media (max-width: 560px) { .buddy { min-height: 60px; } .buddy-pet, .buddy-pet svg { width: 56px; height: auto; } .buddy-say { font-size: .95rem; } }

/* ---------- Creature Home ---------- */
.habitat { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.room { position: relative; aspect-ratio: 16 / 11; border-radius: 22px; overflow: hidden; margin-bottom: 12px;
  background: linear-gradient(180deg, #ffe9c7 0, #ffe1f0 62%, #c98f5f 62%, #b97d4f 100%); }
.room::before { content: ''; position: absolute; left: 34%; right: 34%; top: 9%; height: 28%; border-radius: 14px 14px 4px 4px;
  background: linear-gradient(180deg, #bfe6ff, #e6f6ff); box-shadow: inset 0 0 0 6px #fff; } /* window */
.room::after { content: ''; position: absolute; left: 25%; right: 25%; bottom: 7%; height: 12%; border-radius: 50%; background: #ff9ec7; opacity: .55; } /* rug */
.slot { position: absolute; width: 21%; aspect-ratio: 1; border-radius: 18px; border: 3px dashed rgba(111,99,144,.35); background: rgba(255,255,255,.35); padding: 4px; display: grid; place-items: center; z-index: 2; }
.slot.filled { border-color: transparent; background: transparent; }
.slot.picking { border: 3px solid var(--sunny); background: rgba(255,209,102,.25); }
.slot svg { width: 100%; height: 100%; }
.slot-plus { font-size: 2rem; color: rgba(111,99,144,.6); font-weight: 700; }
.slot-wallL { left: 5%; top: 8%; } .slot-wallR { right: 5%; top: 8%; }
.slot-floorL { left: 4%; bottom: 5%; } .slot-floorR { right: 4%; bottom: 5%; }
.room-pet { position: absolute; left: 32%; bottom: 5%; width: 36%; border: 0; background: none; padding: 0; z-index: 3; transform-origin: 50% 100%; }
.room-pet svg { width: 100%; height: auto; display: block; }
.room-pet.r-bounce { animation: roomBounce .6s ease-out 2; }
.room-pet.r-wiggle { animation: roomWiggle .7s ease-in-out 2; }
.room-pet.r-eat { animation: munch .25s ease-in-out 4; }
@keyframes roomBounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-22px) scale(1.04, .97); } }
@keyframes roomWiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.home-panel { display: flex; flex-direction: column; gap: 10px; }
.feed-box { background: #fff7e6; border-radius: 20px; padding: 14px; text-align: center; }
.treat-balance { font-size: 1.25rem; margin: 0 0 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.treat-balance .ico { width: 1.4em; height: 1.4em; }
#homeFeed .cost { background: rgba(255,255,255,.25); border-radius: 99px; padding: 2px 10px; font-size: .95rem; margin-left: 4px; }
.home-actions { justify-content: center; }
.home-actions .heart { color: var(--pink-d); font-size: 1.3em; line-height: 1; }
.deco-panel { border-top: 2px dashed #ebe5ff; padding-top: 10px; }
.deco-panel h3 { margin-bottom: 8px; }
.deco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.deco-item { border: 3px solid transparent; background: #f7f4ff; border-radius: 16px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 96px; }
.deco-item.on { border-color: var(--sunny); background: #fffbe8; }
.deco-item.locked { opacity: .6; cursor: not-allowed; }
.deco-item.locked .deco-pic { filter: grayscale(1); }
.deco-item .need { font-size: .72rem; color: var(--ink-soft); display: flex; align-items: center; gap: 3px; text-align: center; line-height: 1.1; }
.deco-pic svg { width: 54px; height: 54px; }
.deco-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.nav-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.reward-links { margin-top: 14px; gap: 18px; }
.reward-links .linkish { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Creature Book ---------- */
.book-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.book-card { margin: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 4px solid transparent; }
.book-card h2 { margin: 2px 0 0; } .book-card p { margin: 0; }
.book-art svg { width: 140px; height: auto; }
.book-card.is-owned { border-color: #d9f5e6; }
.book-card.is-unknown { background: linear-gradient(180deg, #f1edfb, #fff); }
.book-art .shadow { filter: brightness(0) opacity(.72); }
.book-art .shadow .c-bob, .book-art .shadow * { animation: none !important; }
/* "Seen, not hatched yet": set later by ghost battles (change list #21); placeholder look for now */
.book-card.is-seen { border: 4px dashed #8fd0ff; background: linear-gradient(180deg, #eef8ff, #fff); }
.book-card.is-seen .shadow { filter: brightness(0) opacity(.45) drop-shadow(0 0 8px #8fd0ff); }
.book-tag { margin-top: auto; padding: 5px 12px; border-radius: 99px; font-weight: 600; font-size: .9rem; }
.tag-owned { background: #ddf7ea; color: #1f7a55; }
.tag-unknown { background: #ece8f6; color: var(--ink-soft); }
.tag-seen { background: #dff1ff; color: #2a6f9e; }

@media (max-width: 960px) { .habitat { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  /* gentler: no hopping or droop animation; a small still pose + the speech bubble instead */
  .buddy-pet.cheer, .buddy-pet.sad, .room-pet.r-bounce, .room-pet.r-wiggle, .room-pet.r-eat { animation: none !important; }
  .buddy-pet.cheer { transform: scale(1.06); }
  .buddy-pet.sad { transform: translateY(3px); opacity: .9; }
}
/* ---------- Number Caves boss fights (change list #10) ---------- */
.boss-card { display: flex; align-items: center; gap: 16px; width: 100%; border: 0; text-align: left; background: linear-gradient(110deg, #241a3f, #3b2266 60%, #5b2a6e); color: #fff; cursor: pointer; }
.boss-card:hover { filter: brightness(1.08); }
.boss-card-art { width: 110px; flex: none; } .boss-card-art img { width: 100%; display: block; }
.boss-card-txt { display: flex; flex-direction: column; gap: 4px; font-size: 1.05rem; } .boss-card-txt b:first-child { font-size: 1.6rem; color: #ffd166; }
.boss-q-mark { display: grid; place-items: center; width: 90px; height: 90px; border-radius: 50%; background: #181820; color: #ffd166; font-size: 3rem; font-weight: 700; }
.boss-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; background: linear-gradient(180deg, #2a1f47, #181820); color: #fff; }
.boss-intro .muted { color: #cfc6ee; }
.boss-frame { position: relative; aspect-ratio: 1; width: 100%; border-radius: 22px; background: radial-gradient(circle at 50% 60%, #2c1f4d 0, #181820 70%); container-type: inline-size; overflow: hidden; }
.boss-svg { display: block; width: 100%; height: 100%; }
/* health bars live in the art's empty headroom (top 200 of 1500 px = top 13.3%); the highest coins start at 13.9% */
.boss-bars { position: absolute; left: 4%; right: 4%; top: 1.2%; height: 11.4%; display: grid; grid-template-rows: 1fr 1fr; gap: 6%; font-size: 13px; font-size: clamp(10px, 3.1cqw, 19px); z-index: 2; pointer-events: none; }
.hb { display: grid; grid-template-columns: 9.5em 1fr 4.6em; align-items: center; gap: .5em; color: #fff; font-weight: 700; min-height: 0; }
.hb-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.hb-bar { height: 100%; max-height: 1.3em; background: rgba(255,255,255,.16); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.hb-bar i { display: block; height: 100%; border-radius: 99px; transition: width .45s ease; }
.hb-boss .hb-bar i { background: linear-gradient(90deg, #c4163f, #ff5c7a); }
.hb-you .hb-bar i { background: linear-gradient(90deg, #36ad82, #5fd4a8); }
.hb-num { text-align: right; white-space: nowrap; color: #ffd166; } .hb-you .hb-num { color: #ff7eb6; letter-spacing: -.05em; } .hb-num .lost { opacity: .25; }
.hb-you.ouch { animation: ouch .5s; }
@keyframes ouch { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.boss-svg .coin-shade { fill: #120c22; opacity: .62; transition: opacity .35s; }
.boss-svg .coin-shade.lit { opacity: 0; }
.boss-svg .coin-ring { fill: none; stroke: #ffe79a; stroke-width: 2.2; opacity: 0; transition: opacity .35s; transform-box: fill-box; transform-origin: center; }
.boss-svg .coin-ring.lit { opacity: .95; }
.boss-svg .coin-ring.pop { animation: coinpop .6s ease-out; }
@keyframes coinpop { 0% { transform: scale(.6); opacity: 0; } 50% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(1); } }
.boss-art.hit .boss-svg { animation: bosshit .45s; }
@keyframes bosshit { 20% { transform: translateX(-2%) rotate(-1deg); } 60% { transform: translateX(2%) rotate(1deg); } }
.boss-fight { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.boss-stage { padding: 10px; background: #181820; }
.boss-q { text-align: center; }
.boss-q-text { font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 700; margin: 4px 0 12px; }
.q-things { display: grid; grid-template-columns: repeat(5, 46px); gap: 10px; justify-content: center; margin: 0 auto 14px; }
.q-thing { width: 46px; height: 46px; }
.q-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.q-num { min-width: 62px; padding: 10px 8px; border-radius: 16px; background: #f3efff; font-size: 1.7rem; font-weight: 700; }
.q-num.q-gap { background: #fff1bf; color: #b8730f; box-shadow: inset 0 0 0 3px #ffd166; }
.boss-choices { grid-template-columns: 1fr 1fr; }
.bchoice { font-size: 1.8rem; min-height: 72px; }
.boss-end .boss-frame { max-width: 360px; margin: 0 auto 10px; }
.boss-end.won h1 { color: var(--purple-d); }
@media (max-width: 999px) {
  .boss-fight, .boss-intro { grid-template-columns: 1fr; }
  .boss-stage .boss-frame { max-width: 560px; margin: 0 auto; }
  .boss-intro .boss-frame { max-width: 420px; margin: 0 auto; }
}
/* iPad landscape / short desktop windows: keep the art small enough that the answers stay on screen */
@media (min-width: 1000px) and (max-height: 900px) { .boss-stage .boss-frame { max-width: min(100%, calc(100vh - 150px)); margin: 0 auto; } }
@media (max-width: 560px) { .boss-card { flex-direction: column; text-align: center; } .q-things { grid-template-columns: repeat(5, 36px); } .q-thing { width: 36px; height: 36px; } }
@media (prefers-reduced-motion: reduce) {
  .boss-svg .coin-ring.pop, .boss-art.hit .boss-svg, .hb-you.ouch { animation: none !important; }
}

/* ---------- #5 themed area backgrounds (CSS/SVG only; painted backgrounds are a later art task) ---------- */
body[data-theme="woods"] {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 160' preserveAspectRatio='none'%3E%3Cg fill='%233f8f5a' opacity='.55'%3E%3Cpath d='M20 160 50 60 80 160z'/%3E%3Cpath d='M90 160 130 30 170 160z'/%3E%3Cpath d='M200 160 235 70 270 160z'/%3E%3Cpath d='M280 160 320 40 360 160z'/%3E%3Cpath d='M350 160 380 80 400 160z'/%3E%3C/g%3E%3Cg fill='%232f6f46' opacity='.7'%3E%3Cpath d='M0 160 25 95 50 160z'/%3E%3Cpath d='M150 160 185 85 220 160z'/%3E%3Cpath d='M300 160 330 100 360 160z'/%3E%3C/g%3E%3C/svg%3E") bottom / 100% 34vh no-repeat fixed,
    linear-gradient(180deg, #d8f3dc 0%, #b7e4c7 50%, #95d5b2 100%) fixed;
}
body[data-theme="caves"] {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cg fill='%232a2145'%3E%3Cpath d='M0 0h400v14H0z'/%3E%3Cpath d='M10 14l12 34 12-34zM60 14l8 22 8-22zM110 14l14 44 14-44zM180 14l9 26 9-26zM240 14l13 38 13-38zM300 14l8 20 8-20zM350 14l12 40 12-40z'/%3E%3C/g%3E%3C/svg%3E") top / 100% 14vh no-repeat fixed,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80' preserveAspectRatio='none'%3E%3Cg opacity='.75'%3E%3Cpath d='M30 80l10-40 12 40z' fill='%238fd0ff'/%3E%3Cpath d='M44 80l8-26 8 26z' fill='%23b9a8ff'/%3E%3Cpath d='M320 80l12-50 12 50z' fill='%23ffa6d2'/%3E%3Cpath d='M338 80l8-30 8 30z' fill='%238fd0ff'/%3E%3C/g%3E%3Cpath d='M0 70q100-14 200 0t200 0v10H0z' fill='%232a2145'/%3E%3C/svg%3E") bottom / 100% 16vh no-repeat fixed,
    linear-gradient(180deg, #3b2f63 0%, #4a3b7a 45%, #2e2550 100%) fixed;
}
body[data-theme="caves"] .topbar .tb-title, body[data-theme="caves"] .topbar h1, body[data-theme="caves"] > .wrap > h2, body[data-theme="caves"] .woods-sub, body[data-theme="caves"] .caves-sub { color: #fff; }
body[data-theme="caves"] .area-hero h1 { color: var(--ink, #2d2a4a); }
body[data-theme="caves"] .cloud { display: none; } /* no sky clouds inside a cave */
body[data-theme="caves"] .woods-sub { text-shadow: 0 2px 6px rgba(0,0,0,.4); }
body[data-theme="woods"] .woods-sub { color: #1f4d33; }
/* placeholders for areas still being built (Bible Garden, Map Islands, Science Lab): simple gradients until their art exists */
body[data-theme="garden"] { background: linear-gradient(180deg, #fff6d8, #d8f3dc) fixed; }
body[data-theme="islands"] { background: linear-gradient(180deg, #bde0fe, #a2d2ff 60%, #ffe8b0) fixed; }
body[data-theme="lab"] { background: linear-gradient(180deg, #e0fbfc, #c2dfe3) fixed; }

/* ---------- #4 today's quest ---------- */
.quest-banner { display: flex; gap: 14px; align-items: center; background: linear-gradient(110deg, #fff7d6, #fff); border: 2px solid #ffd166; padding: 12px 18px; }
.quest-banner p { margin: 2px 0; }
.qb-star .ico { width: 34px; height: 34px; color: #f4b400; }
.area.quest .area-art { filter: drop-shadow(0 0 10px #ffd166) drop-shadow(0 0 4px #ffb703); }
.quest-badge { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #ffd166; color: #5a3d00; font-weight: 700; font-size: .78rem; padding: 3px 9px; border-radius: 999px; box-shadow: 0 2px 0 #e0a800; }
.quest-badge .ico { width: 14px; height: 14px; vertical-align: -2px; }
.treat-notes { list-style: none; padding: 0; margin: 4px auto 12px; max-width: 520px; font-size: .95rem; }
.treat-notes li { background: #f6f2ff; border-radius: 12px; padding: 8px 12px; margin: 6px 0; }
.treat-notes .tn-repeat { background: #fff3e0; }
.treat-notes .ico { width: 16px; height: 16px; vertical-align: -3px; color: #f4b400; }

/* ---------- #10 Number Caves tabs, Timed Challenge, question pictures ---------- */
.cave-tabs { max-width: 520px; }
.timed-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.timed-head > div { flex: 1 1 300px; }
.best-times { padding-left: 1.4em; margin: 6px 0; } .best-times li { margin: 4px 0; } .best-times li.new { color: #2d8a4e; }
.time-creatures { list-style: none; padding: 0; } .time-creatures li { margin: 6px 0; } .time-creatures .ico { width: 16px; height: 16px; vertical-align: -3px; }
.timed-run { max-width: 560px; margin: 0 auto 18px; text-align: center; }
.timed-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.t-clock { font-variant-numeric: tabular-nums; background: #2a2145; color: #ffd166; padding: 2px 12px; border-radius: 10px; }
.t-q { font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 800; margin: 18px 0 6px; }
.t-ans { font-size: 2.2rem; font-weight: 800; min-height: 1.4em; border-bottom: 4px solid #d6ccf7; max-width: 160px; margin: 0 auto 14px; font-variant-numeric: tabular-nums; }
.tpad { display: grid; grid-template-columns: repeat(3, minmax(64px, 96px)); gap: 10px; justify-content: center; }
.tpad .btn { min-height: 60px; font-size: 1.5rem; }
.t-final { font-size: 3rem; font-weight: 800; margin: 6px 0; font-variant-numeric: tabular-nums; }
.best-wrap { max-width: 320px; margin: 0 auto 10px; text-align: left; }
.q-pic { display: block; margin: 0 auto 12px; width: min(170px, 42vw); height: auto; }
.q-pic.q-bar, .q-pic.q-ruler, .q-pic.q-grid { width: min(300px, 70vw); }
/* tall pictures (e.g. a 3 m x 7 m garden) are capped so the answer buttons stay on screen on iPad portrait */
.q-pic { max-height: 170px; }
.q-coins { display: flex; gap: 12px; justify-content: center; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.q-coin { display: flex; flex-direction: column; align-items: center; font-size: .8rem; color: var(--ink-soft); }
.boss-q[data-kind="story"] .boss-q-text { font-size: 1.15rem; line-height: 1.45; max-width: 640px; margin-left: auto; margin-right: auto; }
.legend-drop { background: linear-gradient(135deg, #fff4c2, #ffe0f0); border: 3px solid #ffd166; border-radius: 22px; padding: 14px; margin: 10px auto; max-width: 460px; }
.time-drop { background: linear-gradient(135deg, #e0f0ff, #f1e6ff); border-color: #8fb8ff; }
.rare-tag { display: inline-block; background: linear-gradient(90deg, #ffd166, #ff8fb3); color: #4a2a00; font-weight: 700; font-size: .72rem; padding: 2px 8px; border-radius: 999px; }
.rare-tag.time { background: linear-gradient(90deg, #8fd0ff, #b9a8ff); color: #1f2a5a; }
.book-how { margin: 4px 0 0; }

/* ---------- #20 Growth Goals, tricks, bigger home, mini-games ---------- */
.goals { list-style: none; padding: 0; margin: 6px 0; } .goals li { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; opacity: .7; } .goals li.done { opacity: 1; }
.goals .ico { width: 18px; height: 18px; flex: none; margin-top: 2px; } .goals li.done .ico { color: #f4b400; }
.games-box, .goals-box { border-top: 2px dashed #e6dfff; margin-top: 12px; padding-top: 10px; }
.game-btns { display: flex; flex-wrap: wrap; gap: 8px; } .game-btn { flex-direction: column; gap: 2px; } .game-btn[aria-disabled="true"] { opacity: .6; }
.room.big-home { min-height: 0; }
/* bigger home: a little taller, so the creature stands further back and the new Rug spot sits clearly in front of it */
.room.big-home { aspect-ratio: 16 / 13; background: linear-gradient(180deg, #ffe9c7 0, #ffe1f0 52%, #c98f5f 52%, #b97d4f 100%); }
.room.big-home .room-pet { bottom: 21%; width: 32%; left: 34%; }
.room.big-home::after { bottom: 20%; }
.room.big-home .slot-floorL, .room.big-home .slot-floorR { bottom: 22%; }
.slot-shelf { left: 39.5%; top: 6%; } .slot-rug { left: 39.5%; bottom: 2%; z-index: 4; }
.room-pet.r-spin { animation: petSpin .9s ease-in-out; } .room-pet.r-bigjump { animation: petJump .9s ease-out; }
@keyframes petSpin { to { transform: rotate(360deg); } }
@keyframes petJump { 30% { transform: translateY(-60px) scale(1.05); } 60% { transform: translateY(0) scale(.95, 1.05); } }
.game-card { max-width: 720px; margin: 0 auto 18px; text-align: center; }
.fetch-field { position: relative; height: 170px; background: linear-gradient(180deg, #dff5ff, #c8efc0 70%); border-radius: 20px; overflow: hidden; margin-bottom: 14px; }
.f-pet { position: absolute; left: 4%; bottom: 6px; width: 120px; } .f-pet svg { width: 100%; height: auto; }
.f-ball { position: absolute; left: 16%; bottom: 20px; width: 34px; } .f-ball svg { width: 100%; }
.f-ball.fly { animation: ballFly 1s ease-out forwards; }
@keyframes ballFly { 50% { bottom: 110px; } 100% { left: var(--dist, 70%); bottom: 20px; } }
.power { position: relative; height: 28px; background: #f0ecfb; border-radius: 14px; margin: 0 auto 14px; max-width: 520px; overflow: hidden; }
.power .zone { position: absolute; top: 0; bottom: 0; background: #6fd18a; } .power .marker { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #2a2145; border-radius: 3px; }
.hide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.hide-spot { background: #f6f2ff; border: 0; border-radius: 18px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; min-height: 120px; cursor: pointer; }
.hide-spot svg { width: 90%; max-width: 120px; height: auto; } .hide-spot.empty { opacity: .45; } .hide-spot.found { background: #e2f8e8; }
.hide-spot.wiggle { animation: roomWiggle .7s ease-in-out infinite; } .found-pet svg { width: 90px; height: auto; }
.runway { max-width: 220px; margin: 6px auto 12px; } .runway svg { width: 100%; height: auto; } .runway.walk { animation: runwayWalk 1.2s ease-in-out; }
@keyframes runwayWalk { 25% { transform: translateX(-30px) rotate(-4deg); } 75% { transform: translateX(30px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) {
  .room-pet.r-spin, .room-pet.r-bigjump, .f-ball.fly, .hide-spot.wiggle, .runway.walk { animation: none !important; }
  .room-pet.r-spin, .room-pet.r-bigjump { transform: scale(1.06); }
  .hide-spot.wiggle { outline: 4px dashed #ffd166; }
  .f-ball.fly { left: var(--dist, 70%); }
}

/* ---------- parent area: boss switches, family lists, creature art ---------- */
.switch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.switch-row { display: flex; gap: 10px; align-items: center; background: #f6f2ff; border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.switch-row input { width: 22px; height: 22px; flex: none; }
.fam-list { list-style: none; padding: 0; } .fam-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #eee8ff; flex-wrap: wrap; }
.fam-form textarea { width: 100%; font: inherit; border-radius: 14px; border: 2px solid #e1d9ff; padding: 10px; }
.art-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.art-slot { display: flex; flex-direction: column; gap: 6px; background: #f6f2ff; border-radius: 14px; padding: 10px; font-weight: 600; }
.art-slot input { font-size: .8rem; max-width: 100%; } .art-prev img { max-width: 100%; max-height: 120px; border-radius: 8px; }
#artCard input[type="text"], #artName, #artNote { width: 100%; margin: 6px 0; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; } .check-row input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.art-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.art-sub { background: #f6f2ff; border-radius: 14px; padding: 10px; } .art-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.art-imgs a { display: flex; flex-direction: column; align-items: center; font-size: .75rem; } .art-imgs img { width: 90px; height: 90px; object-fit: contain; background: #fff; border-radius: 8px; }
/* Kid drawings admin card (Oct 6): few, big, clearly labelled buttons; deleted drawings show a plain placeholder */
.pn-saved { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.art-state { font-weight: 700; margin: 6px 0 8px; }
.art-actions { display: flex; flex-direction: column; gap: 10px; }
.art-actions .btn { width: 100%; min-height: 52px; font-size: 1.05rem; }
.art-gone { display: flex; align-items: center; justify-content: center; height: 90px; border: 2px dashed #d9cdf7; border-radius: 10px; color: #8a7fb0; font-weight: 700; background: #fff; }
.art-sub.art-declined-deleted, .art-sub.art-made-deleted { opacity: .85; }

/* ---------- #30 Number Caves menu: 3 big buttons (stacked when tall, side by side when wide) ---------- */
.cave-menu { display: grid; grid-template-columns: 1fr; gap: clamp(14px, 2.2vh, 24px); height: max(480px, calc(100dvh - 162px)); max-width: 760px; margin: 0 auto; }
.cave-btn { position: relative; border: 0; border-radius: 30px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 64px 20px 28px; min-height: 150px; overflow: hidden; text-align: center; cursor: pointer;
  box-shadow: 0 8px 0 rgba(0,0,0,.28), 0 14px 34px rgba(10,5,30,.45), 0 0 0 3px rgba(255,255,255,.12) inset; transition: transform .15s, filter .15s; }
.cave-btn:hover { transform: translateY(-3px); filter: brightness(1.08); }
.cave-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(0,0,0,.28), 0 8px 20px rgba(10,5,30,.4), 0 0 0 3px rgba(255,255,255,.12) inset; }
.cave-btn:focus-visible { outline: 5px solid #ffd166; outline-offset: 3px; }
.cb-txt { font-size: clamp(2rem, 4.2vw, 2.9rem); font-weight: 700; line-height: 1.1; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.cb-sub { font-size: 1.25rem; font-weight: 600; opacity: .9; }
.cb-boss { background: radial-gradient(120% 90% at 50% 0%, #4a1f5c 0%, #241a3f 55%, #160f2a 100%); }
.cb-boss .cb-txt { color: #ffd166; }
.cb-rest { cursor: default; background: linear-gradient(170deg, #3d3566, #2a2347); }
.cb-rest:hover, .cb-rest:active { transform: none; filter: none; }
.cb-rest .cb-txt { color: #e6dcff; }
.cb-timed { background: linear-gradient(160deg, #8f7bff 0%, #6a55e0 60%, #4b3aa8 100%); padding-top: 28px; }
.cb-practice { background: linear-gradient(160deg, #4fbf9a 0%, #2f8f7a 55%, #22665e 100%); }
.cm-eyes { position: absolute; top: 14px; left: 4%; width: 92%; height: auto; max-height: 64px; }
.cm-eyes .eye-pair { animation: eye-blink 3.6s infinite; }
@keyframes eye-blink { 0%, 92%, 100% { opacity: 1; } 95% { opacity: .15; } }
.cm-watch { position: absolute; top: 14px; right: 18px; width: clamp(64px, 9vw, 92px); height: auto; filter: drop-shadow(0 4px 0 rgba(0,0,0,.2)); }
.cm-watch .sw-hand { transform-origin: 32px 37px; animation: sw-tick 6s steps(12) infinite; }
@keyframes sw-tick { to { transform: rotate(360deg); } }
.cm-cave { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: clamp(96px, 13vw, 132px); height: auto; filter: drop-shadow(0 4px 0 rgba(0,0,0,.2)); }
@media (orientation: landscape) and (min-width: 900px) {
  .cave-menu { grid-template-columns: repeat(3, 1fr); max-width: none; height: min(560px, max(380px, calc(100dvh - 170px))); margin-top: max(0px, calc((100dvh - 170px - 560px) / 3)); }
  .cave-btn { padding-top: 90px; }
  .cb-timed { padding-top: 90px; }
  .cm-eyes { top: 24px; }
}
/* Timed Challenge ready screen */
.ready-card { max-width: 720px; margin: 10px auto; text-align: center; }
.ready-watch .cm-watch { position: static; width: 84px; display: block; margin: 0 auto 4px; }
.ready-txt { font-size: clamp(2.4rem, 6vw, 3.4rem); color: var(--purple-d); margin-bottom: .3em; }
.go-btn { font-size: clamp(2.6rem, 7vw, 3.6rem); padding: .35em 1.8em; border-radius: 999px; background: linear-gradient(180deg, #7fe6bf, var(--mint-d)); box-shadow: 0 7px 0 #24805f; letter-spacing: .04em; }
.go-btn:active:not(:disabled) { box-shadow: 0 2px 0 #24805f; }
.ready-note { margin: 16px 0 10px; font-size: 1.05rem; }
.ready-info { display: grid; grid-template-columns: 1fr; gap: 10px 24px; text-align: left; max-width: 360px; margin: 0 auto; background: #f6f3ff; border-radius: 20px; padding: 14px 20px; }
.ready-info.two { grid-template-columns: 1fr 1fr; max-width: 560px; }
.ready-info h3 { margin-bottom: 4px; }
/* Practice Caves screen: the 5 caves, bigger */
.practice-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; max-width: 760px; margin: 0 auto; }
.practice-grid .op-card { min-height: 170px; justify-content: center; }
.practice-grid .op-card:last-child { grid-column: 1 / -1; }
@media (orientation: landscape) and (min-width: 900px) {
  .practice-grid { grid-template-columns: repeat(6, 1fr); max-width: none; }
  .practice-grid .op-card { grid-column: span 2; min-height: min(250px, calc((100dvh - 230px) / 2)); }
  .practice-grid .op-card:nth-child(4) { grid-column: 2 / span 2; }
  .practice-grid .op-card:last-child { grid-column: 4 / span 2; }
}
@media (max-width: 560px) { .ready-info.two { grid-template-columns: 1fr; } .practice-grid .op-card { min-height: 130px; } }
@media (prefers-reduced-motion: reduce) { .cm-eyes .eye-pair, .cm-watch .sw-hand { animation: none; } .cave-btn:hover, .cave-btn:active { transform: none; } }
/* #30 sizing: bigger icons/labels, sub-screens fill the screen */
.cb-txt { font-size: clamp(2.2rem, 4.6vw, 3.3rem); }
.cm-eyes { max-height: 92px; top: 16px; }
.cm-watch { width: clamp(84px, 11vw, 116px); }
.cm-cave { width: clamp(120px, 16vw, 168px); }
.cave-btn { padding-top: 92px; }
.cb-timed { padding-top: 28px; }
@media (orientation: landscape) and (min-width: 900px) { .cave-btn, .cb-timed { padding-top: 110px; } .cm-eyes { top: 26px; } .cb-txt { font-size: clamp(2.2rem, 3.6vw, 3.1rem); } }
.ready-card { min-height: min(820px, calc(100dvh - 180px)); display: flex; flex-direction: column; justify-content: center; align-items: center; }
.ready-watch .cm-watch { width: clamp(96px, 14vh, 140px); }
.ready-txt { font-size: clamp(2.6rem, 7vw, 4rem); }
.go-btn { font-size: clamp(3rem, 8vw, 4.4rem); padding: .3em 2em; }
.ready-info { width: 100%; }
.practice-grid .op-card { min-height: min(300px, max(150px, calc((100dvh - 162px - 40px) / 3))); }
.practice-grid .op-sign { font-size: clamp(3.4rem, 7vw, 5rem); }
.practice-grid .op-name { font-size: clamp(1.4rem, 3vw, 2rem); }
@media (orientation: landscape) and (min-width: 900px) { .practice-grid .op-card { min-height: min(300px, max(150px, calc((100dvh - 162px - 22px) / 2))); } }
/* reward "Feed <name>" lands on Creature Home's Feed button with a short glow */
.feed-here { animation: feed-here 1.1s ease-in-out 3; }
@keyframes feed-here { 50% { box-shadow: 0 5px 0 var(--purple-d), 0 0 0 8px rgba(255, 209, 102, .85); } }
@media (prefers-reduced-motion: reduce) { .feed-here { animation: none; outline: 4px solid #ffd166; outline-offset: 3px; } }
/* hats on tall pictures (Grown, crowned Legendaries) may poke above the picture box instead of being cut off */
svg.pic-creature { overflow: visible; }
.hidden-profiles { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .95rem; }
.hidden-profiles .hp-kid { display: inline-flex; align-items: center; gap: 6px; }

/* Oct 4 batch (feature/caves-oct4): #16 rarity borders and #31 Number Caves menu polish. Loaded after style.css. */

/* ---------- #16 rarity: the card BORDER only (green / blue / purple / gold + glow). Not hatched = no tier class. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tier { border: 4px solid var(--tier-c) !important; }
.tier-common { --tier-c: #3fbf5f; }
.tier-rare { --tier-c: #3a8ee6; }
.tier-epic { --tier-c: #9b59d6; }
.tier-legendary { --tier-c: #e6b422; box-shadow: 0 0 0 2px rgba(255, 221, 120, .55), 0 0 18px 4px rgba(230, 180, 34, .45), 0 6px 18px rgba(60, 40, 120, .12); }
/* round art frames (hatch screen, reward screen, welcome pop-up) */
.hatch-pet.tier, .reward-pet.tier, .modal-pet.tier, .egg-big.tier { border-radius: 28px; padding: 6px 14px; display: inline-block; background: #fff; }
.egg-big.tier { padding: 0 10px; }

/* ---------- #31 Number Caves menu polish: smaller buttons + a header card (option A, chosen Oct 4) */
.cave-wrap { max-width: 760px; margin: 0 auto; }
.caves-head { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); margin: 0 0 clamp(12px, 2vh, 20px); padding: 14px clamp(16px, 3vw, 30px);
  background: linear-gradient(100deg, #ece6ff 0%, #f8f6ff 60%, #fdfcff 100%); border-radius: 26px; box-shadow: 0 6px 18px rgba(20, 10, 50, .25); color: #2d2a4a; text-align: left; }
.caves-head .ch-cave { width: clamp(84px, 11vw, 116px); height: auto; flex: none; }
.caves-head h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.3rem); color: #2d2a4a; line-height: 1.1; }
.caves-head p { margin: 4px 0 0; font-size: clamp(1rem, 1.7vw, 1.15rem); color: #3d3566; }
.cave-wrap .cave-menu { height: auto; max-width: none; margin-top: 0; grid-auto-rows: clamp(170px, 21vh, 236px); }
.cave-wrap .cave-btn { min-height: 0; padding: 76px 18px 18px; gap: 4px; }
.cave-wrap .cb-timed { padding-top: 22px; }
.cave-wrap .cb-txt { font-size: clamp(1.9rem, 3.8vw, 2.6rem); }
.cave-wrap .cm-eyes { max-height: 66px; top: 12px; }
.cave-wrap .cm-watch { width: clamp(64px, 8.5vw, 88px); top: 12px; right: 16px; }
.cave-wrap .cm-cave { width: clamp(92px, 11.5vw, 124px); top: 10px; }
@media (orientation: landscape) and (min-width: 900px) {
  .cave-wrap { max-width: 1180px; }
  .cave-wrap .cave-menu { grid-auto-rows: clamp(240px, 40vh, 340px); margin-top: 0; }
  .cave-wrap .cave-btn, .cave-wrap .cb-timed { padding-top: 96px; }
  .cave-wrap .cm-eyes { top: 22px; }
  .cave-wrap .cb-txt { font-size: clamp(1.9rem, 3vw, 2.6rem); }
}

/* Lance (Oct 4): My Creatures rarity tabs (All / Common / Rare / Epic / Legendary), tinted with the card border colours */
.coll-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.coll-tab { min-height: 44px; min-width: 64px; padding: 8px 18px; border-radius: 999px; border: 3px solid var(--ct, #b9b2d6); background: #fff; color: #3b3355;
  font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: 0 2px 0 rgba(60, 40, 120, .12); }
.coll-tab.ct-all { --ct: #8c7fd0; } .coll-tab.ct-common { --ct: #3fbf5f; } .coll-tab.ct-rare { --ct: #3a8ee6; }
.coll-tab.ct-epic { --ct: #9b59d6; } .coll-tab.ct-legendary { --ct: #e6b422; }
.coll-tab:not(.on) { background: color-mix(in srgb, var(--ct) 12%, #fff); }
.coll-tab.on { background: var(--ct); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ct) 35%, transparent), 0 3px 0 rgba(60, 40, 120, .18); }
.coll-tab:focus-visible { outline: 3px solid #3b3355; outline-offset: 2px; }
.coll-grid .coll-card[hidden], .book-grid .book-card[hidden], .coll-empty[hidden] { display: none !important; }
.coll-empty { text-align: center; font-weight: 700; color: #5b5478; padding: 18px; }
@media (max-width: 560px) { .coll-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; } .coll-tab { flex: 0 0 auto; } }
/* Lance (Oct 4): the Creature Book uses the same rarity tabs (js/rarity.js rarityTabsHTML); 44px tall on both screens */
.book-hero + .rarity-tabs { margin-top: 0; }
.anim-host.anim-paused, .anim-host.anim-paused * { animation-play-state: paused !important; }   /* grid cards off-screen / tab hidden (js/anim.js) */
/* js/anim.js already blinks the lids / sways the tail / moves the wings of these hosts (marker classes set in drive()):
   switch the old CSS squash blink, tail rotation and wing flap off there so nothing moves twice. Parts anim.js does not
   move (e.g. the Avilie and Stricam tails, the Grown Mochi wings) keep their CSS loop. */
.anim-host.js-blink .c-eyes, .anim-host.js-tail .c-tail, .anim-host.js-wings .c-wings { animation: none; }
/* Lance (Oct 4, 1:29 PM): start screen Fizz / Lumi / Mochi; same-size hidden stand-ins until the creature list loads */
.hero-pets.hero-wait svg { visibility: hidden; }
