/* =============================================================================
   Pink & Whiskers 2: Project Daybreak - interface styles
   Palette taken from the UI design board: deep navy panels, sunny yellow primary
   buttons, hot pink + turquoise accents, white speech boxes.
   --ui-scale / --touch-scale / --touch-opacity are set from Settings (js/ui/ui.js)
   ========================================================================== */
:root {
  --navy: #1E2A5A;
  --navy-2: #2B3A73;
  --navy-3: #3B4D93;
  --edge: #6C82D6;
  --yellow: #FFD23F;
  --yellow-dark: #E0A800;
  --pink: #FF4F9A;
  --teal: #2EC4C6;
  --blue: #3A6FE0;
  --white: #FFFFFF;
  --ink: #1B1F3B;
  --display: 'Fredoka', 'Baloo 2', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --ui-scale: 1;
  --touch-scale: 1;
  --touch-opacity: 0.85;
  --band: 0px;
  /* animation feel - overwritten from config.json -> animation (see js/ui/ui.js) */
  --prompt-bob-speed: 2.6s;
  --prompt-bob-height: 3px;
  --portrait-bob-speed: 3.2s;
  --portrait-bob-height: 3px;
  --portrait-tilt: 0.6deg;
  --bump-scale: 1.12;
  --bump-speed: 0.45s;
  --arrow-bob-speed: 1.6s;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10183A; color: var(--white); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
body { touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
#game-canvas { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - var(--band)); display: block; }
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s; }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); pointer-events: none;
  transform: scale(var(--ui-scale)); transform-origin: top center; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.hero-card { display: flex; align-items: center; gap: 8px; background: rgba(30, 42, 90, .82); border: 2px solid var(--edge); border-radius: 40px 18px 18px 40px; padding: 4px 14px 4px 4px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.hud-portrait { width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--white); object-fit: cover; background: var(--pink); }
