:root {
  color-scheme: dark;
  --ink: #fff8f1; --muted: #c7bdd8; --dim: #9d92b4;
  --pink: #ffa2c0; --aqua: #a4e8e4; --gold: #ffd27a;
  --border: #8c74a33c; --gap: 8px;
  --viewport-h: 100vh;
  font-family: Arial, Helvetica, sans-serif;
}
@supports (height: 100dvh) { :root { --viewport-h: 100dvh; } }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  color: var(--ink);
  background: radial-gradient(ellipse at 12% 6%, #513049, transparent 65%), radial-gradient(ellipse at 95% 84%, #213e4d, transparent 65%), #211931;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url('assets/pet-pattern.svg') center / 560px 560px repeat;
  opacity: .34;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 22px; height: 22px; flex: 0 0 auto; fill: currentColor; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; z-index: 2; }
h1,h2,h3,p { margin: 0; }
.hidden { display: none !important; }
#app {
  width: min(1360px, calc(100% - 24px));
  height: calc(var(--viewport-h) - 16px);
  margin: 8px auto;
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.topbar { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; min-height: 54px; gap: 10px; padding: 0 4px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-paw { width: 37px; height: 37px; color: var(--gold); transform: rotate(-15deg); filter: drop-shadow(0 3px 0 #130c23); }
h1 { font-family: 'Chewy', 'Chalkboard SE', 'Comic Sans MS', cursive; font-size: clamp(26px, 3.5vw, 42px); font-weight: 900; line-height: 1.05; white-space: nowrap; letter-spacing: .5px; text-shadow: 0 3px 0 #170e26; }
h1 span { display: inline-block; }
h1 span:nth-child(1) { color: var(--gold); transform: rotate(-3deg); }
h1 span:nth-child(2) { color: var(--aqua); transform: rotate(3deg); }
h1 span:nth-child(3) { color: var(--pink); transform: rotate(-2deg); }
.tagline { font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: .4px; }
.collection-count { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 800; padding: 9px 12px; border: 1px solid var(--border); background: #20162cca; border-radius: 5px; }
.collection-count svg { color: var(--gold); width: 20px; }
.panel { border: 1px solid #af8bc74d; border-radius: 6px; padding: 10px; background: linear-gradient(135deg, #382a4deb, #281f3cec); box-shadow: 0 8px 28px #11092166; }
.screen { display: none; min-height: 0; min-width: 0; flex: 1 1 0; }
.screen.active { display: flex; flex-direction: column; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 5px; font-weight: 800; font-size: 14px; white-space: nowrap; box-shadow: 0 3px 0 #120f245e; transition: filter .12s, transform .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.primary { background: linear-gradient(140deg, #eec28e, #d79b7f); border-color: #f2d8af; color: #3f2d24; }
.secondary { background: #4c3b60; border-color: #ad93c342; }
.btn:disabled { opacity: .34; box-shadow: none; }
.world-tabs { display: flex; gap: 8px; flex-shrink: 0; }
.world-tab { display: flex; align-items: center; text-align: left; gap: 10px; flex: 1 1 0; min-width: 0; min-height: 50px; padding: 6px 12px; border: 1px solid #ac8ccc2e; border-radius: 5px; background: #20182d99; }
.world-tab > svg { width: 28px; height: 28px; color: var(--dim); }
.world-tab strong { font-size: 16px; display: block; }
.world-tab small { display: flex; align-items: center; gap: 12px; font-size: 11px; margin-top: 3px; color: var(--muted); }
.world-tab small b { font-weight: 500; color: var(--dim); }
.world-tab.selected { border-color: #e4b4aa99; background: linear-gradient(110deg, #7f455756, #59436477); box-shadow: inset 0 -2px var(--pink); }
.world-tab.selected > svg { color: var(--pink); }
.world-tab:nth-child(2).selected { border-color: #80bab877; background: #34556666; box-shadow: inset 0 -2px var(--aqua); }
.world-tab:nth-child(2).selected > svg { color: var(--aqua); }
.picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 47px; flex-shrink: 0; }
.picker-heading h2 { font-size: 18px; line-height: 1.2; }
.picker-heading p { font-size: 11px; color: var(--muted); margin-top: 4px; }
.level-grid { display: grid; grid-template-columns: repeat(var(--grid-cols, 5), minmax(0, 1fr)); grid-template-rows: repeat(var(--grid-rows, 3), minmax(0, 1fr)); flex: 1 1 0; min-height: 0; min-width: 0; gap: 8px; }
.level-btn { padding: 0; position: relative; min-width: 0; min-height: 0; border: 1px solid #a185be59; border-radius: 5px; overflow: hidden; display: flex; flex-direction: column; background: #211b30; text-align: left; box-shadow: 0 2px 0 #140f2366; }
.level-btn:hover:not(:disabled) { border-color: var(--pink); }
.level-btn.current { border: 2px solid var(--pink); }
.level-btn.completed { border-color: #86d3b3; }
.level-thumb { flex: 1 1 0; min-height: 0; width: 100%; overflow: hidden; position: relative; background: #443853; }
.level-thumb img { width: 100%; height: 100%; object-fit: contain; object-position: center center; display: block; background: #efe9d4; }
.level-btn.locked .level-thumb img { filter: grayscale(.78) brightness(.62); opacity: .8; }
.level-number { position: absolute; left: 5px; top: 5px; display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; background: #22182fd9; color: #fff9f2; font-weight: 900; font-size: 16px; border: 1px solid #fff3; border-radius: 4px; z-index: 1; }
.card-state { position: absolute; bottom: 6px; right: 6px; width: 27px; height: 27px; padding: 5px; background: #21172dda; border: 1px solid #c4b1d646; color: #eee4f4; border-radius: 4px; display: grid; place-items: center; }
.card-state svg { width: 16px; height: 16px; }
.level-btn.current .card-state { background: var(--pink); color: #3b253d; }
.level-btn.completed .card-state { background: #88d1b5; color: #193d33; }
.level-caption { flex: 0 0 auto; min-width: 0; height: 25px; padding: 5px 7px; font-size: 11px; font-weight: 700; color: #e7ddee; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.level-caption .name { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.sketch-tag { font-size: 9px; font-weight: 500; color: var(--dim); }
.bonus-chip { position: absolute; right: 5px; top: 5px; background: #ffdb8c; color: #594321; padding: 3px 5px; border-radius: 3px; font-size: 9px; font-weight: 900; display: flex; align-items: center; gap: 3px; }
.bonus-chip svg { width: 10px; height: 10px; }
.level-btn.bonus { border-color: #ffcc7777; }
.level-btn.bonus .level-caption { color: var(--gold); background: #51402d66; }
.pagination { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 8px; }
.pagination .btn { min-width: 112px; }
.page-selector { display: flex; align-items: center; gap: 7px; }
.page-btn { width: 38px; height: 38px; border: 1px solid #b69aca44; border-radius: 4px; background: #30243f; font-weight: 800; }
.page-btn.selected { color: #392642; background: var(--pink); border-color: var(--pink); }
#pageLabel { margin-left: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.game-top { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.scene-heading { min-width: 0; flex: 1 1 0; }
.world-line { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; margin-bottom: 5px; white-space: nowrap; }
#worldBadge { overflow: hidden; text-overflow: ellipsis; }
.divider { opacity: .4; }
.bonus-label { font-size: 10px; padding: 2px 5px; border-radius: 3px; color: #38232d; background: var(--gold); }
#levelTitle { font-size: clamp(17px, 2vw, 23px); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.game-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.stat { min-height: 44px; padding: 5px 10px; display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 3px; border: 1px solid #b59acc26; background: #22192d77; border-radius: 4px; }
.stat > span { font-size: 10px; color: var(--muted); }
.stat > strong { font-size: 15px; white-space: nowrap; }
.lives-display { display: flex; align-items: center; justify-content: center; gap: 4px; }
.lives-display img { width: 23px; height: 21px; display: block; }
.lives-display img.empty { opacity: .25; filter: grayscale(1); }
.hint-btn { background: #f5cb7b; color: #3a2a30; border-color: #ffe1a1; }
#hintCount { display: inline-block; margin-left: 2px; background: #392b3222; border-radius: 3px; padding: 3px 5px; }
.game-board { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 0; min-width: 0; overflow: hidden; }
.game-board[data-layout='stack'] { flex-direction: column; }
.canvas-wrap { padding: 5px; border: 1px solid #bca2d633; border-radius: 4px; background: #1e1829ad; flex: 0 0 auto; }
.canvas-label { height: 21px; line-height: 18px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: #d8cce4; text-align: center; }
canvas { display: block; width: var(--picture-w, 240px); height: var(--picture-h, 240px); border-radius: 2px; cursor: crosshair; touch-action: manipulation; }
.game-board.loading canvas { opacity: .25; pointer-events: none; }
.message-bar { flex: 0 0 auto; min-height: 27px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px 8px; border: 1px solid #bfa2d223; border-radius: 4px; font-size: 12px; line-height: 1.25; color: #d6c9e3; background: #1f19285c; }
.message-bar.success { color: #b4eed7; }
.message-bar.miss { color: #ffc2cf; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; color: #cabfda99; padding: 0 3px; flex-shrink: 0; min-height: 12px; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: #130d24dc; z-index: 20; }
.overlay-card { width: min(440px, 100%); padding: 20px; border: 1px solid #c9a9cd66; border-radius: 6px; background: #38294a; text-align: center; box-shadow: 0 20px 65px #0006; }
.overlay-card h2 { font-family: 'Chewy','Chalkboard SE','Comic Sans MS',cursive; font-size: 30px; margin: 5px 0 10px; }
.overlay-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.reward-star { width: 52px; height: 52px; color: var(--gold); filter: drop-shadow(0 3px 0 #8d5b3666); }
.dialog-heart { width: 52px; height: 47px; }
.button-row { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.level-grid.small-cards .level-caption { height: 19px; font-size: 10px; padding: 2px 5px; }
.level-grid.small-cards .sketch-tag { display: none; }
.level-grid.small-cards .level-number { min-width: 22px; height: 22px; font-size: 13px; top: 3px; left: 3px; }
.level-grid.small-cards .card-state { width: 22px; height: 22px; bottom: 3px; right: 3px; padding: 3px; }
@media (max-width: 880px) {
  .game-top { flex-wrap: wrap; }
  .scene-heading { flex-basis: 100%; }
  .game-tools { width: 100%; justify-content: space-between; }
  .game-tools .btn { flex: 1; }
  .scene-heading h2 { font-size: 19px; }
  .world-line { display: inline-flex; margin-bottom: 3px; }
}
@media (max-width: 560px) {
  #app { width: calc(100% - 12px); gap: 6px; height: calc(var(--viewport-h) - 10px); margin: 5px auto; }
  .topbar { min-height: 45px; padding: 0 2px; }
  .brand { gap: 6px; }
  .brand-paw { width: 25px; height: 25px; }
  h1 { font-size: clamp(23px, 6.5vw, 32px); letter-spacing: 0; }
  .tagline { font-size: 9px; }
  .collection-count { font-size: 11px; padding: 6px; gap: 4px; }
  .collection-count svg { width: 15px; height: 15px; }
  .panel { padding: 6px; }
  .screen.active { gap: 6px; }
  .world-tab { padding: 6px 8px; gap: 7px; min-height: 46px; }
  .world-tab strong { font-size: 12px; }
  .world-tab > svg { width: 21px; height: 21px; }
  .world-tab small { font-size: 10px; gap: 8px; }
  .picker-heading h2 { font-size: 14px; }
  .picker-heading p { font-size: 10px; line-height: 1.3; }
  .picker-heading { min-height: 44px; }
  .picker-heading .btn { font-size: 12px; gap: 4px; padding: 6px 9px; }
  .picker-heading .btn svg { width: 15px; height: 15px; }
  .level-grid { gap: 6px; }
  .btn { padding: 7px 10px; font-size: 12px; gap: 5px; }
  .btn svg { width: 19px; height: 19px; }
  .pagination .btn { min-width: 44px; }
  .pagination .btn span { display: none; }
  #pageLabel { font-size: 11px; }
  .stat { padding: 5px 7px; }
  .game-tools { gap: 5px; }
  .lives-display { gap: 2px; }
  .lives-display img { width: 20px; height: 18px; }
  .app-footer { font-size: 9px; }
  #saveStatus { display: none; }
  .message-bar { font-size: 11px; }
  .world-line { font-size: 10px; }
}
@media (max-height: 540px) {
  #app { gap: 5px; margin: 4px auto; height: calc(var(--viewport-h) - 8px); }
  .topbar { min-height: 36px; }
  h1 { font-size: 29px; }
  .brand-paw { width: 28px; height: 28px; }
  .tagline, .app-footer { display: none; }
  .panel { padding: 6px; }
  .screen.active { gap: 5px; }
  .world-tab { min-height: 36px; padding: 4px 9px; }
  .world-tab strong { font-size: 13px; }
  .world-tab small { display: none; }
  .world-tab > svg { width: 22px; height: 22px; }
  .picker-heading { min-height: 34px; }
  .picker-heading h2 { font-size: 14px; }
  .picker-heading p { margin-top: 2px; font-size: 10px; }
  .picker-heading .btn, .pagination .btn { min-height: 34px; padding: 5px 10px; font-size: 12px; }
  .pagination { min-height: 34px; }
  .page-btn { width: 32px; height: 32px; }
  .game-top { flex-wrap: nowrap; }
  .scene-heading { flex-basis: auto; }
  .game-tools { width: auto; }
  .game-tools .btn { min-height: 38px; }
  .stat { min-height: 38px; padding: 3px 7px; }
  .world-line { font-size: 10px; margin-bottom: 3px; }
  #levelTitle { font-size: 17px; }
  .message-bar { font-size: 11px; min-height: 24px; }
}
@media (max-width: 640px) and (max-height: 540px) {
  .game-top { flex-wrap: wrap; }
  .scene-heading { flex-basis: 100%; display: flex; align-items: center; gap: 8px; }
  .world-line { margin: 0; }
  #worldBadge, .world-line .divider { display: none; }
  #levelTitle { font-size: 15px; }
  .game-tools { width: 100%; }
  .picker-heading h2 { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
/* Explicit frame width stops long captions from widening tiny viewports. */
.canvas-wrap { width: calc(var(--picture-w, 240px) + 12px); min-width: 0; }
.canvas-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 350px) {
  h1 { font-size: 22px; }
  .brand { gap: 4px; }
  .brand-paw { width: 21px; height: 21px; }
  #openWorldsBtn { width: 44px; padding: 8px; }
  #openWorldsBtn span { display: none; }
  #restartBtn { flex: 0 0 44px; width: 44px; padding: 8px; }
  #restartBtn span { display: none; }
  .game-tools { min-width: 0; }
}

/* GARDEN PRESENTATION PASS — all tabs, tiles, arrows and indicators are live DOM UI. */
:root { color-scheme: light; --ink:#32372c; --muted:#737056; --dim:#837d64; --gold:#ffbd27; --pink:#f55779; --aqua:#129ccd; --border:#98784744; font-family:'Trebuchet MS',Arial,sans-serif; }
body { background:linear-gradient(#79d0ed 0%,#bce9eb 24%,#b5d67e 65%,#548c2c); }
body::before { display:none; }
.garden-scenery { position:fixed; inset:0; overflow:hidden; pointer-events:none; z-index:0; }
.sky-wash { position:absolute; inset:0; background:radial-gradient(ellipse at 49% 5%,#f2f9e477,transparent 60%),linear-gradient(180deg,transparent 58%,#426d1966); }
.garden-side { position:absolute; bottom:0; height:100%; width:auto; max-width:34vw; object-fit:cover; object-position:bottom; filter:saturate(.68) brightness(.92) contrast(.98); opacity:.48; }
.garden-left { left:0; -webkit-mask-image:linear-gradient(to right,#000 87%,transparent);mask-image:linear-gradient(to right,#000 87%,transparent); }
.garden-right { right:0; -webkit-mask-image:linear-gradient(to left,#000 87%,transparent);mask-image:linear-gradient(to left,#000 87%,transparent); }
#app { position:relative; z-index:1; width:min(1060px,calc(100% - 250px)); height:calc(var(--viewport-h) - 20px); margin:10px auto; gap:8px; }
.topbar { display:grid; grid-template-columns:1fr minmax(0,auto) 1fr; gap:12px; min-height:100px; padding:0 1px; }
.header-actions { display:flex; gap:8px; align-items:center; }
.header-right { display:flex; justify-content:flex-end; align-items:center; min-width:0; }
.brand { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; }
h1 { font-family:'Trebuchet MS',sans-serif; font-size:0; line-height:1; text-shadow:none; }
h1 img { display:block; width:auto; height:clamp(66px,12vh,103px); max-width:100%; object-fit:contain; }
.tagline { font-size:10px; font-weight:800; color:#285552; background:#eafaebbf; padding:3px 12px; border-radius:4px; letter-spacing:.8px; }
.btn { border-width:2px; border-style:solid; border-color:#155470; border-radius:7px; min-height:46px; padding:8px 14px; color:white; text-shadow:0 1px 1px #0005; box-shadow:inset 0 2px 0 #ffffff91,inset 0 -2px 0 #0002,0 3px 0 #244124bb; font-weight:900; }
.btn:focus-visible, .world-tab:focus-visible, .level-btn:focus-visible { outline:3px solid #253d61; outline-offset:3px; }
.btn:hover:not(:disabled) { filter:brightness(1.08); transform:translateY(-1px); }
.btn:active:not(:disabled) { transform:translateY(2px); box-shadow:inset 0 2px 4px #0003; }
.btn.primary,.btn.green { background:linear-gradient(#64d832,#249d0d); border-color:#267408; }
.btn.secondary,.btn.blue { background:linear-gradient(#2ab3ee,#0872b7); border-color:#145682; }
.btn.golden,.btn.hint-btn { background:linear-gradient(#ffe77c,#f3b536); color:#614313; border-color:#ab731a; text-shadow:0 1px #fff6; }
.btn:disabled { background:linear-gradient(#c2c6ba,#a0a69a); border-color:#848f7c; color:#ecefe6; opacity:.65; box-shadow:inset 0 2px 0 #fff7; }
.icon-btn { width:48px; height:48px; padding:8px; flex:0 0 auto; }
.icon-btn svg { width:25px; height:25px; }
.collection-count { color:#1b4b62; background:linear-gradient(#fff6c8,#ffdf7c); border:2px solid #8b631e; border-radius:7px; box-shadow:inset 0 2px 0 #fff,0 3px 0 #24412488; padding:10px 13px; font-size:16px; }
.collection-count svg { width:24px; height:24px; color:#ffb614; stroke:#a2610d; stroke-width:1.1; }
.panel { background:linear-gradient(110deg,#fffdf4f7,#f3e7c6fa); padding:10px; border:3px solid #a97937; border-radius:10px; box-shadow:0 0 0 2px #dbc47a,inset 0 0 0 2px #fffce3,0 10px 28px #28421445; }
.screen.active { gap:8px; }
.world-tabs { gap:10px; }
.world-tab { position:relative; padding:5px 12px; min-height:57px; background:linear-gradient(#b36e7d,#7f4453); color:#fff; border:2px solid #6a3441; border-radius:7px; box-shadow:inset 0 2px 0 #eac5cc,0 2px 0 #ac884a88; text-shadow:0 2px 0 #53223170; }
.world-tab:nth-child(2) { background:linear-gradient(#4c91a6,#24586a); border-color:#234b59; box-shadow:inset 0 2px 0 #bbdde5,0 2px 0 #ac884a88; }
.world-tab.selected { background:linear-gradient(#c06f84,#934659); border-color:#6e3141; box-shadow:inset 0 2px 0 #f0d7df,0 3px 0 #8e6843,0 0 0 2px #e7c461; }
.world-tab:nth-child(2).selected { background:linear-gradient(#4a98b0,#225f77); border-color:#184657; box-shadow:inset 0 2px 0 #d1ebf1,0 3px 0 #426471,0 0 0 2px #e7c461; }
.world-tab:not(.selected) { opacity:.77; }
.tab-avatar { width:43px; height:43px; border-radius:5px; object-fit:cover; border:2px solid #fff7; }
.world-tab strong { font-size:18px; font-family:'Trebuchet MS',Arial,sans-serif; font-weight:900; }
.world-tab small { color:#fff9e8; margin-top:2px; font-size:10px; text-shadow:none; }
.world-tab small b { color:#fff; font-weight:900; }
.picker-heading { min-height:42px; padding:2px 3px; }
.picker-heading h2 { color:#795024; font-size:19px; letter-spacing:-.5px; }
.picker-heading p { color:#81704b; font-size:11px; }
.level-grid { gap:9px; }
.level-btn { border:2px solid #698c97; border-radius:7px; background:#fff9e9; box-shadow:0 2px 0 #8c6e3a44,inset 0 0 0 1px #fff; }
.level-btn.current { border:3px solid #ffbf28; box-shadow:0 0 0 2px #fff5b8,0 0 14px #ffca2aa0; }
.level-btn.completed { border-color:#2b9d62; }
.level-btn:hover:not(:disabled) { border-color:#ffb227; }
.level-thumb { background:#ece9d1; }
.level-btn.locked .level-thumb img { filter:saturate(.5); opacity:.64; }
.level-number { background:#203744e8; color:#fff; font-size:18px; border:1px solid #fff; text-shadow:0 1px 2px #000; width:28px; height:28px; left:5px; top:5px; border-radius:4px; }
.card-state { background:#4c6d75dd; border:1px solid #fff; color:white; width:26px; height:26px; padding:4px; }
.level-btn.current .card-state { background:#349ce8; color:#fff; border:2px solid #fff; box-shadow:0 2px 6px #0004; width:36px; height:31px; }
.level-btn.completed .card-state { background:#249d60; color:#fff; }
.level-caption { background:#fff8e7; color:#4f533c; height:25px; font-size:11px; }
.sketch-tag { color:#786c55; background:#e9dfc6; border-radius:2px; padding:1px 3px; font-size:8px; flex:0 0 auto; }
.bonus-chip { background:#ffc527; color:#704a0c; border:1px solid #fff9a7; font-size:10px; box-shadow:0 2px 0 #995c1744; }
.level-btn.bonus { border-color:#da9319; }
.level-btn.bonus .level-caption { background:#ffdc76; color:#6e4b15; }
.level-stars { display:flex; gap:2px; position:absolute; bottom:5px; left:5px; filter:drop-shadow(0 1px 1px #0005); }
.level-stars svg { width:17px; height:17px; color:#e0e2dccc; stroke:#627980; stroke-width:1.2; }
.level-stars svg.earned { color:#ffd541; stroke:#975a08; }
.pagination { padding-top:2px; }
.pagination .btn { min-width:102px; }
.page-btn { width:42px; height:42px; background:#c7d6ba; border:2px solid #7a9868; color:#4c6b3e; box-shadow:inset 0 2px 0 #fff8; border-radius:5px; }
.page-btn.selected { background:linear-gradient(#ffe574,#ffb82c); color:#6b4a16; border-color:#b5832f; }
#pageLabel { color:#806336; font-weight:800; }
.app-footer { color:#f7ffee; text-shadow:0 1px 2px #273c14; font-size:10px; font-weight:700; min-height:13px; }
body[data-screen='game'] #app { width:min(1400px,calc(100% - 24px)); }
body[data-screen='game'] .topbar { min-height:56px; }
body[data-screen='game'] h1 img { height:55px; }
body[data-screen='game'] .tagline { display:none; }
body[data-screen='game'] .garden-side { opacity:.45; }
#gameScreen { background:linear-gradient(110deg,#fff9e8fc,#fff4d8fc); }
#levelTitle { color:#614424; font-size:22px; }
.world-line { color:#7d7c5b; }
.stat { background:#e3e7c3; border:1px solid #b5bb87; border-radius:5px; }
.stat > span { color:#757854; }
.stat > strong { color:#375e40; }
.lives-stat { background:#fff0d5; border-color:#dcb596; }
.lives-display img { width:25px; height:24px; }
.lives-display img.empty { opacity:.25; }
.bonus-label { color:#825d16; background:#ffe285; }
.canvas-wrap { background:#fffdf2; border-color:#b3a57e; box-shadow:0 3px 10px #66461925; border-radius:5px; }
.canvas-label { color:#826339; font-size:10px; }
canvas { touch-action:none; background:#f9f2dc; }
canvas.zoomed { cursor:grab; }
canvas.dragging { cursor:grabbing; }
.message-bar { background:#efead7; color:#5f624e; border-color:#c8c1a6; font-size:12px; }
.message-bar.success { color:#246b34; background:#e1edc8; }
.message-bar.miss { color:#a54648; background:#fff0da; }
.overlay { background:#253d2ea1; -webkit-backdrop-filter:blur(5px); backdrop-filter:blur(5px); }
.overlay-card { background:linear-gradient(#fffce8,#ffedbf); border:3px solid #ad7926; box-shadow:0 0 0 2px #ffe898,0 20px 65px #1d3c3566; border-radius:10px; }
.overlay-card h2 { font-family:'Trebuchet MS',Arial,sans-serif; font-weight:900; color:#6e4b24; font-size:28px; }
.overlay-card p { color:#7b6d4c; }
.result-stars { display:flex; justify-content:center; gap:6px; }
.result-stars svg { width:50px; height:50px; color:#d6d9c5; stroke:#839381; stroke-width:1; }
.result-stars svg.earned { color:#ffca2b; stroke:#ac710a; filter:drop-shadow(0 3px 0 #d59c23); }
.result-stars svg:nth-child(2) { transform:translateY(-6px) scale(1.16); }
.all-levels-banner { display:inline-block; margin:14px auto 4px; padding:6px 20px; border:2px solid #b27718; border-radius:999px; background:linear-gradient(115deg,#fff8b4,#ffd452,#fff0a0); color:#704214; box-shadow:0 4px 0 #b27718,0 10px 20px #7f4a1733; font-size:clamp(18px,3vw,24px); font-weight:900; letter-spacing:.03em; }
.overlay.all-levels-complete .overlay-card { width:min(510px,100%); border-color:#d79d23; box-shadow:0 0 0 3px #fff1ad,0 20px 65px #1d3c3566; }
.overlay.all-levels-complete #completeTitle { font-size:clamp(28px,5vw,38px); color:#80521b; }
.settings-card { width:min(480px,100%); max-height:calc(var(--viewport-h) - 24px); overflow:auto; text-align:left; padding:18px; }
.settings-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.settings-heading h2 { font-size:23px; margin:0; }
.audio-status { margin:9px 0; font-size:12px!important; min-height:18px; }
.volume-row { display:block; margin:11px 0; font-weight:800; color:#695732; }
.volume-row span { display:flex; justify-content:space-between; margin-bottom:2px; font-size:14px; }
.volume-row b { font-weight:500; font-size:12px; }
.volume-row input { width:100%; accent-color:#2caa4d; height:32px; margin:0; cursor:pointer; }
.sound-check { display:flex; gap:8px; margin:8px 0 13px; }
.sound-check select { flex:1; min-width:0; font:inherit; font-size:13px; color:#4b5742; border:1px solid #a4aa7e; background:#fffae9; border-radius:4px; padding:5px; }
.howto { border-top:1px solid #d7c597; padding-top:10px; font-size:13px; }
.howto p { margin-top:4px; line-height:1.55; font-size:12px; }
.prototype-tools { display:flex; align-items:center; gap:5px; flex-direction:column; margin-top:12px; }
.prototype-tools small { font-size:10px; color:#867654; }
.studio-link { border-top:1px solid #d7c597; margin:14px 0 0; padding-top:11px; text-align:center; font-size:11px!important; }
.studio-link a { color:#176695; font-weight:800; text-decoration:underline; text-underline-offset:2px; }
.studio-link a:focus-visible { outline:3px solid #176695; outline-offset:3px; }
@media (max-width:1100px) {
 #app { width:calc(100% - 120px); }
 .topbar { min-height:87px; }
 h1 img { height:78px; }
 .header-actions { gap:6px; }
 .world-tab strong { font-size:16px; }
}
@media (max-width:760px) {
 #app,body[data-screen='game'] #app { width:calc(100% - 16px); }
 .garden-side { opacity:.6; }
 .topbar { min-height:70px; gap:8px; }
 h1 img { height:65px; }
 .tagline { display:none; }
 .world-tab strong { font-size:15px; }
 .collection-count { padding:8px; font-size:13px; gap:4px; }
 .icon-btn { width:43px; height:43px; min-height:43px; padding:7px; }
 .icon-btn svg { width:23px; height:23px; }
 .picker-heading h2 { font-size:17px; }
 .game-tools .btn { font-size:12px; padding:7px 9px; }
}
@media (max-width:560px) {
 #app,body[data-screen='game'] #app { margin:6px auto; width:calc(100% - 12px); height:calc(var(--viewport-h) - 12px); gap:6px; }
 .topbar { min-height:58px; grid-template-columns:max-content minmax(0,1fr) max-content; gap:5px; }
 h1 img { width:100%; max-width:235px; height:auto; max-height:67px; }
 body[data-screen='game'] h1 img { width:100%; height:auto; max-height:54px; }
 .header-actions { gap:5px; }
 .collection-count { font-size:11px; padding:6px 5px; gap:2px; }
 .collection-count svg { width:15px; height:18px; }
 #openWorldsBtn { width:44px; min-height:43px; padding:7px; }
 #openWorldsBtn span { display:none; }
 .world-tabs { gap:7px; }
 .world-tab { gap:6px; padding:4px 6px; min-height:50px; }
 .world-tab strong { font-size:12px; }
 .tab-avatar { width:29px; height:34px; }
 .world-tab small { font-size:9px; gap:8px; }
 .panel { padding:6px; border-width:2px; }
 .picker-heading h2 { font-size:15px; }
 .picker-heading p { font-size:10px; }
 .picker-heading .btn { font-size:11px; padding:6px; gap:4px; }
 .level-grid { gap:6px; }
 .level-caption { font-size:10px; }
 .level-grid.small-cards .level-caption { height:20px; }
 .level-stars svg { width:13px; height:13px; }
 .level-stars { gap:0; left:3px; bottom:3px; }
 .level-grid.small-cards .card-state { width:22px; height:22px; }
 .pagination .btn { min-width:44px; min-height:44px; }
 .page-btn { width:40px; height:40px; }
 .game-tools { gap:4px; }
 .game-tools .btn { min-height:44px; min-width:0; gap:4px; font-size:11px; padding:6px; }
 .game-tools .btn svg { width:17px; height:17px; }
 .lives-display img { width:21px; height:20px; }
 .stat { padding:4px 6px; }
 #levelTitle { font-size:18px; }
 #restartBtn { width:39px; flex:0 0 39px; }
 #restartBtn span { display:none; }
 .bonus-label { font-size:8px; }
 .message-bar { font-size:10px; }
 .app-footer { font-size:9px; }
 .settings-card { padding:14px; }
 .settings-heading h2 { font-size:20px; }
}
@media (max-height:540px) {
 #app,body[data-screen='game'] #app { height:calc(var(--viewport-h) - 10px); margin:5px auto; gap:5px; }
 .topbar,body[data-screen='game'] .topbar { min-height:42px; }
 h1 img,body[data-screen='game'] h1 img { height:40px; width:auto; }
 .tagline,.app-footer { display:none; }
 .header-actions .btn { min-height:38px; height:38px; width:40px; }
 .world-tab { min-height:40px; padding:3px 8px; }
 .world-tab strong { font-size:13px; }
 .tab-avatar { width:29px; height:29px; }
 .world-tab small { display:none; }
 .picker-heading { min-height:35px; }
 .picker-heading h2 { font-size:15px; }
 .picker-heading .btn { min-height:38px; }
 .pagination,.pagination .btn { min-height:38px; }
 .page-btn { width:36px; height:36px; }
 .game-top { flex-wrap:nowrap; }
 .scene-heading { flex-basis:auto; }
 .game-tools { width:auto; }
 .game-tools .btn { min-height:38px; }
 #levelTitle { font-size:17px; }
 .message-bar { min-height:23px; font-size:10px; }
 .settings-card { padding:12px; }
 .settings-heading h2 { font-size:20px; }
 .volume-row { margin:4px 0; }
 .howto p { font-size:11px; }
 .prototype-tools { margin-top:8px; }
}
@media (max-width:640px) and (max-height:540px) {
 .game-top { flex-wrap:wrap; }
 .scene-heading { flex-basis:100%; display:flex; gap:8px; align-items:center; }
 .game-tools { width:100%; }
 #levelTitle { font-size:15px; }
 .picker-heading h2 { display:none; }
 .world-tab strong { font-size:11px; }
}
@media (max-width:350px) {
 .topbar { grid-template-columns:max-content minmax(0,1fr) max-content; gap:3px; }
 .header-actions .icon-btn { width:38px; height:40px; min-height:40px; }
 .tab-avatar { width:25px; height:30px; }
 .world-tab strong { font-size:11px; }
 .game-tools .btn svg { width:16px; }
 .game-tools .stat { padding:4px; }
 .lives-display img { width:18px; }
 .game-tools #zoomBtn { flex:0 0 36px; }
 #zoomLabel { display:none; }
}


/* Splash screen */
.splash-screen {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background-color: #f6e4bf;
  background-image: radial-gradient(circle at 50% 35%, #fffbe8, #ffedc1 45%, #efd39b 75%, #c1a377 100%);
  opacity: 1; outline: none;
}
/* The covered game is also hidden, including during the closing transition. */
body.splash-active #app, body.splash-active .garden-scenery { visibility: hidden; }
.splash-screen.closing { opacity: 1; }
.splash-screen.closing .splash-card { opacity: 0; }
.splash-card {
  text-align: center; padding: 22px 26px 18px;
  border-radius: 14px; border: 3px solid #b37822;
  background: linear-gradient(180deg, #fffdf0, #fff0c2);
  box-shadow: 0 0 0 2px #ffe898, 0 16px 50px rgba(42,31,8,.28);
  animation: splashBob 1.15s ease-in-out infinite alternate;
  transition: opacity .2s ease; max-width: 100%;
}
.splash-logo { display: block; width: min(560px, 80vw); max-width: 100%; height: auto; user-select: none; }
.splash-text {
  margin-top: 10px; font-size: clamp(17px, 2.6vw, 26px); font-weight: 900; letter-spacing: .4px;
  color: #7a5528; text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.studio-credit { margin:8px 0 0; color:#765e43; font-size:clamp(11px, 1.6vw, 15px); font-weight:700; letter-spacing:.02em; }
.studio-credit span { color:#305f7a; font-weight:900; }
@keyframes splashBob {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-4px) scale(1.012); }
}
@media (prefers-reduced-motion: reduce) {
  .splash-screen, .splash-card { transition: none !important; animation: none !important; }
}

body[data-screen='picker'] .garden-side { opacity:.42; }
body[data-screen='game'] .garden-side { opacity:.26; }
.collection-count { background:#f4edd7cc; color:#6a5536; border-color:#bea873; }
.collection-count svg { color:#b68a2a; }


/* v5 — restore the original full-colour scenery; keep approved burgundy/teal UI. */
.garden-side,
body[data-screen='picker'] .garden-side,
body[data-screen='game'] .garden-side {
  opacity: 1;
  filter: none;
}
/* Only the narrow inner-edge mask blends the two separate scenery cut-outs. */
.canvas-wrap { transform-origin: 50% 50%; }
.game-board.scene-entering .canvas-wrap { will-change: transform, opacity; }
.game-board.scene-entering canvas { pointer-events: none; }

/* Short landscape phones: spend the scarce height on the artwork. The level
   picker scrolls full cards instead of shrinking thumbnails to a thin strip. */
@media (orientation: landscape) and (max-width: 1100px) and (max-height: 540px) and (min-aspect-ratio: 5/2) {
  #app, body[data-screen='game'] #app {
    width: calc(100% - 6px);
    height: calc(var(--viewport-h) - 4px);
    margin: 2px auto;
    gap: 3px;
  }
  .topbar, body[data-screen='game'] .topbar { min-height: 32px; }
  .topbar .brand { display: none; }
  .header-actions .btn, .header-actions .icon-btn { width: 34px; height: 32px; min-height: 32px; padding: 4px; }
  .header-actions .btn svg { width: 20px; height: 20px; }
  .collection-count { min-height: 32px; padding: 3px 7px; font-size: 11px; }
  .collection-count svg { width: 16px; height: 16px; }
  .panel { padding: 4px; }
  .screen.active { gap: 3px; }
  .world-tab { min-height: 34px; padding: 2px 7px; }
  .tab-avatar { width: 28px; height: 28px; }
  .picker-heading { min-height: 29px; padding: 0 2px; }
  .picker-heading h2 { font-size: 13px; }
  .picker-heading p { font-size: 9px; margin-top: 0; }
  .picker-heading .btn { min-height: 28px; padding: 2px 8px; }
  .level-grid {
    grid-template-rows: repeat(var(--grid-rows, 2), 74px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    padding: 2px;
  }
  .level-btn { min-height: 74px; }
  .level-thumb img { object-fit: cover; }
  .pagination, .pagination .btn { min-height: 30px; }
  .pagination .btn { padding: 2px 8px; }
  .page-btn { width: 29px; height: 29px; }

  body[data-screen='game'] #app { gap: 0; }
  body[data-screen='game'] .topbar {
    position: absolute;
    z-index: 3;
    top: 5px;
    left: 7px;
    right: 7px;
    min-height: 30px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }
  body[data-screen='game'] .topbar button { pointer-events: auto; }
  body[data-screen='game'] .header-actions .btn { width: 30px; height: 30px; min-height: 30px; }
  body[data-screen='game'] #openWorldsBtn { min-height: 30px; height: 30px; padding: 2px 7px; font-size: 11px; }
  #gameScreen { padding: 3px; gap: 2px; }
  .game-top { min-height: 32px; flex-wrap: nowrap; padding-left: 100px; padding-right: 82px; gap: 4px; }
  .scene-heading { flex: 1 1 105px; min-width: 0; display: block; }
  .world-line { display: none; }
  #levelTitle { font-size: 13px; }
  .game-tools { width: auto; flex: 0 0 auto; gap: 3px; }
  .game-tools .btn { min-height: 30px; height: 30px; padding: 3px 7px; font-size: 11px; }
  .game-tools .btn svg { width: 17px; height: 17px; }
  .stat { min-height: 30px; height: 30px; padding: 2px 5px; gap: 0; }
  .stat > span { display: none; }
  .stat > strong { font-size: 12px; }
  .lives-display img { width: 17px; height: 16px; }
  #restartBtn { width: 31px; flex: 0 0 31px; padding: 3px; }
  #restartBtn span { display: none; }
  .canvas-wrap { padding: 3px; }
  .canvas-label { height: 15px; line-height: 14px; font-size: 9px; }
  .message-bar { min-height: 18px; max-height: 18px; padding: 1px 5px; font-size: 9px; }
}
@media (orientation: landscape) and (min-width: 800px) and (max-width: 1100px) and (max-height: 540px) and (min-aspect-ratio: 7/2) {
  body[data-screen='game'] .topbar { right: auto; width: 24%; }
  body[data-screen='game'] .header-right { position: absolute; left: 0; top: 34px; }
  body[data-screen='game'] #openWorldsBtn { min-width: 80px; }
  #gameScreen { position: relative; }
  .game-top { position: absolute; inset: 0 0 18px; z-index: 2; padding: 0; pointer-events: none; }
  .scene-heading { position: absolute; left: 7px; top: 71px; width: 23%; pointer-events: auto; }
  #levelTitle { white-space: normal; line-height: 1.15; }
  .game-tools { position: absolute; right: 6px; top: 5px; width: 23%; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; pointer-events: auto; }
  .game-tools .btn { width: 100%; }
  .game-tools #restartBtn { grid-column: 1 / -1; width: 100%; }
  .canvas-label { display: none; }
}
@media (orientation: landscape) and (max-width: 740px) and (max-height: 540px) and (min-aspect-ratio: 5/2) {
  .game-top { padding-left: 98px; padding-right: 40px; }
  .scene-heading { display: none; }
  #openWorldsBtn { width: 31px; }
  #openWorldsBtn span { display: none; }
  #zoomLabel { display: none; }
  .game-tools .btn { min-width: 30px; }
}
