/* donnymeow's vals: one stylesheet for every page. No inline styles (the CSP blocks them).
   Themes are set on <html data-theme="day|golden|night|halloween|christmas|thanksgiving"> by src/ui/theme-init.js.
   Every colour is a variable in the theme blocks below; the rest of the file only uses variables.

   PIXEL STYLE: boxes have no rounded corners. Instead a "pixel frame" is drawn with four
   box-shadows offset by --px (which leaves the corners notched, like pixel art) plus a solid
   drop shadow underneath. Elements set --f (frame colour) and --d (drop colour). */

/* Leave digits to the regular font in the fallback stack. */
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-10FFFF;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-10FFFF;
}
/* Page fonts (core/dogpage.js FONTS): one @font-face per font, named by its `family`. Licences sit next to the files. */
@font-face {
  font-family: "BoldPixels";
  src: url("fonts/boldpixels.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-10FFFF;
}

/* ------------------------------------------------------------ themes */

:root, [data-theme="day"] {
  --bg: #fdf8f0;
  --surface: #fffdf9;
  --surface-2: #f6eee2;
  --frame: #ecdfcc;
  --drop: #e4d4bd;
  --text: #3b3029;
  --muted: #94857a;
  --accent: #cf6a3c;
  --btn: #df7a48;
  --btn-frame: #b65a2f;
  --btn-text: #ffffff;
  --good: #2e9a5d;
  --good-soft: #dcf4e6;
  --add: #4caf6e;
  --add-frame: #2f8a50;
  --warn: #c47500;
  --warn-soft: #fff0d0;
  --bad: #df4339;
  --bad-soft: #fde3e0;
  --gift-colors: #ad2759, #984500, #156641, #154c98, #6634a3, #ad2759;
  --mint: #8fe3c8;
  --pink: #f6a8c6;
  --lavender: #c4abf3;
  --sky: #a9c8f8;
  --header-text: #ffffff;
  --outline: #23284a;
  --sky-1: #5b8ff0; --sky-mid: #5f97f2; --sky-2: #64a0f4; --stars: #ffffff; --sun: #ffd65a;
  --mtn-far: #6c6fe0; --mtn-near: #6cc24f; --sand: #f2e3b3; --water: #5a9df4; --sparkle: #9ccbff;
  color-scheme: light;
}

[data-theme="golden"] {
  /* Dusk: dim and warm, easy on the eyes. */
  --bg: #2a2030;
  --surface: #342839;
  --surface-2: #3e3043;
  --frame: #56405a;
  --drop: #1b1320;
  --text: #f5e6dc;
  --muted: #bda3a2;
  --accent: #f29a6a;
  --btn: #d9744a;
  --btn-frame: #9c4d30;
  --btn-text: #ffffff;
  --good: #7ed39a;
  --good-soft: #23382c;
  --add: #3f9a62;
  --add-frame: #26663e;
  --warn: #ffbf6e;
  --warn-soft: #403024;
  --bad: #ff8d86;
  --bad-soft: #472631;
  --mint: #4d8a71;
  --pink: #9c5874;
  --lavender: #7a5ea3;
  --sky: #7b5672;
  --header-text: #fff2e8;
  --outline: #1a1020;
  --sky-1: #3d2f63; --sky-mid: #5b3a6b; --sky-2: #8e4f68; --stars: #ffe3c4; --sun: #f6b25a;
  --mtn-far: #2f2340; --mtn-near: #2f2340; --sand: #2f2340; --water: #3b2c55; --sparkle: #c9786a;
  color-scheme: dark;
}

[data-theme="night"] {
  --bg: #182038;
  --surface: #202946;
  --surface-2: #283253;
  --frame: #333f66;
  --drop: #10162b;
  --text: #f3ede3;
  --muted: #a7a3b8;
  --accent: #f2a46e;
  --btn: #d9784a;
  --btn-frame: #9c5130;
  --btn-text: #ffffff;
  --good: #6ddb98;
  --good-soft: #1b3a34;
  --add: #3a9a62;
  --add-frame: #236b41;
  --warn: #ffc861;
  --warn-soft: #3b3324;
  --bad: #ff8a83;
  --bad-soft: #42262f;
  --mint: #3f8a76;
  --pink: #9a5577;
  --lavender: #7660a8;
  --sky: #4a6aa6;
  --header-text: #f4f2ff;
  --outline: #0b0e1d;
  --sky-1: #1f1d31; --sky-mid: #201e33; --sky-2: #222035; --stars: #8a86a8; --sun: #ffd65a;
  --mtn-far: #2e2b3d; --mtn-near: #2e2b3d; --sand: #2e2b3d; --water: #1b2a52; --sparkle: #34497f;
  color-scheme: dark;
}

/* Seasonal themes (picked by hand). Each adds colours for its own scene extras. */
[data-theme="halloween"] {
  /* Spooky purple dusk with pumpkin orange. */
  --bg: #1f1428;
  --surface: #2a1c35;
  --surface-2: #33223f;
  --frame: #4a3159;
  --drop: #120a18;
  --text: #f6ead8;
  --muted: #b39fb4;
  --accent: #ff9a3c;
  --btn: #e8792b;
  --btn-frame: #a44f14;
  --btn-text: #ffffff;
  --good: #8fdc8a;
  --good-soft: #213826;
  --add: #3f9a62;
  --add-frame: #26663e;
  --warn: #ffc35c;
  --warn-soft: #3d2c1f;
  --bad: #ff7d7d;
  --bad-soft: #45202c;
  --mint: #4a8a6a;
  --pink: #9c5874;
  --lavender: #8a5fb8;
  --sky: #6b4d8a;
  --header-text: #fff1dc;
  --outline: #120a18;
  --sky-1: #2a1840; --sky-mid: #3e1f52; --sky-2: #5d2a5c; --stars: #ffd9a0; --sun: #ffd65a;
  --mtn-far: #1d1228; --mtn-near: #1d1228; --sand: #1d1228; --water: #2a1a3c; --sparkle: #8a4a3a;
  --moon: #ffe6a8; --pumpkin: #ff8a2a;
  color-scheme: dark;
}

[data-theme="christmas"] {
  /* Cosy snowy night: pine green with a warm red. */
  --bg: #14262b;
  --surface: #1b3138;
  --surface-2: #223b43;
  --frame: #2f4f58;
  --drop: #0b171b;
  --text: #f2f5f0;
  --muted: #9fb5b0;
  --accent: #ff6f61;
  --btn: #d9483f;
  --btn-frame: #962a24;
  --btn-text: #ffffff;
  --good: #7fdc9f;
  --good-soft: #1b3a30;
  --add: #3f9a62;
  --add-frame: #26663e;
  --warn: #ffd36b;
  --warn-soft: #3a3424;
  --bad: #ff8a83;
  --bad-soft: #45262c;
  --mint: #3f8a76;
  --pink: #a2546a;
  --lavender: #6f68a8;
  --sky: #4a7a8a;
  --header-text: #ffffff;
  --outline: #0a1518;
  --sky-1: #1a2547; --sky-mid: #1f2d55; --sky-2: #263763; --stars: #ffffff; --sun: #ffd65a;
  --mtn-far: #3b4c80; --mtn-near: #d4e2f2; --sand: #eef4fb; --water: #6f97c8; --sparkle: #d6e8ff;
  --snow: #ffffff; --tree: #1e5a42;
  color-scheme: dark;
}

[data-theme="thanksgiving"] {
  /* Warm autumn evening, dim like Sunrise/Sunset: cocoa brown with harvest orange. */
  --bg: #2a1e18;
  --surface: #34261e;
  --surface-2: #3e2e24;
  --frame: #5a4232;
  --drop: #1a120d;
  --text: #f6e8d8;
  --muted: #c0a48c;
  --accent: #f0a050;
  --btn: #d4682b;
  --btn-frame: #9e4a1c;
  --btn-text: #ffffff;
  --good: #8fd49a;
  --good-soft: #24362a;
  --add: #3f9a62;
  --add-frame: #26663e;
  --warn: #ffc35c;
  --warn-soft: #3d2e1f;
  --bad: #ff8a76;
  --bad-soft: #45261f;
  --mint: #4d8a6a;
  --pink: #9c6058;
  --lavender: #7a6098;
  --sky: #8a5a3a;
  --header-text: #fff1e0;
  --outline: #1a100a;
  --sky-1: #5e3438; --sky-mid: #7a4038; --sky-2: #a2573c; --stars: #ffe3c4; --sun: #f6c070;
  --mtn-far: #4e2822; --mtn-near: #6e3a20; --sand: #7e5a34; --water: #3a5070; --sparkle: #c98a50;
  --leaf-1: #d0503a; --leaf-2: #e8a838;
  color-scheme: dark;
}

[data-theme="golden"], [data-theme="night"], [data-theme="halloween"], [data-theme="christmas"], [data-theme="thanksgiving"] {
  --gift-colors: #ffa1bb, #ffd075, #8de0ab, #89d5ff, #d0b7ff, #ffa1bb;
}

:root, [data-theme] {
  --unit-bg: var(--btn);
  --unit-frame: var(--btn-frame);
  --unit-active-text: var(--btn-text);
  --unit-surface: var(--surface);
  --unit-text: var(--text);
  --unit-muted: var(--muted);
  --unit-focus: var(--accent);
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --px: 2px; --guess: #f2c200; --rose: #d9566f;
  --number-font: Arial, system-ui, sans-serif;
  --font: "Pixelify Sans", var(--number-font);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 var(--font);
  transition: background-color 0.6s, color 0.6s;
}
main, .site-footer { max-width: 1100px; margin: 0 auto; padding: 0 18px; }
main { padding-top: 26px; }
h1, h2, h3 { font-weight: 700; }
h2 { font-size: 1.25rem; margin: 0 0 10px; }
a { color: var(--accent); }
input, select, button { font: inherit; }
.center { display: flex; justify-content: center; }
.px-icon { display: inline-block; vertical-align: middle; fill: currentColor; flex: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------ pixel frame */

.card, .status, .bar, dialog, button, input, select, .slot,
.segmented input:checked + span, .theme-switch label > .icon-pill {
  --f: var(--frame);
  --d: var(--drop);
  border: 0;
  border-radius: 0;
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f),
    calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f),
    0 calc(var(--px) * 2) 0 0 var(--d);
}
input, select, .bar, .status { --d: transparent; }

