@font-face {
  font-family: "Press Start 2P";
  src: url("assets/fonts/press-start-2p-latin.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * Retro LCD skin: pixel-art creatures on a chunky handheld V-pet.
 * Everything is scoped to html[data-skin="retro"], so the Classic look is untouched.
 * Switch skins in Settings -> Retro LCD Skin.
 */
html[data-skin="retro"] {
  --lcd-0: #1b2a1c;   /* ink */
  --lcd-1: #3f5a3a;
  --lcd-2: #7f9a5a;
  --lcd-3: #b6cc8a;
  --lcd-4: #d8e6b4;   /* paper */
  --shell: #2f64c4;
  --shell-hi: #5d8fe6;
  --shell-lo: #1b3d85;
  --shell-edge: #0f2358;
  --font-ui: "Courier New", "SF Mono", ui-monospace, Menlo, monospace;
  --font-copy: "Courier New", "SF Mono", ui-monospace, Menlo, monospace;
  --device-radius: 34px;
  --ink: #12142a;
  --font-pixel: "Press Start 2P", "Courier New", ui-monospace, monospace;
}

/* ---------------------------------------------------------------- page + shell */
html[data-skin="retro"] body {
  font-family: var(--font-copy);
  background:
    radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.5px) 0 0 / 8px 8px,
    linear-gradient(#171a38, #0d0f24);
}
html[data-skin="retro"] .ambient { display: none; }

html[data-skin="retro"] .device {
  border: 4px solid var(--shell-edge);
  border-radius: var(--device-radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.22) 0 14px, transparent 14px),
    linear-gradient(160deg, var(--shell-hi) 0, var(--shell) 38%, var(--shell-lo) 100%);
  box-shadow:
    0 8px 0 var(--shell-edge),
    0 22px 40px rgba(0,0,0,.5),
    inset 0 -6px 0 rgba(0,0,0,.28),
    inset 0 3px 0 rgba(255,255,255,.4);
}
html[data-skin="retro"] .device::before { border: 2px dashed rgba(255,255,255,.18); border-radius: 26px; }
html[data-skin="retro"] .device::after { background: var(--shell-edge); }
html[data-skin="retro"] .device-ridge { background: var(--shell-edge); border-radius: 0 0 6px 6px; }
html[data-skin="retro"] .device-header span { color: #fff; letter-spacing: .22em; text-shadow: 2px 2px 0 var(--shell-edge); }
html[data-skin="retro"] .device-header strong { color: #ffe066; text-shadow: 2px 2px 0 var(--shell-edge); }
html[data-skin="retro"] .brand-mark i { background: #ffe066; box-shadow: none; }

html[data-skin="retro"] .screen-frame {
  padding: 10px;
  border: 3px solid var(--shell-edge);
  border-radius: 12px;
  background: #0b0d1e;
  box-shadow: inset 0 0 0 3px #2a2f5e, inset 0 4px 0 #000;
}
html[data-skin="retro"] .screen {
  border-radius: 4px;
  background: var(--lcd-4);
  color: var(--lcd-0);
}
/* LCD dot grid over the whole screen */
html[data-skin="retro"] .screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(27,42,28,.13) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(27,42,28,.09) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* square corners everywhere inside the LCD and its dialogs: pixel art has no curves */
html[data-skin="retro"] .screen *,
html[data-skin="retro"] dialog,
html[data-skin="retro"] dialog * { border-radius: 0 !important; }

/* ---------------------------------------------------------------- habitat scene */
/* Sky + scenery are mapped to a 5-shade green LCD palette (luminance -> shade), so
   day/night, weather and biome changes still read, but all in handheld colours. */
html[data-skin="retro"] .habitat { background: var(--lcd-3); }
html[data-skin="retro"] .forest-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
}
/* Scenery is recoloured with three cheap GPU blend layers (no SVG filter, so no per-frame CPU cost on phones):
   hue -> green, shadows lifted to LCD ink, highlights capped at LCD paper. */
html[data-skin="retro"] .forest-scene { isolation: isolate; }
.lcd-tint { display: none; }
html[data-skin="retro"] .lcd-tint { display: block; position: absolute; inset: 0; z-index: 30; pointer-events: none; }
html[data-skin="retro"] .lcd-tint-hue { background: #7f9a5a; mix-blend-mode: color; }
html[data-skin="retro"] .lcd-tint-floor { background: var(--lcd-0); mix-blend-mode: lighten; }
html[data-skin="retro"] .lcd-tint-ceil { background: var(--lcd-4); mix-blend-mode: darken; }
html[data-skin="retro"] .habitat.sleeping-active .forest-scene { filter: brightness(.25); }
html[data-skin="retro"] .sky-orb { background: var(--lcd-4) !important; box-shadow: none !important; border: 3px solid var(--lcd-0); width: 30px; height: 30px; }
html[data-skin="retro"] .orbit { display: none; }
html[data-skin="retro"] .habitat::after {
  height: 4px; left: 0; right: 0; bottom: 34px;
  background: repeating-linear-gradient(90deg, var(--lcd-0) 0 6px, transparent 6px 12px);
  opacity: .55;
}
html[data-skin="retro"] .pixel-stars i { background: var(--lcd-0); width: 4px; height: 4px; animation-timing-function: steps(2, end); }

/* speech bubble: boxy with a hard drop shadow */
html[data-skin="retro"] .speech-bubble {
  border: 3px solid var(--lcd-0);
  background: var(--lcd-4);
  color: var(--lcd-0);
  box-shadow: 4px 4px 0 var(--lcd-0);
  font-family: var(--font-copy);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}
html[data-skin="retro"] .speech-bubble::after {
  bottom: -9px; width: 10px; height: 10px; transform: translateX(-50%);
  border: 0; border-right: 3px solid var(--lcd-0); border-bottom: 3px solid var(--lcd-0);
  background: var(--lcd-4);
}

/* ---------------------------------------------------------------- status + meters */
html[data-skin="retro"] .mood-strip {
  background: var(--lcd-3);
  border-top: 3px solid var(--lcd-0);
}
html[data-skin="retro"] .mood-icon { background: var(--lcd-0); color: var(--lcd-4); }
html[data-skin="retro"] .mood-strip small,
html[data-skin="retro"] .mood-message { color: var(--lcd-1); }
html[data-skin="retro"] .mood-strip strong { color: var(--lcd-0); letter-spacing: .12em; }

html[data-skin="retro"] .gauge-grid { background: var(--lcd-3); border-top: 3px solid var(--lcd-0); gap: 8px; }
html[data-skin="retro"] .gauge-head { color: var(--lcd-1); font-size: 8px; font-weight: 700; }
html[data-skin="retro"] .gauge-head strong { color: var(--lcd-0); font-size: 9px; }
/* segmented meter: chunky blocks instead of a smooth bar */
html[data-skin="retro"] .gauge-track {
  height: 10px;
  border: 2px solid var(--lcd-0);
  background: repeating-linear-gradient(90deg, var(--lcd-2) 0 5px, var(--lcd-3) 5px 7px);
}
html[data-skin="retro"] .gauge-track i {
  background: repeating-linear-gradient(90deg, var(--lcd-0) 0 5px, transparent 5px 7px);
  transition: width .2s steps(6, end);
}
html[data-skin="retro"] .gauge.warning .gauge-track i { background: repeating-linear-gradient(90deg, #8a5a00 0 5px, transparent 5px 7px); }
html[data-skin="retro"] .gauge.danger .gauge-track i { background: repeating-linear-gradient(90deg, #a01c1c 0 5px, transparent 5px 7px); }

/* ---------------------------------------------------------------- bottom menu */
html[data-skin="retro"] .tab-bar {
  background: var(--lcd-0);
  border-top: 3px solid var(--lcd-0);
  gap: 3px;
  padding: 3px;
}
html[data-skin="retro"] .tab-bar button {
  border: 2px solid var(--lcd-2);
  background: var(--lcd-1);
  color: var(--lcd-4);
}
html[data-skin="retro"] .tab-bar button span { font-size: 16px; }
html[data-skin="retro"] .tab-bar button small { font-size: 8px; font-weight: 700; letter-spacing: .06em; }
html[data-skin="retro"] .tab-bar button.active { background: var(--lcd-4); color: var(--lcd-0); border-color: var(--lcd-4); }
html[data-skin="retro"] .tab-bar button.active::after { display: none; }

/* ---------------------------------------------------------------- panels, cards, buttons */
html[data-skin="retro"] .tab-panel { background: var(--lcd-4); color: var(--lcd-0); }
html[data-skin="retro"] .panel-heading h2,
html[data-skin="retro"] .panel-heading small,
html[data-skin="retro"] .panel-heading span { color: var(--lcd-0); }
html[data-skin="retro"] .screen :is(.action-card, .training-card, .daily-signal-card, .data-card, .setting-row, .dex-card, .egg-preview, .info-card, .journal-card) {
  border: 3px solid var(--lcd-0);
  background: var(--lcd-3);
  color: var(--lcd-0);
  box-shadow: 3px 3px 0 var(--lcd-0);
}
html[data-skin="retro"] .screen :is(.action-card, .training-card, .dex-card):active { transform: translate(3px, 3px); box-shadow: none; }
html[data-skin="retro"] .screen :is(.action-card, .training-card) strong { color: var(--lcd-0); }
html[data-skin="retro"] .screen :is(.action-card, .training-card) small { color: var(--lcd-1); }
html[data-skin="retro"] .egg-confirm,
html[data-skin="retro"] .hatch-button,
html[data-skin="retro"] .start-primary {
  border: 3px solid var(--lcd-0);
  background: var(--lcd-0);
  color: var(--lcd-4);
  box-shadow: 4px 4px 0 var(--lcd-1);
  font-family: var(--font-ui);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
html[data-skin="retro"] .egg-selector { background: var(--lcd-4); color: var(--lcd-0); }
html[data-skin="retro"] .egg-selector h2,
html[data-skin="retro"] .egg-selector small,
html[data-skin="retro"] .egg-selector p { color: var(--lcd-0); }
html[data-skin="retro"] .egg-arrow { border: 3px solid var(--lcd-0); background: var(--lcd-3); color: var(--lcd-0); box-shadow: 3px 3px 0 var(--lcd-0); }
html[data-skin="retro"] .setting-toggle { border: 2px solid var(--lcd-0); background: var(--lcd-3); }
html[data-skin="retro"] .setting-toggle[aria-checked="true"] { background: var(--lcd-0); color: var(--lcd-4); }
html[data-skin="retro"] .toast { background: var(--lcd-0); color: var(--lcd-4); border: 3px solid var(--lcd-4); font-weight: 700; text-transform: uppercase; }
html[data-skin="retro"] .creature-label strong { letter-spacing: .12em; }


/* ---------------------------------------------------------------- type */
html[data-skin="retro"] .screen *,
html[data-skin="retro"] dialog * { font-family: var(--font-ui) !important; letter-spacing: 0; -webkit-font-smoothing: none; }
html[data-skin="retro"] .screen :is(h1, h2, h3) { font-weight: 800; text-transform: uppercase; letter-spacing: .04em !important; }
html[data-skin="retro"] .screen :is(small, .panel-heading span) { text-transform: uppercase; }

/* The old theme paints cards with smooth gradients. Flatten them everywhere except the habitat
   (home tab), then the targeted rules below re-add the flat LCD fills. Keep this rule first. */
html[data-skin="retro"] .tab-panel:not([data-panel="home"]) :where(*:not(img):not(svg)) {
  background-image: none;
  box-shadow: none;
  text-shadow: none;
}

/* ---------------------------------------------------------------- leftover old-theme colours */
html[data-skin="retro"] .tab-panel *,
html[data-skin="retro"] .egg-selector * { color: var(--lcd-0) !important; }
html[data-skin="retro"] .tab-panel :is(small, p, .mood-message, .care-tip) { color: var(--lcd-1) !important; }
html[data-skin="retro"] .egg-confirm, html[data-skin="retro"] .hatch-button { color: var(--lcd-4) !important; }
html[data-skin="retro"] .tab-panel :is(.action-icon, .daily-signal-objective > i, .daily-signal-objective > span:first-child) {
  background: var(--lcd-4) !important; border: 2px solid var(--lcd-0); color: var(--lcd-0) !important;
}
html[data-skin="retro"] .tab-panel :is(.daily-signal-objective, .care-tip, .dex-card .dex-card-thumb-wrap) {
  background: var(--lcd-4) !important; border: 2px solid var(--lcd-0);
}
html[data-skin="retro"] .daily-signal-card header > span,
html[data-skin="retro"] .panel-heading > span {
  background: var(--lcd-0) !important; color: var(--lcd-4) !important; border: 0; padding: 3px 6px;
}
html[data-skin="retro"] .daily-signal-card header > span { color: var(--lcd-4) !important; }
html[data-skin="retro"] .panel-heading > span { color: var(--lcd-4) !important; }
html[data-skin="retro"] .dex-filters button, html[data-skin="retro"] .train-filter-bar button {
  border: 2px solid var(--lcd-0); background: var(--lcd-3);
}
html[data-skin="retro"] .dex-filters button.active,
html[data-skin="retro"] .dex-filters button[aria-selected="true"],
html[data-skin="retro"] .train-filter-bar button.active,
html[data-skin="retro"] .train-filter-bar button[aria-selected="true"] { background: var(--lcd-0); }
html[data-skin="retro"] .dex-filters button.active, html[data-skin="retro"] .dex-filters button[aria-selected="true"],
html[data-skin="retro"] .train-filter-bar button.active, html[data-skin="retro"] .train-filter-bar button[aria-selected="true"] { color: var(--lcd-4) !important; }
html[data-skin="retro"] .dex-progress, html[data-skin="retro"] .dex-progress-bar { background: var(--lcd-2); border: 2px solid var(--lcd-0); }
html[data-skin="retro"] .dex-card.locked .dex-thumb { filter: brightness(0) opacity(.5); }

/* journal button + header badge in the shell */
html[data-skin="retro"] .header-journal-btn {
  border: 3px solid var(--shell-edge); background: var(--lcd-4); box-shadow: 3px 3px 0 var(--shell-edge); color: var(--lcd-0);
}
html[data-skin="retro"] .journal-badge-count { background: var(--lcd-0); color: var(--lcd-4); }
html[data-skin="retro"] .screen-status { background: var(--lcd-3); border-bottom: 3px solid var(--lcd-0); color: var(--lcd-0); }
html[data-skin="retro"] .signal-dot { background: var(--lcd-0); box-shadow: none; }

/* ---------------------------------------------------------------- second pass: remaining cards + tracks */
html[data-skin="retro"] .tab-panel :is(.xp-card, .companion-profile-card, .data-accordion, .evolution-lineage, .data-list,
  .data-row, .activity-history-list, .activity-history-list li, .evolution-node, .data-setting-action, .stat-chip, .battle-stat) {
  background: var(--lcd-3) !important;
  border: 2px solid var(--lcd-0) !important;
  box-shadow: none;
}
html[data-skin="retro"] .tab-panel :is(.data-accordion, .xp-card, .companion-profile-card) { box-shadow: 3px 3px 0 var(--lcd-0); }
html[data-skin="retro"] .tab-panel .evolution-node.current { background: var(--lcd-4) !important; border-width: 3px !important; }
html[data-skin="retro"] .tab-panel .data-row { background: var(--lcd-4) !important; }
html[data-skin="retro"] .tab-panel :is(.progress-track, .evolution-signal-track) {
  height: 10px; border: 2px solid var(--lcd-0) !important;
  background: repeating-linear-gradient(90deg, var(--lcd-2) 0 5px, var(--lcd-3) 5px 7px) !important;
}
html[data-skin="retro"] .tab-panel :is(.progress-track, .evolution-signal-track) > * {
  background: repeating-linear-gradient(90deg, var(--lcd-0) 0 5px, transparent 5px 7px) !important;
}
html[data-skin="retro"] .tab-panel .training-symbol {
  background: var(--lcd-4) !important; border: 2px solid var(--lcd-0); color: var(--lcd-0) !important;
}
html[data-skin="retro"] .tab-panel button:not(.action-card):not(.training-card) { border: 2px solid var(--lcd-0); background-color: var(--lcd-4); }
html[data-skin="retro"] .habitat-synergy-badge { background: var(--lcd-4) !important; border: 3px solid var(--lcd-0) !important; box-shadow: 3px 3px 0 var(--lcd-0); }
html[data-skin="retro"] .habitat-synergy-badge * { color: var(--lcd-0) !important; }
html[data-skin="retro"] .mood-icon { background: var(--lcd-0) !important; color: var(--lcd-4) !important; }
html[data-skin="retro"] .mood-message { color: var(--lcd-1) !important; }
html[data-skin="retro"] .habitat .creature-label, html[data-skin="retro"] .habitat .creature-label * { color: var(--lcd-4) !important; text-shadow: 2px 2px 0 var(--lcd-0); }

html[data-skin="retro"] .tab-panel:not([data-panel="home"]) :is(.profile-record, .evolution-signal-card, .evolution-path, .battle-profile, .stat-grid > *, .profile-grid > *) {
  background-color: var(--lcd-3) !important;
  border: 2px solid var(--lcd-0) !important;
}

/* any leftover teal borders from the old theme -> LCD ink (targeted rules above are more specific) */
html[data-skin="retro"] .tab-panel * { border-color: var(--lcd-1); }
html[data-skin="retro"] .tab-panel .profile-record { border: 0 !important; }

/* ================================================================ stepped motion
   Everything that moves snaps to whole pixels at a handheld frame rate. */
html[data-skin="retro"] .cloud { animation-timing-function: steps(60, end); }

/* ================================================================ digivolution cinematic
   gathering -> morphing -> flashing -> revealed (phases driven by app.js, unchanged) */
html[data-skin="retro"] .evolution-ceremony-dialog {
  width: min(94vw, 420px);
  border: 4px solid var(--lcd-4);
  background: var(--lcd-0);
  box-shadow: 0 0 0 4px var(--lcd-0), 8px 8px 0 rgba(0, 0, 0, .55);
  color: var(--lcd-4);
}
html[data-skin="retro"] .evolution-ceremony-dialog::backdrop { background: rgba(10, 16, 10, .9); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-skin="retro"] .evolution-ceremony-dialog * { color: var(--lcd-4) !important; }
/* falling data columns instead of soft rays and rings */
html[data-skin="retro"] .ceremony-rays,
html[data-skin="retro"] .ceremony-ring,
html[data-skin="retro"] .ceremony-aura-glow { display: none; }
html[data-skin="retro"] .ceremony-backdrop::before {
  content: "";
  position: absolute;
  inset: -40px 0 0;
  opacity: .45;
  background:
    repeating-linear-gradient(90deg, transparent 0 14px, var(--lcd-2) 14px 18px, transparent 18px 34px),
    repeating-linear-gradient(0deg, var(--lcd-0) 0 6px, transparent 6px 14px);
  background-blend-mode: normal;
  animation: retro-data-fall .6s steps(6) infinite;
  -webkit-mask-image: repeating-linear-gradient(0deg, #000 0 6px, transparent 6px 20px);
          mask-image: repeating-linear-gradient(0deg, #000 0 6px, transparent 6px 20px);
}
@keyframes retro-data-fall { to { transform: translateY(20px); } }

html[data-skin="retro"] .ceremony-title { color: #ffe066 !important; text-shadow: 3px 3px 0 #000; letter-spacing: .08em; }
html[data-skin="retro"] .ceremony-badge { background: var(--lcd-4) !important; color: var(--lcd-0) !important; border: 0; }
html[data-skin="retro"] .ceremony-badge, html[data-skin="retro"] .ceremony-badge * { color: var(--lcd-0) !important; }
html[data-skin="retro"] .ceremony-summary-card { background: var(--lcd-1) !important; border: 3px solid var(--lcd-4) !important; box-shadow: 4px 4px 0 #000; backdrop-filter: none; }

/* 1. gathering: the old form flashes to a white silhouette and trembles */
html[data-skin="retro"] .evolution-ceremony-dialog.phase-gathering .ceremony-prev {
  filter: none;
  animation: retro-evo-blink .5s steps(1) infinite, retro-evo-shake .12s steps(1) infinite;
}
@keyframes retro-evo-blink { 0%, 49% { filter: none; } 50%, 100% { filter: brightness(0) invert(1); } }
@keyframes retro-evo-shake { 0% { translate: -3px 0; } 50% { translate: 3px 0; } 100% { translate: 0 -3px; } }
/* 2. morphing: old and new forms trade places as silhouettes, faster and bigger each beat */
html[data-skin="retro"] .evolution-ceremony-dialog.phase-morphing .ceremony-prev,
html[data-skin="retro"] .evolution-ceremony-dialog.phase-morphing .ceremony-next {
  opacity: 1; transform: none; filter: brightness(0) invert(1); animation-duration: .36s; animation-timing-function: steps(1); animation-iteration-count: infinite;
}
html[data-skin="retro"] .evolution-ceremony-dialog.phase-morphing .ceremony-prev { animation-name: retro-evo-swap-a; }
html[data-skin="retro"] .evolution-ceremony-dialog.phase-morphing .ceremony-next { animation-name: retro-evo-swap-b; }
@keyframes retro-evo-swap-a { 0%, 49% { visibility: visible; scale: 1; } 50%, 100% { visibility: hidden; } }
@keyframes retro-evo-swap-b { 0%, 49% { visibility: hidden; } 50%, 100% { visibility: visible; scale: 1.1; } }
/* 3. flash: hard LCD blink, no soft glow */
html[data-skin="retro"] .ceremony-flash-overlay { background: var(--lcd-4); inset: -100px; transition: none; }
html[data-skin="retro"] .evolution-ceremony-dialog.phase-flashing .ceremony-flash-overlay { animation: retro-evo-flash .3s steps(1) infinite; opacity: 1; }
@keyframes retro-evo-flash { 0% { background: #fff; } 33% { background: var(--lcd-0); } 66% { background: var(--lcd-4); } }
/* 4. reveal: the new form hops in place, in whole pixels */
html[data-skin="retro"] .evolution-ceremony-dialog.phase-revealed .ceremony-next {
  filter: none; opacity: 1; transform: none; visibility: visible;
  animation: retro-evo-hop .7s steps(1) infinite;
}
@keyframes retro-evo-hop { 0%, 40% { translate: 0 0; } 20% { translate: 0 -12px; } 60% { translate: 0 -12px; } 80% { translate: 0 0; } }
html[data-skin="retro"] .evolution-ceremony-dialog.phase-revealed .ceremony-sprite-wrap::before,
html[data-skin="retro"] .evolution-ceremony-dialog.phase-revealed .ceremony-sprite-wrap::after {
  content: ""; position: absolute; width: 6px; height: 6px; background: #ffe066;
  box-shadow: -66px -48px 0 #ffe066, 54px -66px 0 #fff, 78px 12px 0 #ffe066, -84px 30px 0 #fff, 6px -90px 0 #ffe066, -30px 72px 0 #fff;
  animation: retro-sparkle .5s steps(1) infinite; top: 50%; left: 50%;
}
html[data-skin="retro"] .evolution-ceremony-dialog.phase-revealed .ceremony-sprite-wrap::after { animation-delay: .25s; transform: scale(-1, 1); }
@keyframes retro-sparkle { 0% { opacity: 1; } 50% { opacity: 0; } }

/* ================================================================ battle screen */
html[data-skin="retro"] .vpet-battle {
  border: 4px solid var(--lcd-0);
  background: linear-gradient(var(--lcd-4) 0 64%, var(--lcd-3) 64%);
  min-height: 250px;
}
html[data-skin="retro"] .vpet-battle::after { border-top: 4px solid var(--lcd-0); box-shadow: none; }
html[data-skin="retro"] .battle-unit { padding-bottom: 38px; }
html[data-skin="retro"] .battle-unit strong { color: var(--lcd-0); font-size: 8px; font-weight: 700; }
html[data-skin="retro"] .battle-health { height: 8px; border: 2px solid var(--lcd-0); background: var(--lcd-3); box-shadow: none; }
html[data-skin="retro"] .battle-health i { background: repeating-linear-gradient(90deg, var(--lcd-0) 0 4px, transparent 4px 6px); }
html[data-skin="retro"] .battle-health.enemy-health i { background: repeating-linear-gradient(90deg, #7a1d1d 0 4px, transparent 4px 6px); }
html[data-skin="retro"] .battle-clash-track i { border: 2px solid var(--lcd-0); background: var(--lcd-4); color: var(--lcd-0); box-shadow: none; transform: none; }
html[data-skin="retro"] .battle-clash-track i.active { background: var(--lcd-0); color: var(--lcd-4); transform: none; box-shadow: none; }
html[data-skin="retro"] .battle-clash-track i.hit.complete { background: var(--lcd-1); color: var(--lcd-4); border-color: var(--lcd-0); }
html[data-skin="retro"] .battle-clash-track i.miss.complete { background: var(--lcd-3); color: var(--lcd-1); border-style: dashed; }
html[data-skin="retro"] .battle-skill-call, html[data-skin="retro"] .battle-result {
  border: 3px solid var(--lcd-0); background: var(--lcd-4); color: var(--lcd-0); box-shadow: 3px 3px 0 var(--lcd-0); font-size: 10px; font-weight: 700;
}
html[data-skin="retro"] .battle-feedback { color: var(--lcd-0); font-size: 12px; text-shadow: 2px 2px 0 var(--lcd-4); }
/* the energy shot becomes a chunky square projectile with a pixel trail */
html[data-skin="retro"] .battle-energy-shot {
  width: 24px; height: 24px; background: var(--lcd-0); box-shadow: -18px 0 0 var(--lcd-1), -36px 0 0 var(--lcd-2), 0 0 0 4px var(--lcd-4);
  animation-timing-function: steps(8, end) !important;
}
html[data-skin="retro"] .vpet-battle.critical-strike .battle-energy-shot { width: 36px; height: 36px; filter: none; box-shadow: -24px 0 0 var(--lcd-1), -48px 0 0 var(--lcd-2), 0 0 0 6px #ffe066; }
html[data-skin="retro"] .vpet-battle.crest-active { border-color: var(--lcd-0); box-shadow: 0 0 0 4px #ffe066; }
html[data-skin="retro"] .vpet-battle.crest-active .battle-echo { filter: none; }
/* hits shake the whole battle box in whole-pixel jolts */
html[data-skin="retro"] .vpet-battle.echo-strike,
html[data-skin="retro"] .vpet-battle.guardian-strike,
html[data-skin="retro"] .vpet-battle.critical-strike { animation: retro-shake .3s steps(1) 2; }
@keyframes retro-shake { 0% { translate: 0 0; } 25% { translate: -4px 2px; } 50% { translate: 4px -2px; } 75% { translate: -2px -2px; } }

/* ================================================================ dialogs + start screen */
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog) {
  border: 4px solid var(--lcd-0);
  background: var(--lcd-4);
  color: var(--lcd-0);
  box-shadow: 0 0 0 4px var(--lcd-4), 8px 8px 0 4px rgba(0, 0, 0, .5);
}
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog)::backdrop { background: rgba(10, 16, 10, .78); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog) :is(h1, h2, h3, p, small, span, strong, b, label, li, div) { color: var(--lcd-0); }
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog) button {
  border: 3px solid var(--lcd-0); background: var(--lcd-3); color: var(--lcd-0); box-shadow: 3px 3px 0 var(--lcd-0); font-weight: 700; text-transform: uppercase;
}
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog) button:active { transform: translate(3px, 3px); box-shadow: none; }
html[data-skin="retro"] dialog:not(.evolution-ceremony-dialog) input { border: 3px solid var(--lcd-0); background: var(--lcd-4); color: var(--lcd-0); }
html[data-skin="retro"] .start-menu, html[data-skin="retro"] #start-menu { background: var(--lcd-4); color: var(--lcd-0); }
html[data-skin="retro"] #start-menu :is(h1, h2, h3, p, small, span, strong, b, div) { color: var(--lcd-0) !important; }
html[data-skin="retro"] #start-menu :is(button) { border: 3px solid var(--lcd-0); background: var(--lcd-3); color: var(--lcd-0) !important; box-shadow: 4px 4px 0 var(--lcd-0); }
html[data-skin="retro"] #start-menu :is(button.start-primary, #play-button) { background: var(--lcd-0); color: var(--lcd-4) !important; }
html[data-skin="retro"] #start-menu :is(button.start-primary, #play-button) * { color: var(--lcd-4) !important; }
html[data-skin="retro"] .evolution-ceremony-dialog button,
html[data-skin="retro"] .evolution-ceremony-dialog button * {
  background: var(--lcd-4) !important; color: var(--lcd-0) !important;
}
html[data-skin="retro"] .evolution-ceremony-dialog button { border: 3px solid #000 !important; box-shadow: 4px 4px 0 #000 !important; font-weight: 700; text-transform: uppercase; }

/* ================================================================ palette normaliser (see retro-skin.js)
   Tone tags are set at runtime from each container's real background. --retro-fg inherits down the
   tree, so text always contrasts with the nearest tagged panel behind it, at any nesting depth. */
html[data-skin="retro"] [data-retro-tone] { background-image: none !important; box-shadow: none; text-shadow: none; }
html[data-skin="retro"] [data-retro-tone="dark"]  { --retro-fg: var(--lcd-4); --retro-dim: var(--lcd-3); background-color: var(--lcd-1) !important; border-color: var(--lcd-4); }
html[data-skin="retro"] [data-retro-tone="mid"]   { --retro-fg: var(--lcd-0); --retro-dim: var(--lcd-1); background-color: var(--lcd-2) !important; border-color: var(--lcd-0); }
html[data-skin="retro"] [data-retro-tone="light"] { --retro-fg: var(--lcd-0); --retro-dim: var(--lcd-1); background-color: var(--lcd-3) !important; border-color: var(--lcd-1); }
html[data-skin="retro"] [data-retro-tone="pale"]  { --retro-fg: var(--lcd-0); --retro-dim: var(--lcd-1); background-color: var(--lcd-4) !important; border-color: var(--lcd-1); }
html[data-skin="retro"] [data-retro-tone] :where(*:not(img):not(svg):not(canvas):not(.echo-sprite)) { color: var(--retro-fg) !important; }
html[data-skin="retro"] [data-retro-tone] :where(small, p, label, .dim) { color: var(--retro-dim) !important; }
html[data-skin="retro"] [data-retro-tone][data-retro-tone] { color: var(--retro-fg) !important; }
/* accent chips that were coloured on purpose keep a hard LCD outline so they still read as chips */
html[data-skin="retro"] .screen [data-retro-tone="dark"]:is(button, span, b, strong, small) { border: 2px solid var(--lcd-4); }

/* adventure map nodes: states shown with fill pattern instead of hue */
html[data-skin="retro"] .adventure-map { background: var(--lcd-3) !important; border: 3px solid var(--lcd-0); }
html[data-skin="retro"] .adventure-map * { color: var(--lcd-0) !important; }
html[data-skin="retro"] .adventure-map [class*="node"] { border: 3px solid var(--lcd-0) !important; background: var(--lcd-4) !important; }
html[data-skin="retro"] .adventure-map [class*="node"][class*="cleared"], html[data-skin="retro"] .adventure-map [class*="node"][class*="done"] { background: var(--lcd-1) !important; }
html[data-skin="retro"] .adventure-map [class*="node"][class*="cleared"] *, html[data-skin="retro"] .adventure-map [class*="node"][class*="done"] * { color: var(--lcd-4) !important; }
html[data-skin="retro"] .adventure-map [class*="node"][class*="locked"] { background: var(--lcd-3) !important; border-style: dashed !important; opacity: .7; }
html[data-skin="retro"] .adventure-map [class*="node"][class*="boss"] { border-width: 5px !important; }

/* ---- battle box: fit two 2x sprites, keep labels readable (the dialog around it may be a dark tone) */
html[data-skin="retro"] .battle-unit { min-width: 0; padding-left: 0; padding-right: 0; }
html[data-skin="retro"] .battle-flash { display: none; }
html[data-skin="retro"] .vpet-battle *:not(img):not(i) { color: var(--lcd-0) !important; }
html[data-skin="retro"] .battle-burst-button { border: 3px solid var(--lcd-0); background: var(--lcd-4); box-shadow: 4px 4px 0 var(--lcd-0); }
html[data-skin="retro"] .battle-burst-button .burst-ring { display: none; }
html[data-skin="retro"] .battle-burst-button .burst-text { font-weight: 700; letter-spacing: .08em; }

/* tab bar keeps its own two-tone styling regardless of any tagged ancestor */
html[data-skin="retro"] .tab-bar button, html[data-skin="retro"] .tab-bar button * { color: var(--lcd-4) !important; }
html[data-skin="retro"] .tab-bar button.active, html[data-skin="retro"] .tab-bar button.active * { color: var(--lcd-0) !important; }

/* active filter chips + mood icon: explicit, last, and specific enough to beat tone rules */
html[data-skin="retro"] .screen .tab-panel :is(.dex-filters, .train-filter-bar) button:is(.active, [aria-selected="true"]),
html[data-skin="retro"] .screen .tab-panel :is(.dex-filters, .train-filter-bar) button:is(.active, [aria-selected="true"]) * {
  background-color: var(--lcd-0) !important; color: var(--lcd-4) !important;
}
html[data-skin="retro"] .screen .mood-strip .mood-icon, html[data-skin="retro"] .screen .mood-strip .mood-icon * { background: var(--lcd-0) !important; color: var(--lcd-4) !important; }

/* ---- status meters: label above value so "HEALTH 100/100" always fits */
html[data-skin="retro"] .gauge-head { flex-direction: column; align-items: flex-start; gap: 2px; }

/* ---- Timed Strikes on the LCD: chunky track, block marker, hard-edged result */
html[data-skin="retro"] .training-timing { border: 4px solid var(--lcd-0) !important; background: var(--lcd-4) !important; box-shadow: 6px 6px 0 var(--lcd-0) !important; top: 10%; }
html[data-skin="retro"] .training-timing small { color: var(--lcd-0) !important; font-family: var(--font-pixel) !important; font-size: 8px; letter-spacing: 0; }
html[data-skin="retro"] .tt-track { height: 28px; border: 3px solid var(--lcd-0); background: var(--lcd-3); }
html[data-skin="retro"] .tt-good { background: var(--lcd-2); }
html[data-skin="retro"] .tt-perfect { background: var(--lcd-0); }
html[data-skin="retro"] .tt-marker { width: 8px; margin-left: -4px; border-radius: 0; background: #fff; box-shadow: 0 0 0 3px #000; }
html[data-skin="retro"] .tt-button { border: 3px solid var(--lcd-0); background: var(--lcd-0); color: var(--lcd-4); box-shadow: 4px 4px 0 var(--lcd-1); font-family: var(--font-pixel) !important; font-size: 12px; letter-spacing: .1em; }
html[data-skin="retro"] .tt-cancel { color: var(--lcd-1) !important; font-family: var(--font-pixel) !important; font-size: 7px; letter-spacing: 0; }
html[data-skin="retro"] .tt-result { color: var(--lcd-0) !important; font-family: var(--font-pixel) !important; font-size: 12px; letter-spacing: 0; }
html[data-skin="retro"] .affinity-badge { color: var(--lcd-0) !important; font-family: var(--font-pixel) !important; font-size: 7px; letter-spacing: 0; }
html[data-skin="retro"] .training-card.favoured { box-shadow: 3px 3px 0 var(--lcd-0), inset 0 0 0 3px var(--lcd-4) !important; }
html[data-skin="retro"] .training-variety-hint { color: var(--lcd-1) !important; font-size: 9px; }
html[data-skin="retro"] .affinity-badge::before { content: "FAV "; }
html[data-skin="retro"] .tt-cancel { border: 0 !important; background: none !important; box-shadow: none !important; padding: 2px; justify-self: center; }
html[data-skin="retro"] .tt-button { background: var(--lcd-0) !important; color: var(--lcd-4) !important; }

/* ---- Expedition picker, away sign, hint dot on the LCD */
html[data-skin="retro"] .approach-btn { border: 3px solid var(--lcd-0); background: var(--lcd-3) !important; box-shadow: 3px 3px 0 var(--lcd-0); }
html[data-skin="retro"] .approach-btn strong { font-family: var(--font-pixel) !important; font-size: 9px; letter-spacing: 0; }
html[data-skin="retro"] .approach-btn small { font-size: 8px; }
html[data-skin="retro"] .approach-btn.active { background: var(--lcd-0) !important; box-shadow: 3px 3px 0 var(--lcd-1); }
html[data-skin="retro"] .approach-btn.active strong, html[data-skin="retro"] .approach-btn.active small { color: var(--lcd-4) !important; }
html[data-skin="retro"] .expedition-bonus-line { color: var(--lcd-1) !important; font-size: 9px; }
html[data-skin="retro"] .expedition-approach-note { background: var(--lcd-3) !important; border: 3px solid var(--lcd-0); color: var(--lcd-0) !important; }
html[data-skin="retro"] .expedition-approach-note[data-tone="setback"] { background: var(--lcd-0) !important; color: var(--lcd-4) !important; }
html[data-skin="retro"] .away-sign { border: 4px solid var(--lcd-0); border-radius: 0; background: var(--lcd-4); color: var(--lcd-0); box-shadow: 4px 4px 0 var(--lcd-0); }
html[data-skin="retro"] .away-sign * { color: var(--lcd-0) !important; font-family: var(--font-pixel) !important; }
html[data-skin="retro"] .away-sign strong { font-size: 9px; letter-spacing: 0; }
html[data-skin="retro"] .away-sign small { font-size: 7px; line-height: 1.6; }
html[data-skin="retro"] .away-icon { animation: none; filter: grayscale(1) contrast(1.4); }
html[data-skin="retro"] .tab-bar button.has-hint::before { border-radius: 0; background: #ffe066; box-shadow: 0 0 0 2px #000; animation: none; }

/* icons follow the LCD palette on the retro screen */
html[data-skin="retro"] .px-icon { filter: grayscale(1) contrast(1.15); }
html[data-skin="retro"] .tab-bar button.active .px-icon { filter: grayscale(1) contrast(1.15) brightness(.55); }

/* arcade games on the LCD screen keep their own bright pixel look */
html[data-skin="retro"] .echo-mg-card, html[data-skin="retro"] .echo-mg-card * { color: #fff !important; font-family: var(--font-ui) !important; }
html[data-skin="retro"] .echo-mg-card .echo-mg-start { color: #3b2a00 !important; }

/* arcade games keep bright, readable text on the LCD screen (the LCD palette rules would otherwise darken it) */
html[data-skin="retro"] .echo-mg-arena :is(.echo-mg-hud, .echo-mg-hud *, .echo-mg-hint, .echo-mg-count, .echo-mg-banner, .ms-pad, .ms-pad *, .lr-tap, .sc-float) { color: #fff !important; }
html[data-skin="retro"] .echo-mg-arena .ms-status { color: #fff !important; }
html[data-skin="retro"] .echo-mg-arena .ms-status.watch { color: #ffd166 !important; }
html[data-skin="retro"] .echo-mg-arena .ms-status.turn { color: #8bf3b0 !important; }
html[data-skin="retro"] .echo-mg-arena .ms-status.bad { color: #ff8da0 !important; }
html[data-skin="retro"] .echo-mg-arena .st-practice, html[data-skin="retro"] .echo-mg-arena .sc-combo { color: #3b2a00 !important; }
html[data-skin="retro"] .echo-mg-arena .echo-mg-popup { text-shadow: 0 3px 0 #000; }

/* the moon and the bubble stay round even though the LCD screen squares everything else */
html[data-skin="retro"] .screen .sleep-moon, html[data-skin="retro"] .screen .sleep-dream { border-radius: 50% !important; }
html[data-skin="retro"] .friend-hearts .px-heart { filter: grayscale(1) contrast(1.15); }
html[data-skin="retro"] .friend-hearts .px-heart.off { opacity: .3; }
html[data-skin="retro"] .social-tabs button.active { background: var(--lcd-0) !important; }
html[data-skin="retro"] .social-tabs button.active, html[data-skin="retro"] .social-tabs button.active * { color: var(--lcd-4) !important; }
html[data-skin="retro"] .ranking-row.me { border-width: 3px; }
html[data-skin="retro"] .ranking-row em { font-family: var(--font-pixel) !important; font-size: 14px; letter-spacing: 0; }
html[data-skin="retro"] .gift-row > button.gift-go, html[data-skin="retro"] .gift-inbox .gift-row > button, html[data-skin="retro"] .ranking-play { background: var(--lcd-0) !important; color: var(--lcd-4) !important; border-color: var(--lcd-0) !important; }
html[data-skin="retro"] .friend-gift.ready { background: var(--lcd-4) !important; border-color: var(--lcd-0) !important; animation: none; }