.hero-name { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.hearts { display: flex; gap: 3px; margin-top: 2px; }
.heart { width: 22px; height: 20px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21S1 14 1 7a5.5 5.5 0 0 1 11-1.5A5.5 5.5 0 0 1 23 7c0 7-11 14-11 14z' fill='%23FF3B5C' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E"); }
.heart.empty { filter: grayscale(1) brightness(.55); opacity: .7; }
.heart.pop { animation: softpop var(--bump-speed) ease-out; }
@keyframes pop { 50% { transform: scale(1.3); } }
@keyframes softpop { 0% { transform: scale(1); } 45% { transform: scale(var(--bump-scale)); } 100% { transform: scale(1); } }
.mini-portrait { position: relative; width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 3px solid var(--white); background: var(--yellow); overflow: visible; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.mini-portrait img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.mini-portrait .key-chip { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); }
.key-chip { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 7px; background: var(--white); color: var(--navy); font-family: var(--display); font-weight: 700; font-size: 12px; text-align: center; box-shadow: 0 2px 0 #9AA8D8; }
.objective { pointer-events: none; display: flex; align-items: center; gap: 8px; max-width: min(46vw, 420px); margin-top: 4px; background: rgba(30, 42, 90, .85); border: 2px solid var(--edge); border-radius: 16px; padding: 7px 14px 7px 8px; font-family: var(--display); font-weight: 600; font-size: 15px; line-height: 1.2; transition: opacity .5s, transform .5s; }
.objective.faded { opacity: 0; transform: translateY(-8px); }
.obj-icon { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--yellow); color: var(--navy); font-weight: 700; }
.counter { display: flex; align-items: center; gap: 6px; background: rgba(30, 42, 90, .82); border: 2px solid var(--edge); border-radius: 20px; padding: 3px 12px 3px 4px; font-family: var(--display); font-weight: 600; font-size: 16px; min-width: 64px; }
.counter.bump { animation: softpop var(--bump-speed) ease-out; }
.ic { width: 24px; height: 24px; border-radius: 50%; background-size: contain; background-repeat: no-repeat; background-position: center; }
.ic-coin { background-image: url(../assets/textures/coin_paw.png); }
.ic-chip { background-image: url(../assets/textures/chip.png); border-radius: 5px; }
.ic-toy { background: radial-gradient(circle at 35% 35%, #F2C8FF, #B05AF0 70%); }
.round-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--edge); background: var(--navy-2); color: var(--white); font-size: 18px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.round-btn svg { width: 22px; height: 22px; fill: currentColor; }
#fps { position: absolute; left: 8px; bottom: 8px; font: 12px monospace; background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 4px; pointer-events: none; }

/* floating "E  Talk" prompt above interactables (position is smoothed in main.js) */
.prompt { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.prompt-inner { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 16px; background: var(--white); color: var(--navy); font-family: var(--display); font-weight: 600; font-size: 15px; box-shadow: 0 4px 0 rgba(30,42,90,.35); white-space: nowrap; transform: translate(-50%, -100%); animation: promptbob var(--prompt-bob-speed) ease-in-out infinite; }
.prompt .key-chip { background: var(--yellow); box-shadow: none; }
@keyframes promptbob { 0%, 100% { transform: translate(-50%, -100%); } 50% { transform: translate(-50%, calc(-100% - var(--prompt-bob-height))); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
.hint { position: absolute; left: 50%; top: calc(86px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 10px; align-items: center; max-width: min(92vw, 520px); background: var(--white); color: var(--ink); border: 3px solid var(--teal); border-radius: 18px; padding: 8px 14px 8px 8px; box-shadow: 0 5px 0 rgba(30,42,90,.35); pointer-events: none; animation: slidein .3s; }
.hint img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.hint b { font-family: var(--display); color: #1F8A4C; }
.hint p { margin: 1px 0 0; font-weight: 700; font-size: 15px; line-height: 1.3; }
@keyframes slidein { from { opacity: 0; transform: translate(-50%, -10px); } }

#toasts { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--navy); border: 2px solid var(--yellow); border-radius: 16px; padding: 8px 18px; font-family: var(--display); font-weight: 600; font-size: 17px; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.3); animation: toastin .25s ease-out; max-width: 86vw; }
.toast.out { opacity: 0; transform: translateY(-12px); transition: all .4s; }
@keyframes toastin { from { opacity: 0; transform: scale(.8); } }
#caption { position: absolute; left: 50%; bottom: calc(var(--band) + 120px); transform: translateX(-50%); background: rgba(0,0,0,.7); padding: 4px 12px; border-radius: 8px; font-weight: 800; pointer-events: none; }

#stage-card { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: cardin .6s cubic-bezier(.2,1.6,.4,1); }
#stage-card .stage-num { display: inline-block; background: var(--pink); border: 3px solid var(--white); border-radius: 20px; padding: 2px 16px; font-family: var(--display); font-weight: 600; }
#stage-card h2 { margin: 8px 0 2px; font-family: var(--display); font-weight: 700; font-size: clamp(30px, 6vw, 58px); color: var(--yellow); paint-order: stroke fill; -webkit-text-stroke: 8px var(--navy); text-shadow: 0 6px 0 var(--navy); }
#stage-card p { margin: 0; font-family: var(--display); font-weight: 600; font-size: 20px; paint-order: stroke fill; -webkit-text-stroke: 5px var(--navy); }
@keyframes cardin { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }

/* ------------------------------------------------------------------ TOUCH CONTROLS */
#touch-controls { position: absolute; left: 0; right: 0; bottom: 0; height: calc(200px * var(--touch-scale) + var(--safe-b)); display: flex; justify-content: space-between; align-items: flex-end; padding: 0 calc(18px + var(--safe-r)) calc(16px + var(--safe-b)) calc(18px + var(--safe-l)); pointer-events: none; opacity: var(--touch-opacity); }
#touch-controls.lefty { flex-direction: row-reverse; }
#stick { pointer-events: auto; position: relative; width: calc(132px * var(--touch-scale)); height: calc(132px * var(--touch-scale)); border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), rgba(30,42,90,.55)); border: 3px solid rgba(255,255,255,.75); touch-action: none; margin-bottom: 6px; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #C9D3F5); box-shadow: 0 4px 0 rgba(0,0,0,.25); pointer-events: none; }
.touch-buttons { pointer-events: none; display: grid; grid-template-columns: repeat(3, auto); grid-template-rows: auto auto; gap: calc(10px * var(--touch-scale)); align-items: end; justify-items: center; }
.tbtn { pointer-events: auto; touch-action: none; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: calc(66px * var(--touch-scale)); height: calc(66px * var(--touch-scale)); border-radius: 50%; border: 3px solid rgba(255,255,255,.85); background: rgba(43,58,115,.78); color: var(--white); box-shadow: 0 4px 0 rgba(0,0,0,.3); padding: 0; }
.tbtn svg { width: 44%; height: 44%; }
.tbtn span { font-family: var(--display); font-weight: 600; font-size: calc(11px * var(--touch-scale)); line-height: 1; }
.tbtn-small { width: calc(52px * var(--touch-scale)); height: calc(52px * var(--touch-scale)); }
.tbtn-small span { font-size: calc(9.5px * var(--touch-scale)); }
.tbtn-big { width: calc(84px * var(--touch-scale)); height: calc(84px * var(--touch-scale)); background: rgba(255,210,63,.92); color: var(--navy); }
.tbtn.pressed { transform: scale(.92); filter: brightness(1.25); }
.tbtn.ready { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255,210,63,.45), 0 4px 0 rgba(0,0,0,.3); }
.tbtn.dim { opacity: .45; }
#btn-gadget .ic-meow { display: none; }
body.cat #btn-gadget .ic-scan { display: none; }
body.cat #btn-gadget .ic-meow { display: block; }
.touch-buttons [data-action="switch"] { grid-column: 1; grid-row: 1; }
.touch-buttons [data-action="call"] { grid-column: 2; grid-row: 1; }
.touch-buttons [data-action="dodge"] { grid-column: 3; grid-row: 1; }
.touch-buttons [data-action="gadget"] { grid-column: 1; grid-row: 2; }
.touch-buttons [data-action="interact"] { grid-column: 2; grid-row: 2; }
.touch-buttons [data-action="jump"] { grid-column: 3; grid-row: 2; }

/* portrait phones: gameplay on top, a solid thumb band at the bottom */
body.portrait.touch #touch-controls { height: var(--band); align-items: center; opacity: 1; background: linear-gradient(180deg, #24336E, #172150); border-top: 3px solid var(--edge); padding-top: 8px; }
body.portrait.touch #touch-controls .tbtn { background: var(--navy-3); }
body.portrait.touch #touch-controls .tbtn-big { background: var(--yellow); }
body.portrait #hud { flex-wrap: wrap; }
body.portrait .objective { order: 3; max-width: 100%; flex-basis: 100%; justify-content: flex-start; font-size: 14px; margin-top: 6px; }
body.portrait .counter { min-width: 0; padding-right: 8px; font-size: 14px; }
body.portrait .counter .ic { width: 20px; height: 20px; }
body.portrait .hero-card { padding-right: 10px; }
body.portrait .hud-portrait { width: 46px; height: 46px; }
body.portrait .hint { top: auto; bottom: calc(var(--band) + 12px); }
body.portrait #toasts { top: 36%; }

/* ------------------------------------------------------------------ DIALOGUE */
#dialogue { position: absolute; left: 0; right: 0; bottom: calc(var(--band) + 14px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); }
body.portrait.touch #dialogue { bottom: calc(var(--band) + 10px); }
#dlg-portrait { width: 112px; height: 112px; border-radius: 22px; border: 4px solid var(--white); object-fit: cover; background: var(--pink); box-shadow: 0 5px 0 rgba(30,42,90,.5); flex: none; animation: portraitbob var(--portrait-bob-speed) ease-in-out infinite; will-change: transform; }
@keyframes portraitbob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(calc(var(--portrait-bob-height) * -1)) rotate(calc(var(--portrait-tilt) * -1)); } }
.dlg-box { position: relative; flex: 0 1 680px; min-height: 108px; background: var(--white); color: var(--ink); border: 4px solid var(--blue); border-radius: 20px; padding: 26px 22px 16px; box-shadow: 0 6px 0 rgba(30,42,90,.45); cursor: pointer; }
.name-tag { position: absolute; top: -18px; left: 16px; background: var(--blue); color: var(--white); border: 3px solid var(--white); border-radius: 12px; padding: 2px 14px; font-family: var(--display); font-weight: 600; font-size: 17px; }
#dlg-text { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.38; min-height: 2.7em; }
.dlg-next { position: absolute; right: 16px; bottom: 10px; width: 0; height: 0; border: 9px solid transparent; border-top: 12px solid var(--blue); border-bottom: 0; animation: bob var(--arrow-bob-speed) ease-in-out infinite; }
#dlg-skip { position: absolute; right: calc(16px + var(--safe-r)); top: -50px; }
body.portrait #dlg-portrait { width: 72px; height: 72px; border-radius: 16px; }
body.portrait #dlg-text { font-size: 16px; }
body.portrait .dlg-box { padding: 22px 14px 14px; min-height: 96px; }

/* ------------------------------------------------------------------ SHEETS (hack + notes) */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 16, 44, .62); padding: 16px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.sheet { width: min(560px, 94vw); max-height: 92vh; overflow: auto; background: var(--navy); border: 4px solid var(--edge); border-radius: 26px; padding: 18px 20px 20px; box-shadow: 0 8px 0 rgba(0,0,0,.35); }
.sheet h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 24px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet-head > div { flex: 1; }
.sheet-head p { margin: 2px 0 0; font-weight: 700; color: #C9D3F5; }
.sheet-portrait { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--teal); object-fit: cover; }
.hack-board { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; --cell: min(78px, calc((88vw - 90px) / var(--hack-n)), calc((60vh) / var(--hack-n))); }
#hack-grid { display: grid; grid-template-columns: repeat(var(--hack-n), var(--cell)); gap: 6px; padding: 8px; background: #121A40; border-radius: 16px; border: 3px solid #33437E; }
.hack-tile { width: var(--cell); height: var(--cell); padding: 6px; border-radius: 12px; border: 2px solid #3B4D93; background: #1B2556; }
.hack-tile svg { width: 100%; height: 100%; transform: rotate(var(--rot)); transition: transform .18s cubic-bezier(.3,1.5,.5,1); }
.hack-tile .pipe { stroke: #7C88B8; stroke-width: 16; stroke-linecap: round; fill: #7C88B8; }
.hack-tile.lit { background: #183E5E; border-color: var(--teal); }
.hack-tile.lit .pipe { stroke: #6FF3FF; fill: #FFFFFF; filter: drop-shadow(0 0 5px #6FF3FF); }
.plug, .socket { position: relative; align-self: stretch; width: 26px; }
.plug::after, .socket::after { content: ''; position: absolute; left: 0; width: 26px; height: calc(var(--cell) * .5); top: calc(8px + 3px + var(--row) * (var(--cell) + 6px) + var(--cell) * .25); border-radius: 8px; }
.plug::after { background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.socket::after { background: #4A5578; border: 3px dashed #9AA8D8; }
.socket.lit::after { background: #6FF3FF; border-style: solid; box-shadow: 0 0 16px #6FF3FF; }
#hack.success .hack-sheet { animation: pop .5s; border-color: var(--teal); }
#hack-skip { margin: 14px auto 0; display: block; }
.note-sheet { text-align: left; border-color: var(--teal); }
.note-kind { display: inline-block; background: var(--teal); color: var(--navy); font-family: var(--display); font-weight: 600; padding: 2px 12px; border-radius: 10px; margin-bottom: 8px; }
#note-text { font-size: 18px; line-height: 1.5; font-weight: 700; color: #E8ECFF; max-width: 60ch; }

/* ------------------------------------------------------------------ SCREENS */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.screen-title { padding: 0; background: #2A3270; overflow: hidden; justify-content: flex-end; }
.splash-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 30% 50%; user-select: none; }
.splash-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(24,28,80,0) 45%, rgba(24,28,80,.28) 72%, rgba(24,28,80,.5)); }
.title-side { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-right: clamp(20px, 6vw, 110px); padding: calc(16px + var(--safe-t)) calc(8px + var(--safe-r)) calc(16px + var(--safe-b)) 8px; max-height: 100%; }
.logo-wrap { margin: 0; line-height: 0; }
.logo-img { display: block; width: clamp(240px, 32vw, 500px); height: auto; transform: rotate(-1.5deg); filter: drop-shadow(0 8px 0 rgba(20,22,70,.35)) drop-shadow(0 0 18px rgba(255,255,255,.25)); }
.loadbar { width: min(340px, 70vw); height: 18px; border-radius: 10px; background: rgba(20,24,64,.7); border: 3px solid var(--white); overflow: hidden; margin-top: 8px; }
#loadbar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--yellow)); transition: width .2s; }
#loading-text { margin: 0; font-family: var(--display); font-weight: 600; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; width: min(320px, 80vw); }
.menu-buttons.row { flex-direction: row; justify-content: center; width: auto; }
.pill-btn { min-height: 48px; padding: 8px 24px; border-radius: 26px; border: 3px solid var(--edge); background: var(--navy-2); color: var(--white); font-family: var(--display); font-weight: 600; font-size: 19px; box-shadow: 0 4px 0 #121A40; transition: transform .1s, background .15s; }
.pill-btn:hover { background: var(--navy-3); }
.pill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #121A40; }
.pill-btn.primary { background: var(--yellow); color: var(--navy); border-color: #FFF0B0; box-shadow: 0 4px 0 var(--yellow-dark); }
.pill-btn.primary:hover { background: #FFDD66; }
.pill-btn.danger { background: #8A2B4A; border-color: #E86A8F; margin-top: 10px; }
.pill-btn.small { min-height: 36px; padding: 4px 16px; font-size: 15px; }

.screen-panel { background: rgba(14, 20, 52, .72); backdrop-filter: blur(3px); }
.panel { width: min(860px, 96vw); max-height: 92vh; overflow: auto; background: var(--navy); border: 4px solid var(--edge); border-radius: 30px; padding: 18px 22px 22px; box-shadow: 0 10px 0 rgba(0,0,0,.35); }
.panel.narrow { width: min(460px, 94vw); text-align: center; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 28px; }
.panel.narrow .menu-buttons { margin: 14px auto 0; }

.stage-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.stage-card { position: relative; text-align: left; padding: 12px 14px 12px 64px; min-height: 92px; border-radius: 20px; border: 3px solid var(--edge); background: var(--navy-2); box-shadow: 0 4px 0 #121A40; }
.stage-card .num { position: absolute; left: 12px; top: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); border: 3px solid var(--white); font-family: var(--display); font-weight: 700; font-size: 20px; }
.stage-card h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 18px; }
.stage-card p { margin: 2px 0 6px; color: #C9D3F5; font-weight: 700; font-size: 14px; }
.stage-card .meta { font-size: 13px; font-weight: 800; color: var(--yellow); }
.stage-card.locked { opacity: .5; cursor: not-allowed; }
.stage-card.locked .num { background: #555C80; }
.stage-card.done .num { background: var(--teal); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { padding: 6px 16px; border-radius: 14px; border: 2px solid var(--edge); background: var(--navy-2); font-family: var(--display); font-weight: 600; }
.tab.active { background: var(--pink); border-color: var(--white); }
.notes-list { display: grid; gap: 10px; }
.note-item { background: var(--navy-2); border-radius: 16px; padding: 10px 14px; border-left: 6px solid var(--teal); }
.note-item h4 { margin: 0 0 4px; font-family: var(--display); font-weight: 600; }
.note-item p { margin: 0; font-weight: 700; color: #DCE2FF; line-height: 1.45; }
.note-item.locked { border-left-color: #555C80; color: #9AA3C8; }
.toys-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.toy-item { text-align: center; padding: 14px 8px; border-radius: 18px; background: var(--navy-2); font-family: var(--display); font-weight: 600; }
.toy-item .ball { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #F2C8FF, #B05AF0 70%); }
.toy-item.locked .ball { filter: grayscale(1) brightness(.5); }
.empty { color: #C9D3F5; font-weight: 700; }

.settings { display: grid; gap: 14px; max-width: 520px; }
.settings label { display: grid; gap: 6px; font-weight: 800; }
.settings label.toggle { display: flex; align-items: center; gap: 10px; }
.settings input[type=range] { width: 100%; accent-color: var(--yellow); height: 28px; }
.settings input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--pink); }

.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.howto h3 { font-family: var(--display); font-weight: 600; margin: 0 0 8px; color: var(--yellow); }
.howto dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-weight: 700; }
.howto dt { text-align: right; }
.howto dd { margin: 0; color: #DCE2FF; }
.tips { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-weight: 700; color: #DCE2FF; line-height: 1.4; }

.clear-panel h2 { font-size: 36px; color: var(--yellow); }
.clear-burst { height: 6px; }
.clear-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.stat { background: var(--navy-2); border-radius: 14px; padding: 8px; }
.stat b { display: block; font-family: var(--display); font-size: 22px; color: var(--white); }
.stat span { font-weight: 800; color: #C9D3F5; font-size: 13px; }
.stamps { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 10px; }
.stamp { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; text-align: center; padding: 10px; font-family: var(--display); font-weight: 600; font-size: 13px; line-height: 1.1; color: var(--navy); background: var(--yellow); border: 4px dashed var(--white); transform: rotate(-8deg); animation: stampin .5s cubic-bezier(.2,1.6,.4,1) both; }
.stamp.off { background: #3B4570; color: #8B93B8; animation: none; transform: none; }
@keyframes stampin { from { transform: scale(2.2) rotate(-30deg); opacity: 0; } }
.ending-panel { text-align: center; }
.ending-panel blockquote { margin: 14px auto; max-width: 52ch; font-size: 20px; font-weight: 800; line-height: 1.5; color: var(--yellow); }
.credits { color: #C9D3F5; font-weight: 700; }
.small-print { color: #C9D3F5; font-weight: 700; line-height: 1.5; }
code { background: #121A40; padding: 1px 6px; border-radius: 6px; }

/* portrait layouts for menus */
@media (orientation: portrait) {
  .screen-title { justify-content: center; align-items: stretch; }
  .splash-bg { object-position: 22% 50%; }
  .splash-shade { background: linear-gradient(180deg, rgba(24,28,80,.15) 0%, rgba(24,28,80,0) 30%, rgba(24,28,80,0) 50%, rgba(24,28,80,.55) 100%); }
  .title-side { margin: 0; width: 100%; height: 100%; justify-content: space-between; padding: calc(18px + var(--safe-t)) 16px calc(22px + var(--safe-b)); }
  .logo-img { width: min(82vw, 420px); }
  .menu-buttons { gap: 8px; margin-top: 10px; }
  .pill-btn { min-height: 46px; font-size: 18px; }
  .howto { grid-template-columns: 1fr; }
  .panel { max-height: 94vh; padding: 14px; border-radius: 22px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .logo-img { width: clamp(200px, 30vw, 340px); }
  .menu-buttons { gap: 6px; margin-top: 8px; }
  .pill-btn { min-height: 40px; font-size: 16px; padding: 4px 18px; }
  #dlg-portrait { width: 80px; height: 80px; }
  .dlg-box { min-height: 88px; padding: 22px 16px 12px; }
  #dlg-text { font-size: 16px; }
  .hud-portrait { width: 46px; height: 46px; }
}
/* Devices with "reduce motion" turned on: stop looping animations completely.
   (Shortening them while they keep looping made them flicker/shake.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