/* ------------------------------------------------------------ header + scene */

.site-header { position: relative; overflow: hidden; min-height: clamp(200px, 17vw, 340px); border-bottom: 4px solid var(--outline); }
/* Until src/ui/theme.js draws the scene (after the module loads), the header shows its sky, hills, sand and water as flat bands
   in the theme's colours (theme-init.js has already set the theme), so a page switch never flashes an empty header. */
.site-header { background: linear-gradient(var(--sky-1) 0 45%, var(--sky-2) 45% 58%, var(--mtn-far) 58% 76%, var(--sand) 76% 82%, var(--water) 82%); }
/* Browsers with cross-document view transitions keep the old header on screen while the next page's scene is drawn,
   so it stays put when you switch tabs. Elsewhere this does nothing. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(site-header) { animation: none; }
::view-transition-new(site-header) { display: none; }
/* The header grows with the width, so the sky always shows the same slice of the scene (y ≈ 14–48). */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene * { transition: fill 0.6s, opacity 0.6s; }
.sky-1 { fill: var(--sky-1); } .sky-mid { fill: var(--sky-mid); } .sky-2 { fill: var(--sky-2); }
.sun { fill: var(--sun); } .stars { fill: var(--stars); }
.mtn-far { fill: var(--mtn-far); } .mtn-near { fill: var(--mtn-near); }
.sand { fill: var(--sand); } .water { fill: var(--water); } .sparkle { fill: var(--sparkle); }

/* Day: no stars or sun. Sunrise/Sunset: a low sun setting behind one silhouette, faint stars.
   Night: stars. At dusk and night the hills and beach share the mountains' colour. */
.stars, .sun { opacity: 0; }
[data-theme="golden"] .sun { opacity: 1; }
[data-theme="golden"] .stars { opacity: 0.2; }
[data-theme="night"] .stars { opacity: 0.6; }
[data-theme="thanksgiving"] .sun { opacity: 1; }
[data-theme="halloween"] .stars { opacity: 0.4; }
[data-theme="christmas"] .stars { opacity: 0.8; }

/* Seasonal extras (theme.js): hidden unless their theme is on. Snow and leaves fall in pixel steps. */
.season { opacity: 0; }
[data-theme="halloween"] .halloween, [data-theme="christmas"] .christmas, [data-theme="thanksgiving"] .thanksgiving { opacity: 1; }
.moon-big { fill: var(--moon); } .bats { fill: var(--outline); } .pumpkins { fill: var(--pumpkin); }
.snowcap, .snow { fill: var(--snow); } .trees { fill: var(--tree); }
.leaves-a { fill: var(--leaf-1); } .leaves-b { fill: var(--leaf-2); }
@keyframes fall { to { transform: translateY(48px); } }
@media (prefers-reduced-motion: no-preference) {
  .season.fall { animation: fall 16s steps(48) infinite; }
  .season.fall.slow { animation-duration: 22s; }
  .weather.rain { animation: fall 2.4s steps(24) infinite; }
}

/* Weather (core/dogtime.js weatherFor): every other switch to Day, Sunrise/Sunset or Night brings
   rain (with clouds), clouds or fog. Rain dims the sky and hides the sun and stars; fog hides the stars. */
:root { --cloud: #ffffff; --rain: #dce8ff; --fog: #eef2fb; }
[data-theme="golden"] { --cloud: #6b4a6e; --rain: #c9a3b8; --fog: #8e6a86; }
[data-theme="night"] { --cloud: #34324a; --rain: #6f7fb0; --fog: #4a4866; }
[data-theme="day"][data-weather="rain"] { --cloud: #a9b5cc; --sky-1: #7d97c4; --sky-mid: #8299c4; --sky-2: #879fc7; --water: #6f8fc0; --sparkle: #a9bfe0; }
[data-theme="golden"][data-weather="rain"] { --sky-1: #352c4f; --sky-mid: #46345a; --sky-2: #5e3f5e; }
.weather { opacity: 0; }
.clouds { fill: var(--cloud); } .rain { fill: var(--rain); } .fog { fill: var(--fog); }
[data-weather="rain"] .clouds, [data-weather="clouds"] .clouds, [data-weather="rain"] .rain { opacity: 1; }
[data-weather="fog"] .fog { opacity: 0.55; }
[data-weather="rain"] .stars, [data-weather="rain"] .sun, [data-weather="fog"] .stars { opacity: 0; }

.header-inner {
  position: relative; max-width: 1100px; margin: 0 auto; padding: 14px 18px 26px;
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: ". nav theme" "brand brand brand";
  align-items: start; gap: 10px;
}
.site-header nav { grid-area: nav; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; }
.site-header nav a, .brand {
  color: var(--header-text); text-decoration: none;
  text-shadow: 1px 0 var(--outline), -1px 0 var(--outline), 0 1px var(--outline), 0 -1px var(--outline),
    1px 1px var(--outline), -1px -1px var(--outline), 1px -1px var(--outline), -1px 1px var(--outline);
}
.site-header nav a { font-size: 1.15rem; padding: 3px 12px; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] {
  background: rgb(0 0 0 / 18%);
  box-shadow: 0 -3px 0 0 var(--header-text), 0 3px 0 0 var(--header-text), -3px 0 0 0 var(--header-text), 3px 0 0 0 var(--header-text);
}
.brand { grid-area: brand; justify-self: center; display: flex; flex-direction: column; align-items: center; margin-top: clamp(14px, 4vw, 70px); }
/* The title is a button (it plays the pop-up) that must look like plain text: undo the button look. */
button.brand { gap: 0; padding: 0; background: none; box-shadow: none; transition: none; }
button.brand:hover, button.brand:active { filter: none; transform: none; }
/* The title is pixel art (wordmark + paw bitmaps in icons.js) at 2px per pixel, outlined like the header text. */
.brand-name { position: relative; line-height: 0; min-height: 64px; } /* the wordmark's height, reserved before icons.js fills it in */
.brand-name .px-icon {
  display: block;
  filter: drop-shadow(2px 0 0 var(--outline)) drop-shadow(-2px 0 0 var(--outline)) drop-shadow(0 2px 0 var(--outline)) drop-shadow(0 -2px 0 var(--outline));
}
.brand-sub { font-size: 1.05rem; letter-spacing: 1px; margin-top: 4px; }
/* The paw sits in the wordmark's gap (pixel 136, 0) and hops when the title is hovered. */
.brand-paw { position: absolute; left: 272px; top: 0; }
/* Seasonal title decorations (theme.js titleDecor): drawn in the wordmark's pixels, 2px each, outlined like it. */
.title-decor {
  position: absolute; left: -8px; top: -28px; width: 472px; height: 92px; overflow: visible; pointer-events: none;
  filter: drop-shadow(2px 0 0 var(--outline)) drop-shadow(-2px 0 0 var(--outline)) drop-shadow(0 2px 0 var(--outline)) drop-shadow(0 -2px 0 var(--outline));
}
.td-r { fill: #e23b3b; } .td-w { fill: #ffffff; } .td-g { fill: #2f8f4e; }
.td-p { fill: #5b2d82; } .td-o { fill: #ff8a2a; } .td-k { fill: #2a2228; } .td-t { fill: #d8d0e8; }
.td-b { fill: #7a4a2a; } .td-y { fill: #f5c542; }
.px-accent { fill: #f7a1bf; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* Title pop-up (src/ui/popup.js): a picture flies off the cursor and a burst of pixel "sillies" scatters.
   JS sets the start point and direction as custom properties: --x0 --y0 (start), --dx --dy (travel),
   --rot (spin), plus --s (silly size), --t (silly time) and --g (gravity). Everything is fixed and
   click-through, so it never moves the page. */
.popup, .silly { position: fixed; left: var(--x0); top: var(--y0); z-index: 100; pointer-events: none; }
.popup { width: min(60vw, 320px); height: auto; transform: translate(-50%, -50%); animation: popup-fly 2s both; }
.popup.pixelated { image-rendering: pixelated; }
.silly { line-height: 0; animation: silly-burst var(--t) ease-out both; }
.silly .px-icon { width: var(--s); height: auto; }
.silly.ambient { opacity: 0.7; animation-name: silly-float; animation-timing-function: ease-in-out; }
.silly.heart { animation-name: silly-float; animation-timing-function: ease-out; } /* petting hearts float up from the pointer */
@keyframes popup-fly {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-25deg); }
  12% { transform: translate(-50%, -50%) scale(1.3) rotate(10deg); }
  20% { transform: translate(-50%, -50%) scale(0.9) rotate(-6deg); }
  28% { transform: translate(-50%, -50%) scale(1.05) rotate(3deg); animation-timing-function: ease-in; }
  100% { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.3) rotate(var(--rot)); opacity: 0; }
}
@keyframes silly-burst {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  40% { transform: translate(-50%, -50%) translate(calc(var(--dx) * 0.7), calc(var(--dy) * 0.7)) scale(1) rotate(calc(var(--rot) * 0.5)); }
  100% { transform: translate(-50%, -50%) translate(var(--dx), calc(var(--dy) + var(--g))) scale(0.8) rotate(var(--rot)); opacity: 0; }
}
@keyframes silly-float {
  0% { transform: translate(-50%, -50%); opacity: 0; }
  15% { opacity: 0.7; }
  100% { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(calc(var(--rot) * 0.2)); opacity: 0; }
}
@keyframes popup-fade { 0%, 100% { opacity: 0; } 15%, 85% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .popup { animation-name: popup-fade; }
  .silly { animation-name: popup-fade; transform: translate(-50%, -50%); } /* fades in place */
  .silly.heart { animation-name: popup-fade; }
  .silly.ambient { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .brand:hover .brand-paw, .rec-arrow { animation: bob 0.8s steps(2) infinite; }
}
.theme-slot { grid-area: theme; justify-self: end; min-height: 44px; display: flex; align-items: center; gap: 10px; } /* the switcher's height, reserved before theme.js builds it */

/* ------------------------------------------------------------ buttons + inputs */

button {
  --f: var(--btn-frame);
  cursor: pointer; padding: 8px 16px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--btn); color: var(--btn-text);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f),
    calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f),
    0 calc(var(--px) * 2) 0 0 var(--f),
    inset 0 calc(var(--px) * -1) 0 0 rgb(0 0 0 / 22%), inset 0 var(--px) 0 0 rgb(255 255 255 / 22%);
  transition: transform 0.06s, filter 0.15s;
}
button:hover { filter: brightness(1.08); }
button:active:where(:not(:disabled)), .site-header nav a:active, .segmented label:active > span {
  transform: translateY(var(--px)); filter: brightness(0.92);
}
@media (prefers-reduced-motion: reduce) {
  button:active:where(:not(:disabled)), .site-header nav a:active, .segmented label:active > span { transform: none; }
}
button.secondary { --f: var(--frame); --d: var(--drop); background: var(--surface); color: var(--text); }
button.danger { --f: var(--bad); --d: var(--bad); background: var(--bad-soft); color: var(--bad); }
/* The header's music button: same size and frame as the theme switcher's pills. The note bobs while anything plays. */
.music-btn {
  --f: var(--outline); --d: var(--outline); width: 36px; height: 36px; padding: 0; justify-content: center; background: var(--surface); color: var(--text);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f), calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f),
    0 calc(var(--px) * 2) 0 0 var(--d);
}
.music-btn.playing { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .music-btn.playing .px-icon { animation: bob 0.8s steps(2) infinite; } }
:focus-visible { outline: 3px dashed var(--accent); outline-offset: 6px; }

input, select { color: var(--text); background: var(--surface); padding: 8px 12px; }
input[type="search"] { width: 100%; }
input::placeholder { color: var(--muted); }

/* Pixel dropdown: native select with a pixel arrow drawn from 3px squares. */
.select { position: relative; display: inline-block; }
.select select { appearance: none; padding-right: 38px; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 3px; height: 3px; margin-top: 1px;
  background: var(--text); pointer-events: none;
  box-shadow: -6px -6px var(--text), 6px -6px var(--text), -3px -3px var(--text), 3px -3px var(--text);
}

/* Pixel checkbox */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input {
  appearance: none; width: 20px; height: 20px; padding: 0; margin: 0 3px; cursor: pointer;
}
.check input:checked { background: var(--btn); box-shadow:
  0 -3px 0 0 var(--f), 0 3px 0 0 var(--f), -3px 0 0 0 var(--f), 3px 0 0 0 var(--f), inset 0 0 0 4px var(--surface); }

/* Pills (units, themes): radios styled as pixel buttons. */
.segmented { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 0; padding: 4px; margin: 0; }
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label > span { display: inline-block; padding: 4px 12px; color: var(--muted); }
.segmented label:hover > span { color: var(--text); }
.segmented input:checked + span { --f: var(--btn-frame); --d: transparent; background: var(--btn); color: var(--btn-text); }
.segmented input:focus-visible + span { outline: 3px dashed var(--accent); outline-offset: 6px; }

.theme-switch { flex-wrap: nowrap; gap: 10px; }
.theme-switch label > .icon-pill { --f: var(--outline); --d: var(--outline); padding: 0; width: 36px; height: 36px; display: grid; place-items: center; background: var(--surface); color: var(--text); }
.theme-switch input:checked + .icon-pill { --f: var(--outline); --d: var(--outline); }

/* ------------------------------------------------------------ shared pieces */

.card { background: var(--surface); padding: 18px; margin-bottom: 26px; transition: background-color 0.6s; }
.status { padding: 14px 18px; background: var(--surface); text-align: center; }
.status.error { --f: var(--bad); background: var(--bad-soft); color: var(--bad); }
.notice { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--warn-soft); color: var(--warn); margin: 0 auto 26px; width: fit-content; font-size: 0.95rem; }
.badge { display: inline-block; padding: 0 8px; font-size: 0.85rem; background: var(--surface-2); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.unobtainable { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--rose) 16%, var(--surface-2)); color: var(--text); }
.badge.unobtainable .px-icon { color: var(--rose); }
.value { font-weight: 700; font-variant-numeric: tabular-nums; }
.value:not(.none) { font-family: var(--number-font); }
.value.none { font-weight: 400; color: var(--muted); }
.empty { color: var(--muted); text-align: center; }
.item-img { flex: none; object-fit: contain; image-rendering: pixelated; }
.currency-icon { width: 1.25em; height: 1.25em; vertical-align: middle; margin-inline-end: 0.25em; }
.skull-stack {
  --skull-size: 1.25em; --skull-step: 0.375em;
  display: inline-block; position: relative;
  width: calc(var(--skull-size) + var(--skull-step) * 2); height: var(--skull-size);
}
.skull-stack > img { position: absolute; inset: 0 auto auto 0; width: var(--skull-size); height: var(--skull-size); }
.skull-stack > img:nth-child(2) { left: var(--skull-step); }
.skull-stack > img:nth-child(3) { left: calc(var(--skull-step) * 2); }

/* ------------------------------------------------------------ value list */

.toolbar { display: flex; flex-direction: column; gap: 14px; margin: 6px 2px 14px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.toolbar .search { flex: 1 1 300px; position: relative; display: block; }
.toolbar .search input { font-size: 1.1rem; padding: 11px 14px 11px 46px; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); line-height: 0; pointer-events: none; }

.count { color: var(--muted); margin: 0 4px 14px; }
#song-player { max-width: 600px; margin-inline: auto; }
.unit-switch {
  --btn: var(--unit-bg); --btn-frame: var(--unit-frame); --btn-text: var(--unit-active-text);
  --surface: var(--unit-surface); --text: var(--unit-text); --muted: var(--unit-muted); --accent: var(--unit-focus);
  font-family: var(--font);
}
.unit-switch label > span { white-space: nowrap; }
.unit-switch .custom-unit { padding: 4px 12px; box-shadow: none; font-size: inherit; }
.unit-switch .custom-unit[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); }
.paws { display: inline-flex; gap: 4px; color: var(--accent); }
.paw.off { opacity: 0.2; }
.chip { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
#value-tiles :is(.badge, .chip) { font-size: 0.75rem; }
.item-info .dialog-head { gap: 14px; }
.item-info h2 { overflow-wrap: anywhere; }
.item-info .close-btn { flex: none; }
.item-info .info-art { padding: 0; margin: 0 0 6px; background: none; box-shadow: none; }
.info-disc .item-img { animation: spin 4s linear infinite paused; }
.info-disc.playing .item-img { animation-play-state: running; }
.info-art .bitten { animation: bite-item 0.8s steps(1) forwards; }
.info-art .drained { animation: drain-item 0.65s ease-in forwards; }
.info-art .bumped { animation: bump-item 0.46s ease-out; }
.info-art .tossed { visibility: hidden; }
.item-info .flying-item { position: fixed; top: 0; left: 0; z-index: 1; pointer-events: none; }
.fridge-scare {
  position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--outline) 86%, transparent);
  animation: fridge-scare-fade 850ms ease-out both;
}
.fridge-scare .item-img { width: min(440px, 82vw, 68vh); height: auto; filter: drop-shadow(0 0 22px var(--sky)); }
@keyframes fridge-scare-fade { 0%, 65% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .fridge-scare .item-img { animation: fridge-lunge 460ms ease-out both; }
  @keyframes fridge-lunge {
    0% { transform: scale(0.2) rotate(-8deg); }
    35% { transform: scale(1.1) rotate(4deg); }
    68% { transform: scale(0.98) rotate(-2deg); }
    100% { transform: scale(1); }
  }
}
.trade-item-edit { margin-bottom: 16px; }
.trade-item-edit p { margin: 0; }
@keyframes bite-item {
  0% { clip-path: inset(0 0 0 0); }
  25% { clip-path: polygon(0 0, 67% 0, 62% 24%, 100% 36%, 100% 100%, 0 100%); }
  55% { clip-path: polygon(0 24%, 38% 32%, 43% 50%, 79% 55%, 100% 66%, 100% 100%, 0 100%); }
  82% { clip-path: inset(76% 34% 0 22%); }
  100% { clip-path: inset(100% 0 0 0); }
}
@keyframes drain-item { to { clip-path: inset(100% 0 0 0); opacity: 0; } }
@keyframes bump-item {
  35% { transform: translateY(-10px) rotate(-12deg); }
  68% { transform: translateY(1px) rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .info-disc .item-img, .info-art .item-img { animation: none; }
  .info-art :is(.bitten, .drained) { opacity: 0; }
  .info-art .bumped { opacity: 0.6; }
}

.item-body { border-top: 2px dashed var(--frame); font-size: 0.95rem; }
.item-body dl { margin: 12px 0; }
.item-body dt { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
.item-body dt:first-child { margin-top: 0; }
.item-body dd { margin: 0; overflow-wrap: anywhere; }
.item-body ul { margin: 0; padding-left: 18px; }
.item-body ul.inline { padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.item-body .value-feedback { margin: 10px 2px 12px; }
.value-feedback .value-feedback-note { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }
/* Value history chart (src/ui/history-chart.js): accent band = low–high, line = midpoint, steps = holds until changed. */
.history { margin: 4px 0 0; max-width: 360px; }
.history svg { display: block; width: 100%; height: auto; overflow: visible; }
.history .grid { stroke: var(--frame); stroke-width: 1; }
.history .tick { fill: var(--muted); font-size: 11px; }
.history .band { fill: var(--accent); fill-opacity: 0.18; }
.history .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.history .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.history .hit { fill: transparent; cursor: pointer; outline: none; }
.history .hit:focus-visible { stroke: var(--text); stroke-width: 2; }
.history figcaption { color: var(--muted); font-size: 0.85rem; }

/* ------------------------------------------------------------ calculator */

/* Calculator: a game-style arrow over HGF (the first unit), the community's main unit. */
.unit-row { width: fit-content; margin: 0 auto 22px; }
.slot-values-toggle { display: flex; justify-content: center; margin-top: 12px; }
.trade-page :is(.total, .value, .qty, .stepper input) { font-family: var(--number-font); font-variant-numeric: tabular-nums; }
#picker .tab-row { margin: 0 0 8px; }
.rec-hint { display: flex; align-items: center; gap: 8px; margin: 0 0 2px 24px; font-size: 0.9rem; color: var(--accent); }
.rec-arrow { line-height: 0; }
.trade-window { max-width: 900px; margin: 0 auto 30px; padding: 22px; }

.balance { text-align: center; margin-bottom: 24px; font-family: var(--number-font); }
.verdict-title { font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin: 0 0 10px; }
.bar { position: relative; height: 24px; margin: 0 3px; background: var(--surface-2); overflow: hidden; }
.bar-fill {
  --bar-stripes: repeating-linear-gradient(90deg, transparent 0 12px, rgb(0 0 0 / 22%) 12px 15px);
  position: absolute; top: 0; bottom: 0; width: 0; background-color: var(--muted);
  background-image: var(--bar-stripes);
  transition: width 0.3s steps(8), left 0.3s steps(8), background-color 0.3s;
}
.bar-mid { position: absolute; top: 0; bottom: 0; left: calc(50% - 2px); width: 3px; background: var(--outline); opacity: 0.55; }
.hint { margin: 10px 0 0; font-size: 1.05rem; }
.verdict-neutral .verdict-title { color: var(--muted); }
.verdict-balanced .verdict-title { color: var(--good); }
.verdict-balanced .bar-fill { background-color: var(--good); }
.verdict-uneven .verdict-title { color: var(--warn); }
.verdict-uneven .bar-fill { background-color: var(--warn); }
.verdict-veryUneven .verdict-title { color: var(--bad); }
.verdict-veryUneven .bar-fill { background-color: var(--bad); }
@media (forced-colors: none) {
  .verdict-veryUneven { --gift-rainbow: linear-gradient(90deg, var(--gift-colors)); }
  .verdict-veryUneven .verdict-title {
    width: fit-content; margin-inline: auto;
    background-image: var(--gift-rainbow); background-clip: text; color: transparent;
  }
  .verdict-veryUneven .bar-fill { background-image: var(--bar-stripes), var(--gift-rainbow); }
}
@media (forced-colors: none) and (prefers-reduced-motion: no-preference) {
  .verdict-veryUneven .verdict-title { background-size: 200% 100%; }
  .verdict-veryUneven .bar-fill { background-size: auto, 200% 100%; }
  .verdict-veryUneven :is(.verdict-title, .bar-fill) { animation: gift-rainbow 4s linear infinite alternate; }
}
@keyframes gift-rainbow { to { background-position: 100% 0; } }

.trade-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 20px; align-items: start; }
.side h2 { font-size: 1.4rem; margin: 0 0 12px; }
.slots { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; background: var(--surface-2); }
.slot { --d: transparent; }
.slots li { aspect-ratio: 1; }
.slot {
  width: 100%; height: 100%; padding: 6px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface); color: var(--text);
}
.slot .item-img { width: 64%; height: auto; aspect-ratio: 1; }
.qty { position: absolute; top: 3px; right: 3px; font-size: 0.8rem; padding: 0 5px; background: var(--btn); color: var(--btn-text); }
.slot:has(.slot-value) .qty { top: auto; bottom: 3px; }
.slot-value {
  position: absolute; inset: 3px 3px auto; padding: 2px; font-size: 0.72rem; line-height: 1.1;
  color: var(--text); background: color-mix(in srgb, var(--surface) 92%, transparent);
  text-align: center; overflow-wrap: anywhere;
}
.slot .currency-icon:not(.skull-stack) { width: 12px; height: 12px; }
.slot .skull-stack { --skull-size: 12px; --skull-step: 4px; }
.slot .skull-stack > img { width: var(--skull-size); height: var(--skull-size); }
.slot-estimate { display: block; color: var(--muted); margin-top: 2px; }
.slot.add { --f: var(--add-frame); background: var(--surface); color: var(--add); }
.slot.empty { --f: var(--frame); background: var(--frame); opacity: 0.35; }
.total { text-align: center; margin: 14px 0 0; font-size: 1.1rem; font-weight: 700; }

.trade-mid { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 120px; }
.trade-word { font-size: 1.4rem; font-weight: 700; letter-spacing: 2px; }
.square-btn { --f: var(--frame); --d: var(--drop); width: 60px; height: 60px; padding: 0; justify-content: center; background: var(--surface); color: var(--text); }
.square-btn .px-icon { width: 30px; height: 33px; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 18px; }
.copy-status input { width: min(100%, 420px); }

/* Picker / edit dialog */
dialog {
  --f: var(--outline); --d: var(--outline);
  width: min(600px, 92vw); max-height: 84vh; padding: 0; overflow: visible;
  background: var(--surface); color: var(--text);
}
/* The enhance dialog has one fixed size on every tab; only the grid inside the tab scrolls (see .enhance below). */
dialog.wide { width: min(1000px, 95vw); height: min(720px, 90vh); max-height: none; }
dialog.wide[open] { display: flex; flex-direction: column; }
dialog.wide .dialog-body { flex: 1; min-height: 0; max-height: none; overflow: hidden; }
dialog::backdrop { background: rgb(18 22 40 / 60%); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; }
.dialog-head h2 { margin: 0; }
.close-btn { padding: 6px 9px; }
.dialog-body { padding: 6px 18px 20px; overflow-y: auto; max-height: calc(84vh - 70px); }
.quick-add { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 3px; }
.quick-add button { --f: var(--frame); --d: var(--drop); padding: 4px 11px; font-size: 0.95rem; color: var(--outline); }
.quick-add button:nth-child(4n + 1) { background: var(--sky); }
.quick-add button:nth-child(4n + 2) { background: var(--pink); }
.quick-add button:nth-child(4n + 3) { background: var(--mint); }
.quick-add button:nth-child(4n + 4) { background: var(--lavender); }
/* Catalog and picker tiles share a grid. The tile is a fixed square (--tile); the sprite is contained in it,
   whatever its real size, and the name sits under it (two lines at most). */
.results, .face-list { list-style: none; margin: 8px 0 0; padding: 6px 3px; display: grid; grid-template-columns: repeat(auto-fill, 88px); justify-content: center; gap: 16px 12px; }
.results :is(.empty, .more) { grid-column: 1 / -1; }
.results .more { text-align: center; }
/* Picker search box with its sort menu beside it. */
.picker-tools { display: flex; align-items: center; gap: 12px; padding: 3px; } /* room for the pixel borders */
.picker-tools input[type="search"] { flex: 1; width: auto; min-width: 0; }
.picker-tools .select { flex: none; max-width: 52%; }
.picker-tools select { max-width: 100%; text-overflow: ellipsis; }
.dialog-body .hint, #list > .hint { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
/* The calculator's add-items picker: the search, quick adds and tabs stay put while only the item grid scrolls.
   Each result is a framed card that lights up in the accent colour on hover; the selected tab and chip are filled. */
#picker:has(#trade-picker-results)[open] { display: flex; flex-direction: column; width: min(660px, 94vw); height: min(780px, 88vh); }
#picker:has(#trade-picker-results) .dialog-head { background: var(--surface-2); box-shadow: 0 var(--px) 0 0 var(--frame); padding-bottom: 14px; }
#picker:has(#trade-picker-results) .dialog-head h2 { color: var(--accent); }
#picker:has(#trade-picker-results) .dialog-body { flex: 1; min-height: 0; max-height: none; display: flex; flex-direction: column; overflow: hidden; padding: 16px 18px 0; }
#picker:has(#trade-picker-results) .dialog-body > * { flex: none; }
#picker:has(#trade-picker-results) input[type="search"] { padding-block: 10px; font-size: 1.05rem; }
#picker:has(#trade-picker-results) .quick-add { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 3px 4px; }
#picker:has(#trade-picker-results) .quick-add button { justify-content: center; }
#picker:has(#trade-picker-results) .tab-row { margin: 10px 0 4px; padding: 8px; gap: 8px; background: var(--bg); }
#picker:has(#trade-picker-results) .tab-row .tab { padding: 3px 10px; font-size: 0.9rem; }
#picker:has(#trade-picker-results) .tab[aria-selected="true"], #picker:has(#trade-picker-results) .subcat[aria-pressed="true"] { --f: var(--btn-frame); background: var(--btn); color: var(--btn-text); }
#picker:has(#trade-picker-results) .subcat[aria-pressed="true"] small { color: inherit; opacity: 0.8; }
#picker:has(#trade-picker-results) .subcats { scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
#trade-picker-results { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#trade-picker-results > :not(.results) { flex: none; }
#trade-picker-results > .hint[aria-live] { font-size: 0.8rem; text-align: right; }
#trade-picker-results > .results {
  flex: 1; min-height: 0; overflow-y: auto; align-content: start; margin: 6px -18px 0; padding: 12px 18px 22px;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px;
  background: color-mix(in srgb, var(--bg) 60%, var(--surface)); box-shadow: inset 0 var(--px) 0 0 var(--frame);
  scrollbar-width: thin; scrollbar-color: var(--frame) transparent;
}
#trade-picker-results .results > li { display: flex; }
#trade-picker-results .tile {
  --f: var(--frame); height: 100%; padding: 10px 4px 8px; background: var(--surface);
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f), calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f), 0 calc(var(--px) * 2) 0 0 var(--drop);
}
#trade-picker-results .tile .tile-art { --f: transparent; --drop: transparent; }
#trade-picker-results .tile-name { font-weight: 700; }
#trade-picker-results .tile .badge { margin-top: auto; padding: 0 5px; font-size: 0.65rem; letter-spacing: 0.5px; text-transform: uppercase; background: none; opacity: 0.75; }
#trade-picker-results .tile:is(:hover, :focus-visible):not(:disabled) { --f: var(--accent); background: var(--surface-2); }
@media (prefers-reduced-motion: no-preference) {
  #trade-picker-results .tile { transition: transform 0.1s steps(2), background-color 0.1s; }
  #trade-picker-results .tile:hover:not(:disabled) { transform: translateY(calc(var(--px) * -1)); }
}
@media (max-width: 520px) {
  #picker:has(#trade-picker-results) .quick-add { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #picker:has(#trade-picker-results) .tab-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #picker:has(#trade-picker-results) .quick-add { margin-top: 12px; gap: 10px; }
  #trade-picker-results > .results { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
}
.tile {
  --tile: 64px; --f: var(--frame); --art: var(--surface-2); --tint: transparent; --sprite: none; --badge: 0; --badge-y: 6px; --wiggle: none;
  width: 100%; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 0; background: none; box-shadow: none;
  color: var(--text); font-size: 0.8rem; line-height: 1.15; text-align: center;
}
.tile:hover { filter: none; }
.tile:active { transform: none; }
.tile:disabled { opacity: 0.5; cursor: default; }
.tile-art {
  position: relative; display: grid; place-items: center; width: var(--tile); height: var(--tile); background: linear-gradient(var(--tint), var(--tint)), var(--art);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f),
    calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f),
    0 calc(var(--px) * 2) 0 0 var(--drop);
  transition: background-color 0.15s, box-shadow 0.15s;
}
.tile-art .item-img { width: calc(var(--tile) - 8px); height: calc(var(--tile) - 8px); filter: var(--sprite); transition: filter 0.15s; }
.tile-none { color: var(--muted); }
.tile-name, .tile-value { max-width: 100%; overflow-wrap: anywhere; }
.tile-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.tile-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }
.tile:not([aria-pressed]) .tile-value { white-space: normal; }
/* Equipped = green. Removable + hover/focus = soft red frame and tint, a corner "x" chip, and a dimmed sprite that stays visible.
   A tile just equipped with the mouse (.fresh) waits for the pointer to leave before it can turn red. */
.tile.equipped { --f: var(--good); --art: var(--good-soft); }
/* A worn item whose position is a guess is yellow instead (and has a "!" chip, so it is not only a colour). */
.tile.equipped.guess { --f: var(--guess); --art: color-mix(in srgb, var(--guess) 24%, var(--surface-2)); }
.guess-badge { position: absolute; top: -6px; left: -6px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--guess); color: #3a2c00; }
/* Unobtainable (data/availability.json): a faint rose fill over whatever the state's fill is (the frame keeps its green or yellow), and a
   crossed-circle badge in the bottom corner, opposite the "!" chip. Hover/focus remove-red drops the tint so it stays the stronger signal. */
.tile.unobtainable { --tint: color-mix(in srgb, var(--rose) 20%, transparent); }
.unobtainable-badge { position: absolute; bottom: 0; right: 0; width: 18px; height: 18px; display: grid; place-items: center; background: var(--rose); color: #fff; }
.remove-badge {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; display: grid; place-items: center;
  background: var(--bad); color: #fff; opacity: var(--badge); transition: opacity 0.15s;
}
.tile.removable:focus-visible { --f: var(--bad); --art: var(--bad-soft); --tint: transparent; --sprite: saturate(0.55) brightness(0.95); --badge: 1; --badge-y: 0; --wiggle: tile-wiggle 0.3s ease-out; }
@media (hover: hover) {
  .tile.removable:not(.fresh):hover { --f: var(--bad); --art: var(--bad-soft); --tint: transparent; --sprite: saturate(0.55) brightness(0.95); --badge: 1; --badge-y: 0; --wiggle: tile-wiggle 0.3s ease-out; }
}
.tile:active:not(:disabled) .tile-art { filter: brightness(0.9); }
@keyframes tile-wiggle { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: no-preference) {
  .tile-art { animation: var(--wiggle); transition: background-color 0.15s, box-shadow 0.15s, transform 0.08s; }
  .tile:active:not(:disabled) .tile-art { transform: translateY(var(--px)) scale(0.94); }
  .remove-badge { transform: translateY(var(--badge-y)); transition: opacity 0.15s, transform 0.15s; }
}
.edit { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.edit h3 { margin: 0; }
/* The preview box; inline unit icons keep their own small size. */
.edit .item-img:not(.currency-icon, .skull-stack > .item-img) { width: 96px; height: 96px; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper input { width: 6em; text-align: center; font-size: 1.2rem; }
.stepper button { width: 44px; justify-content: center; font-size: 1.3rem; padding: 4px 0; }
.edit-actions { display: flex; gap: 18px; margin-top: 6px; }
/* The saved dogs dialog: up to six framed slots, each with the breed picture, the name and its buttons. */
.saved-dogs { list-style: none; margin: 14px 3px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; }
.saved-dog { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 6px; min-height: 170px; text-align: center; background: var(--surface-2); --f: var(--frame); box-shadow: 0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f), calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f); }
.saved-dog.empty { opacity: 0.55; align-content: center; color: var(--muted); }
.saved-dog .item-img { width: 64px; height: 64px; }
.saved-dog-name { max-width: 100%; overflow-wrap: anywhere; font-weight: 700; }
.saved-dog-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.saved-dog-actions button { min-height: 30px; padding: 2px 10px; font-size: 0.85rem; }
.save-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.save-form .field { flex: 1; min-width: 160px; }

/* ------------------------------------------------------------ closet (styled like Dog Online's own dog page) */

/* The dog page has its own fixed colours, so it looks the same in every site theme: the theme variables are
   re-pointed here and everything inside (buttons, pills, badges) follows. */
.dogpage {
  --surface: #000a2a; --surface-2: #0b1747; --frame: #6a1fd0; --drop: #2a0a5e;
  --text: #ffffff; --muted: #a9b4e6; --accent: #ffd65a;
  --btn: #2f7cf0; --btn-frame: #1d4fa8;
  --purple: #6a1fd0; --purple-dark: #3b0f86;
  display: grid; gap: 22px; max-width: 860px; margin: 0 auto 30px; padding: 26px; color: var(--text);
  font-family: var(--page-font, var(--font)); /* set from the chosen page font; the site header and dialogs keep the site font */
  /* The page background is a tile from the wiki, set from src/ui/closet.js. The game draws its 124px tiles pixelated;
     the green shows until the image loads. */
  background-color: #2f9a45; background-repeat: repeat; background-size: 124px; image-rendering: pixelated;
}
.dogpage > * { image-rendering: auto; } /* image-rendering is inherited: keep it to the page's own background */
.dp-card { background: var(--surface); padding: 18px; text-align: center; border: 4px solid var(--purple); box-shadow: inset 0 0 0 3px var(--purple-dark); }
.dp-card h2 { margin: 0 0 10px; }
.dp-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.dp-top p { margin: 0; font-weight: 700; }
.dp-top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dp-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.dp-actions { justify-content: center; margin-top: 14px; }
/* Music: like the game there is no card, just the disc and the song name centred on the page background. */
.dp-music { position: relative; padding-inline: 270px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; }
.music-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; color: #fff; text-shadow: 1px 1px 0 var(--outline); text-align: center; overflow-wrap: anywhere; }
.music-toggle .cd { flex: none; }
.music-toggle.playing .cd { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .music-toggle.playing .cd { animation: none; } }
.music-toggle:disabled { opacity: 0.7; cursor: default; text-decoration: none; }
.music-status { color: #fff; text-shadow: 1px 1px 0 var(--outline); }
.music-status:empty { display: none; }
.dp-music, .dogpage .small { font-size: 0.9rem; }
/* Every small button on the page shares one height and centres its content. */
.dogpage .small { min-height: 34px; padding: 4px 12px; justify-content: center; }
/* Edit mode must not move the text. The customise buttons sit in a slot at the right edge, and the same width is kept free on the
   left, so the centred song name, dog name and tagline stay exactly where they are. Phones have no room for that: there the
   slot drops below the text (see the small-screens rules). */
.dp-title { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 108px; padding-inline: 130px; }
.edit-side { position: absolute; inset-block: 0; right: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.dp-title .edit-side { right: 18px; }
.dp-music .edit-side { flex-direction: row; align-items: center; }
.dp-title h2 { margin: 0; font-size: 1.6rem; overflow-wrap: anywhere; }
/* Edit mode (like the game): the customise buttons only show while "edit page" is on, and pop in. */
.dogpage:not(.editing) .edit-only { display: none; }
#edit-page[aria-pressed="true"] {
  --f: #c24d00; color: #23284a; background: linear-gradient(to top, #fff 0 4px, #ff7a1a 4px); /* traffic-cone orange with a white stripe */
}
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.1); } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .dogpage.editing .edit-only { animation: pop-in 0.3s ease-out backwards; }
}
.tagline { margin: 6px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.dp-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
/* The dog: a square 320 canvas placed in % by src/ui/closet.js. Worn items reach about 90 above, 44 left, 58 right and
   62 below it, so the canvas sits inside a stage with room around it and is sized at 60% of the stage (0.1875 stage
   widths per canvas unit gives the margins below). Sizes in cqw follow the stage width, so everything scales together
   and clicks hit the right item. The stage stops growing at 427px, which draws the canvas at 256px (80%). */
.dog-stage { container-type: inline-size; max-width: 427px; margin: 0 auto; background: var(--surface-2); }
/* Petting (src/ui/closet.js): rubbing the page's dog must not select text or scroll sideways; vertical swipes still scroll the page. */
.dogpage .dog-stage { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.dogpage .dog { transform-origin: 50% 100%; }
.dog.petted { animation: squish 0.3s ease-out; }
@keyframes squish { 25% { transform: scale(1.06, 0.92); } 60% { transform: scale(0.97, 1.04); } }
@media (prefers-reduced-motion: reduce) { .dog.petted { animation: none; } }
.pet-count { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.dog { position: relative; isolation: isolate; width: 60cqw; aspect-ratio: 1; margin: 16.875cqw 0 12cqw 20cqw; }
.dog-layer { position: absolute; max-width: none; image-rendering: pixelated; pointer-events: none; }
.dog-item { pointer-events: auto; cursor: pointer; }
.dog-base { inset: 0; width: 100%; height: 100%; }
.dp-card .hint { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); }
.dp-card ul.equipped + .hint { margin-bottom: 14px; }
.guess-warning { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: left; }
.guess-warning .px-icon { color: var(--guess); }
/* A button that reads as text: worth-list names, dogpets, the music line. */
.plain { --f: transparent; padding: 0; background: none; color: inherit; box-shadow: none; text-align: left; }
.plain:hover { text-decoration: underline; }
.pets, .worth { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.pet { flex-direction: column; align-items: center; width: 100%; text-align: center; }
.pet .item-img { width: 64px; height: 64px; }
.dp-worth-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.dp-worth-head h2 { margin: 0; }
.worth { gap: 8px; }
.worth li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; text-align: left; }
/* Unobtainable worth rows: a faint rose band (the negative margin keeps the text lined up with the other rows) and the small mark after the name. */
.worth li.unobtainable { background: color-mix(in srgb, var(--rose) 12%, transparent); padding: 3px 6px; margin: 0 -6px; }
.unobtainable-mark { flex: none; line-height: 0; color: var(--rose); }
.worth .plain { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }
.worth-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; }
.worth-icon .item-img { width: 28px; height: 28px; }
.worth-label { display: flex; align-items: center; gap: 8px; }
.dp-worth-head .px-icon { margin-right: 8px; }
.worth .value { text-align: right; }
.worth-summary { display: flex; align-items: center; gap: 12px; max-width: 100%; margin-inline-start: auto; }
.worth-right { display: grid; justify-items: end; min-width: 0; overflow-wrap: anywhere; }
.report-button {
  --f: #9c711f;
  padding: 4px 8px; background: #ffd65a; color: #291a00;
  font-size: 0.875rem; line-height: 1; justify-content: center;
}
.report-button:disabled { cursor: default; }
.report-button:disabled:hover { filter: none; }
@media (max-width: 480px) {
  .worth li { column-gap: 8px; }
  .worth li > .plain { flex-basis: 7rem; }
  .worth-summary { gap: 8px; }
}
.coins { font-size: 0.8rem; color: var(--muted); }
.worth .worth-coins { justify-content: flex-end; align-items: center; gap: 6px; margin-top: -2px; font-size: 0.85rem; color: var(--muted); }
.worth-total { margin-top: 4px; padding-top: 10px; border-top: 2px dashed var(--purple); font-weight: 700; }
.worth .empty { justify-content: center; }
/* The enhance dialog: the dog large on the left (a fixed column), tabs and the shared picker on the right. The dialog never changes size:
   tabs and search stay put and the grid under them scrolls (the scrollbar gutter is always reserved, so nothing shifts). On phones it
   stacks, with a smaller dog on top, and the tab's whole content scrolls instead. */
.enhance { display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 20px; height: 100%; }
.enhance-preview { min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
.enhance-preview .dog-stage { max-width: 340px; }
.enhance-preview .dog-layer { pointer-events: none; }
.enhance-preview ul.equipped { margin: 16px 0 0; }
.enhance-controls { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 12px; padding: 3px; }
.tab { padding: 4px 12px; font-size: 0.95rem; }
.tab[aria-selected="true"] { --f: var(--accent); background: var(--surface-2); }
.enhance-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 8px; }
.enhance-panel > .picker-tools, .enhance-panel > .subcats, .enhance-panel > .hint, .face-section, .song-menu > :not(.results) { flex: none; }
.enhance-panel > .results, .enhance-panel > .song-menu > .results { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; align-content: start; }
.enhance-panel > .song-menu { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.enhance-panel .face-list { margin-top: 4px; padding-block: 6px 0; gap: 12px; }
.face-section { padding-top: 8px; }
/* Items picker subcategory chips scroll sideways on narrow screens. */
.subcats { display: flex; gap: 8px; padding: 6px 3px 8px; overflow-x: auto; scrollbar-width: thin; }
.subcat { flex: none; white-space: nowrap; padding: 2px 10px; font-size: 0.85rem; }
.subcat small { font-size: 0.7rem; color: var(--muted); }
.subcat[aria-pressed="true"] { --f: var(--accent); background: var(--surface-2); }
@media (max-width: 760px) {
  .enhance { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .enhance-preview { max-height: 38vh; }
  .enhance-preview .dog-stage { max-width: 180px; }
  .enhance-preview ul.equipped { margin-top: 8px; }
  .enhance-panel { overflow: auto; scrollbar-gutter: stable; padding: 3px; } /* room for the search box's focus ring */
  .enhance-panel > .results, .enhance-panel > .song-menu > .results { flex: none; overflow: visible; }
  .enhance-panel > .song-menu { flex: none; }
  .enhance-panel > * { flex-shrink: 0; }
}

/* Everything worn, as the same tiles as the pickers (no names). */
ul.equipped { list-style: none; margin: 0 0 16px; padding: 3px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
ul.equipped .tile { width: var(--tile); }
.equipped-sep { align-self: stretch; width: 2px; background: var(--purple, var(--frame)); }
.equipped:empty { display: none; }
.dp-card .actions { margin-top: 20px; gap: 12px; }
.add-item { --f: var(--add-frame); background: var(--add); }
.add-item:disabled { opacity: 0.5; filter: grayscale(1); }
/* Dialogs (item details, edit page) */
.edit-form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field input, .field select { width: 100%; }
.info p { margin: 0; }
.edit .hint { color: var(--muted); }
/* Shared now-playing panel for the header, Values and the Closet. */
.player {
  --f: var(--frame);
  display: grid; gap: 10px; margin: 6px 3px 16px; padding: 12px 14px; background: var(--surface-2);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f), calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f),
    0 calc(var(--px) * 2) 0 0 var(--drop);
}
.player > * { min-width: 0; }
.player-now { display: flex; align-items: center; gap: 12px; }
.player-now .cd { flex: none; }
.player.playing .cd { animation: spin 4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .player.playing .cd { animation: none; } }
.player-text { display: grid; min-width: 0; }
.player-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.player-tag { font-size: 0.8rem; color: var(--muted); }
.player-tag:empty { display: none; }
.player-buttons { display: flex; justify-content: center; gap: 14px; }
.player-btn { width: 52px; height: 36px; padding: 0; justify-content: center; }
.player-btn:disabled { opacity: 0.5; cursor: default; }
.player-seek { display: flex; align-items: center; gap: 12px; }
.player-time { flex: none; font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--muted); }
/* The seek bar: a framed track that fills with the button colour; the thumb is a small square. */
.player-seek input[type="range"] { flex: 1; min-width: 0; height: 20px; padding: 0; margin: 0; background: none; box-shadow: none; appearance: none; cursor: pointer; }
.player-seek input[type="range"]:disabled { opacity: 0.5; cursor: default; }
.player-seek input[type="range"]::-webkit-slider-runnable-track { height: 10px; background: linear-gradient(90deg, var(--btn) var(--pct, 0%), var(--surface) var(--pct, 0%)); box-shadow: 0 -2px 0 0 var(--frame), 0 2px 0 0 var(--frame), -2px 0 0 0 var(--frame), 2px 0 0 0 var(--frame); }
.player-seek input[type="range"]::-moz-range-track { height: 10px; background: linear-gradient(90deg, var(--btn) var(--pct, 0%), var(--surface) var(--pct, 0%)); box-shadow: 0 -2px 0 0 var(--frame), 0 2px 0 0 var(--frame), -2px 0 0 0 var(--frame), 2px 0 0 0 var(--frame); }
.player-seek input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 18px; margin-top: -4px; border: 0; border-radius: 0; background: var(--btn); box-shadow: 0 -2px 0 0 var(--btn-frame), 0 2px 0 0 var(--btn-frame), -2px 0 0 0 var(--btn-frame), 2px 0 0 0 var(--btn-frame); }
.player-seek input[type="range"]::-moz-range-thumb { width: 12px; height: 18px; border: 0; border-radius: 0; background: var(--btn); box-shadow: 0 -2px 0 0 var(--btn-frame), 0 2px 0 0 var(--btn-frame), -2px 0 0 0 var(--btn-frame), 2px 0 0 0 var(--btn-frame); }
.player-volume .mute-btn { width: 36px; }
.player-msg { margin: 0; font-size: 0.9rem; color: var(--bad); text-align: center; }
.player-msg:empty { display: none; }
.facts { margin: 0; padding-left: 18px; text-align: left; font-size: 0.9rem; }

/* The inventory page: a placeholder card with a row of empty pixel-framed slots. */
.inventory { text-align: center; max-width: 560px; margin-inline: auto; }
.inventory h2 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.inventory p { margin: 0; }
.inventory-slots { list-style: none; margin: 22px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.inventory-slots li { aspect-ratio: 1; background: var(--surface-2); --f: var(--frame); box-shadow: 0 calc(var(--px) * -1) 0 0 var(--f), 0 var(--px) 0 0 var(--f), calc(var(--px) * -1) 0 0 0 var(--f), var(--px) 0 0 0 var(--f); opacity: 0.6; }

/* ------------------------------------------------------------ footer */

.site-footer { margin-top: 60px; padding-top: 16px; padding-bottom: 36px; border-top: 2px dashed var(--frame); color: var(--muted); font-size: 0.9rem; text-align: center; }
.site-footer p { margin: 4px 0; }

/* ------------------------------------------------------------ small screens */

@media (max-width: 760px) {
  .header-inner { grid-template-columns: 1fr; grid-template-areas: "nav" "theme" "brand"; justify-items: center; padding-bottom: 20px; }
  .theme-slot { justify-self: center; }
  .site-header nav { gap: 8px 4px; }
  .site-header nav a { font-size: 1rem; padding: 3px 6px; }
  .brand { margin-top: 8px; }
  .brand-name { zoom: 0.75; }
  .brand-sub { display: none; }
  .dogpage { padding: 14px; }
  .dp-music { padding-inline: 0; }
  .dp-title { min-height: 0; justify-content: flex-start; padding-inline: 18px; }
  .edit-side, .dp-title .edit-side { position: static; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
  .dp-music .edit-side { margin-top: 0; }
  .dp-row, .trade-grid { grid-template-columns: minmax(0, 1fr); }
  .trade-mid { flex-direction: row; justify-content: center; padding-top: 0; }
  .square-btn { width: 52px; height: 52px; }
  .verdict-title { font-size: 1.5rem; }
  .slots li:nth-child(n + 4):has(.slot.empty) { display: none; } /* phones: no rows of empty placeholders */
}

/* Keep category tabs compact and let whole buttons wrap when space runs out. */
.tab-row { gap: 10px; }
.tab-row .tab { flex: none; padding-inline: 10px; white-space: nowrap; }

/* Beta tag (footer) */
.beta-tag { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); font-weight: 700; text-transform: uppercase; font-size: 0.8em; letter-spacing: 1px; }

/* How values work (about.html) */
.about { max-width: 720px; margin: 24px auto; line-height: 1.55; }
.about h3 { margin: 22px 0 6px; }
.about ul { padding-left: 20px; }
.about li { margin: 6px 0; }

/* Page notes sit in the right gutter when there is room and below the content on smaller screens. */
.side-note {
  --paper: #fff3a8; --ink: #4a3a1c;
  position: relative; width: min(100%, 260px); margin: 28px auto 4px;
  padding: 18px 14px 14px; background: var(--paper); color: var(--ink);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.12); font-size: 0.95rem; line-height: 1.35;
}
.side-note[data-paper="lavender"] { --paper: #e9d8ff; --ink: #432d53; }
.side-note[data-paper="mint"] { --paper: #d4f3d6; --ink: #2a482f; }
.side-note-tape {
  position: absolute; top: -22px; left: calc(50% - 34px); width: 68px; height: 44px;
  padding: 0; background: none; box-shadow: none; transform: rotate(-3deg);
}
.side-note-tape::before {
  content: ""; position: absolute; inset: 13px 2px; pointer-events: none;
  background: rgba(255, 255, 255, 0.6); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.side-note-tape:hover::before { background: rgba(255, 255, 255, 0.8); }
.side-note-tape:active { transform: translateY(-2px) rotate(-5deg); }
.note-flight { position: fixed; inset: 0; z-index: 10; overflow: hidden; pointer-events: none; }
.note-flight > .side-note { position: absolute; top: 0; left: 0; right: auto; margin: 0; }
.side-note p { margin: 6px 0; }
.side-note .side-note-title { font-weight: 700; margin-top: 0; }
.side-note a { color: #7a3d14; }
.side-note-links { display: none; }
@media (min-width: 1440px) {
  main:has(> .side-note) { position: relative; }
  .side-note {
    position: absolute; left: calc(100% + 18px); top: 166px; margin: 0; transform: rotate(2deg);
    width: min(180px, calc((100vw - 1100px) / 2 - 32px));
  }
  .side-note-links { display: block; }
  body:has(main > .side-note .side-note-links:not([hidden])) .footer-links { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .side-note, .side-note-tape:active { transform: none; }
}
