/* Sizes are in rem and the root scales with the screen height, so the home
   screen looks the same at 720p, 1080p and 4K (16 px at 1080p). */
html { font-size: calc(100vh / 67.5 * var(--text-scale, 1)); }
/* The same unit without the text size: pictures, covers and tiles keep their
   size when only the text grows, so every tab still fits on screen. */
:root { --u: calc(100vh / 67.5); }
html, body { height: 100%; overflow: hidden; background: var(--bg); user-select: none; cursor: default; }
body { position: relative; }

.icon { width: 1.5rem; height: 1.5rem; display: block; }
.glyph { font-size: 1.0625rem; }

/* ---------- background: the user's video or picture, the focused game's art over it ---------- */
.backdrop { position: absolute; inset: 0; }
.wall, .hero, .trailer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease;
}
.wall.shown, .hero.shown, .trailer.shown { opacity: 1; }
/* Keeps text readable over any art: darker on the left, where the info sits. */
.scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(30, 31, 34, 0.92) 0%, rgba(30, 31, 34, 0.6) 45%, rgba(30, 31, 34, 0.25) 100%),
    linear-gradient(0deg, rgba(30, 31, 34, 0.9) 0%, rgba(30, 31, 34, 0) 45%);
}

/* ---------- top bar ---------- */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 2.5rem 4rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.tabs { display: flex; align-items: center; gap: 1.75rem; }
.tab, #clock { font-weight: 600; font-size: 1.125rem; color: var(--muted); }
.tab.active, #clock { color: var(--text); }
#clock { font-variant-numeric: tabular-nums; }

/* ---------- every tab: info on the left, a row of tiles at the bottom ---------- */
.view { position: absolute; inset: 7rem 0 7.5rem; z-index: 1; display: flex; flex-direction: column; }

/* The info sits right above the row, so its button stays in one place on
   every tab and only the logo or title grows upward. */
.info { flex: 0 1 auto; min-height: 0; overflow: hidden; margin-top: auto; margin-bottom: 2rem; padding: calc(3 * var(--u) / var(--text-scale, 1)) 4rem 0; max-width: 50rem; }
.lead { height: calc(11 * var(--u) / var(--text-scale, 1)); display: flex; align-items: flex-end; }
.logo { max-width: calc(32 * var(--u)); max-height: calc(11 * var(--u) / var(--text-scale, 1)); object-fit: contain; object-position: left bottom; display: block; }
/* Icons that bring their own plate get the app's rounded corners. */
.lead-icon { width: calc(7 * var(--u)); height: calc(7 * var(--u)); object-fit: contain; border-radius: calc(1 * var(--u)); }
.lead-cover { width: calc(11 * var(--u) / var(--text-scale, 1)); height: calc(11 * var(--u) / var(--text-scale, 1)); border-radius: calc(0.75 * var(--u)); object-fit: cover; background: var(--surface); }
.lead-symbol { width: calc(7 * var(--u)); height: calc(7 * var(--u)); border-radius: calc(1 * var(--u)); background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.lead-symbol .icon { width: calc(3.5 * var(--u)); height: calc(3.5 * var(--u)); }
.title { margin: 1.5rem 0 0; font-family: var(--font-display); font-weight: 600; font-size: min(3.5rem, calc(4.2 * var(--u))); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead:has(.logo) + .title { display: none; }
.meta { margin: 1.25rem 0 0; color: var(--muted); font-size: 1.125rem; min-height: 1.5rem; }
.meta:empty { display: none; }
.action { margin-top: 1.75rem; display: inline-flex; align-items: center; gap: 0.75rem; height: 3rem; padding: 0 1.25rem 0 1.5rem; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 1.125rem; }
.action .glyph { color: var(--on-accent); }
/* Next to the action: other buttons that work here. */
.info .hints { display: inline-flex; gap: 2rem; margin-left: 1.5rem; vertical-align: middle; }
.info .progress + .hints, .info .meta + .hints { display: flex; margin: 1.75rem 0 0; }
.info .hint { display: inline-flex; align-items: center; gap: 0.625rem; font-weight: 600; font-size: 1.25rem; white-space: nowrap; }
.info .hint .plus { margin: 0 -0.125rem; }
/* Hints that do not fit next to the action go, all together, on their own
   line under it (placeHints measures it). */
/* A row too long even for its own line (longer words in Spanish) wraps, a
   whole hint at a time, instead of being cut at the edge. */
.info .hints.below { display: flex; flex-wrap: wrap; row-gap: 1rem; width: auto; max-width: 100%; margin: 1.25rem 0 0; }
.info .source { margin: 0; font-weight: 600; font-size: 1.125rem; color: var(--muted); }
.info .progress { margin-top: 1.25rem; max-width: 36rem; }

/* Padding leaves room for the focus ring so nothing is clipped. The focused
   tile grows and the rest stay on the bottom line. */
.row {
  /* The focused tile's height (.row .tile.on uses it too). */
  --h-on: calc(11.75 * var(--u));
  flex: none;
  padding: 0.5rem 4rem;
  /* Always as tall as the focused tile: while one tile shrinks and the next
     grows, the row would dip for a moment and the info above it jump. */
  min-height: calc(var(--h-on) * var(--fit, 1) + 2.5rem - 2.5 * var(--u) + 1rem);
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  overflow: hidden;
  scroll-padding: 0 4rem;
}

.tile {
  --w: calc(20 * var(--u));
  --h: calc(9.4 * var(--u));
  flex: none;
  /* --fit: below 1 when the info above needs the room (fitRow). */
  width: calc(var(--w) * var(--fit, 1));
  height: calc(var(--h) * var(--fit, 1) + 2.5rem - 2.5 * var(--u));
  transition: width 160ms ease, height 160ms ease, background-color 200ms ease;
  border-radius: 0.75rem;
  /* --tone: the app's brand or icon colour (toneTile). */
  background: var(--tone, var(--surface));
  box-shadow: inset 0 0 0 var(--line) var(--ring);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.tile.on { box-shadow: 0 0 0 var(--focus) var(--accent); }
/* The focused tile grows by a quarter, in every row. */
.row .tile.on { --w: calc(25 * var(--u)); --h: var(--h-on); }
.tile > img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 200ms ease; }
.tile > img.art.loaded { opacity: 1; }
.tile .tile-icon { width: calc(3.5 * var(--u)); height: calc(3.5 * var(--u)); object-fit: contain; border-radius: calc(0.5 * var(--u)); }
.tile .tile-icon.symbol { color: var(--muted); }
.tile .name { max-width: 15rem; padding: 0 1rem; font-weight: 600; font-size: 1rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .badge { position: absolute; top: 0.625rem; right: 0.625rem; width: 1.5rem; height: 1.5rem; border-radius: 0.375rem; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.tile .badge .icon { width: 1rem; height: 1rem; }
/* Symbols sit in a box as big as an app icon, so names line up. */
.tile.on .icon.symbol, .tile .icon.symbol { width: calc(3.5 * var(--u)); height: calc(3.5 * var(--u)); padding: calc(0.625 * var(--u)); box-sizing: border-box; }
/* The player's card: the song under the app's name. */
.tile.playing { gap: 0.5rem; }
.tile.playing .song { max-width: 15rem; padding: 0 1rem; margin-top: -0.25rem; font-size: 0.9375rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* With a cover: the cover square on the right, the text on the left. */
.tile.with-cover { align-items: flex-start; padding: 0 calc(var(--h) * var(--fit, 1) + 2.5rem - 2.5 * var(--u)) 0 1.25rem; }
.tile.with-cover .name, .tile.with-cover .song { max-width: 100%; padding: 0; text-align: left; }
.tile > img.cover { position: absolute; top: 0; right: 0; height: 100%; aspect-ratio: 1; object-fit: cover; }
.high-contrast .tile { background: var(--surface); }

/* Covers: box-art tiles (2:3); names may take two lines. */
.covers .tile { --w: calc(12 * var(--u)); --h: calc(18 * var(--u)); }
.row.covers { --h-on: calc(22.5 * var(--u)); }
.row.covers .tile.on { --w: calc(15 * var(--u)); }
.grid.covers { grid-template-columns: repeat(auto-fill, calc(12 * var(--u))); gap: 1.5rem; }
.covers .tile .name { max-width: 100%; padding: 0 0.75rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.covers .tile.playing .song { max-width: 100%; padding: 0 0.75rem; }
/* The playing card: the cover square on top, the app and song under it. */
.covers .tile.with-cover { align-items: center; justify-content: flex-end; padding: 0 0 0.875rem; }
.covers .tile.with-cover .tile-icon { display: none; }
.covers .tile.with-cover .name, .covers .tile.with-cover .song { padding: 0 0.75rem; text-align: center; }
.covers .tile > img.cover { right: auto; left: 0; width: 100%; height: auto; }
/* More tiles beyond the edge: they fade out in the margin instead of
   showing cut. */
.row.more-right { mask-image: linear-gradient(90deg, #000 calc(100% - 4rem), transparent calc(100% - 0.5rem)); }
.row.more-left { mask-image: linear-gradient(90deg, transparent 0.5rem, #000 4rem); }
.row.more-left.more-right { mask-image: linear-gradient(90deg, transparent 0.5rem, #000 4rem, #000 calc(100% - 4rem), transparent calc(100% - 0.5rem)); }
/* A game's name shows only without its picture (or in the list). */
.tile > img.art ~ .name { display: none; }

/* Grid: the library takes the screen; the info shrinks to a line and its
   buttons. */
.view.as-grid .info { padding-top: 1rem; margin-top: 0; margin-bottom: 0; }
.view.as-grid .info .lead, .view.as-grid .info .meta, .view.as-grid .info .progress { display: none; }
.view.as-grid .info .title, .view.as-grid .lead:has(.logo) + .title { display: -webkit-box; margin: 0; font-size: 2.5rem; -webkit-line-clamp: 1; }
.view.as-grid .info .action { margin-top: 1.5rem; }
.view.as-grid .grid { margin-top: 2rem; }

/* List: names on the right, the focused item's info where it always is. */
.view.as-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 32rem); grid-template-rows: minmax(0, 1fr); }
.view.as-list .info { grid-column: 1; grid-row: 1; align-self: end; }
.list {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  overflow: hidden;
  /* It starts where the info zone starts. */
  padding: calc(3 * var(--u) / var(--text-scale, 1)) 4rem 0.5rem 0.5rem;
  /* The names that continue below fade out instead of being cut. */
  mask-image: linear-gradient(180deg, #000 calc(100% - 4rem), transparent);
  scroll-padding: 0.5rem 0 4rem;
}
.list .tile { width: 100%; height: 4rem; flex-direction: row; justify-content: flex-start; gap: 1rem; padding: 0 1.25rem; }
.list .tile > img.art { position: static; width: auto; height: 2.5rem; aspect-ratio: 460 / 215; flex: none; border-radius: 0.375rem; }
.list .tile > img.art ~ .name { display: block; }
.list .tile .name { flex: 1; min-width: 0; max-width: none; padding: 0; text-align: left; font-size: 1.125rem; }
.list .tile .tile-icon { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 0.375rem; }
.list .tile .icon.symbol { width: 2.25rem; height: 2.25rem; padding: 0.25rem; flex: none; }
.list .tile.playing .song { flex: 0 1 auto; max-width: 45%; margin: 0; padding: 0; }
.list .tile.with-cover { align-items: center; padding: 0 1.25rem; }
.list .tile > img.cover { display: none; }
/* The list covers the right side, where the music cover would be. */
body.as-list .stage-cover { display: none; }

/* Editing pinned apps: the same tiles in a grid that scrolls with the focus. */
.grid {
  margin-top: 2rem;
  padding: 0.5rem 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, calc(20 * var(--u)));
  gap: 1.25rem;
  align-content: start;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  /* The rows that continue below fade out instead of being cut. */
  mask-image: linear-gradient(180deg, #000 calc(100% - 4rem), transparent);
  /* Scrolling to the focus keeps its ring inside and out of the fade. */
  scroll-padding: 0.5rem 4rem 4rem;
}

.empty .title { display: block; }

/* Finding a game: what was typed, the letters, then the results in the grid. */
.search { padding: calc(2 * var(--u) / var(--text-scale, 1)) 4rem 0; }
.search-field { display: flex; align-items: center; gap: 1rem; height: 4rem; padding: 0 1.5rem; max-width: 50rem; border-radius: var(--radius); background: var(--surface); }
.search-field .icon { width: 1.75rem; height: 1.75rem; color: var(--muted); flex: none; }
.search-field .query { min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 2rem; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.search-field .query.empty { color: var(--muted); }
.search-keys { display: grid; grid-template-columns: repeat(10, 3rem); gap: 0.5rem; margin-top: 1.5rem; }
.search-key { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 0.5rem; background: var(--surface); font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; }
.search-key.on { background: var(--surface-hover); box-shadow: 0 0 0 var(--focus) var(--accent); }
.search .hints { display: flex; gap: 2rem; margin-top: 1.5rem; }
.search .hint { display: inline-flex; align-items: center; gap: 0.625rem; font-weight: 600; font-size: 1.25rem; }
.search + .grid { margin-top: 1.5rem; }
.search-empty { display: flex; align-items: center; gap: 1.25rem; padding: 3rem 4rem 0; }
.search-empty b { display: block; font-weight: 600; font-size: 1.25rem; }
.search-empty span { color: var(--muted); }

/* ---------- mini player ---------- */
.mini-player {
  position: absolute;
  left: 4rem;
  bottom: 2.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.5rem;
  padding: 0 1rem 0 0.5rem;
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 var(--line) var(--ring);
  max-width: 34rem;
}
.mini-player[hidden] { display: none; }
.mini-player .art { width: 2.5rem; height: 2.5rem; border-radius: 0.375rem; object-fit: cover; background: var(--surface-hover); flex: none; }
.mini-player .text { min-width: 0; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player .text b { font-weight: 600; }
.mini-player .text span { color: var(--muted); }
.mini-player .state { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.mini-player .state .icon { width: 1.25rem; height: 1.25rem; }

/* ---------- settings: categories on the left, their options on the right ---------- */
/* Fills the space between the tabs and the button hints and never spills
   over them, at any text size: columns share the width, the preview gives
   up height before the card would grow past the bottom. */
.settings { flex: 1; min-height: 0; padding: 3rem 4rem 1.5rem; }
/* Three columns: categories, options, and the focused option's preview
   (as tall as the options, never shorter than five rows) with its description. */
.settings.list { display: grid; grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr) minmax(0, 0.95fr); grid-template-rows: minmax(0, 1fr); column-gap: 2.5rem; align-items: start; }
.settings.open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 2.5rem; max-width: none; align-items: start; }
.settings.open .cat-title { grid-column: 1 / span 2; }
/* The focused option's card: its preview on top and what it does under it,
   on the same surface as the options, so the text reads over any background. */
.preview-card { display: flex; flex-direction: column; max-height: 100%; min-height: 0; border-radius: 0.75rem; background: var(--surface); overflow: hidden; }
.preview-card[hidden] { display: none; }
.stage { flex: 0 1 23.5rem; min-height: 12rem; position: relative; }
.stage[hidden] { display: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.about { flex: none; margin: 0; padding: 1.25rem 1.5rem 1.5rem; font-size: 1.375rem; line-height: 1.6; }
.stage:not([hidden]) + .about { box-shadow: inset 0 var(--line) 0 var(--ring); }
.about .now { display: block; margin-top: 0.75rem; color: color-mix(in srgb, var(--text) 75%, transparent); }
.about .now:empty { display: none; }
.cats { display: flex; flex-direction: column; gap: 0.5rem; }
.cat { display: flex; align-items: center; gap: 1rem; height: 3.5rem; padding: 0 1.25rem; border-radius: 0.75rem; font-weight: 600; font-size: 1.25rem; color: var(--muted); }
.cat.sel { background: var(--surface); color: var(--text); }
.cat.on { box-shadow: 0 0 0 var(--focus) var(--accent); }
/* With big text the options may not all fit: the list scrolls to the focus
   instead of spilling over the button hints. */
.panel { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border-radius: 0.75rem; background: var(--surface); max-height: 100%; min-height: 0; overflow-y: auto; scrollbar-width: none; scroll-padding: 0.75rem; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: 4rem; padding: 0 1.25rem; border-radius: 0.625rem; font-size: 1.25rem; }
.setting .name { font-weight: 600; }
.setting.on { background: var(--surface-hover); box-shadow: 0 0 0 var(--focus) var(--accent); }
.setting.danger .name { color: var(--danger); }
.setting .value { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); }
.setting .value .icon { width: 1.25rem; height: 1.25rem; }
/* Switch: on in the accent, off in grey. */
.switch { flex: none; position: relative; width: 3.25rem; height: 1.875rem; border-radius: 1rem; background: var(--ring-strong); }
.switch::after { content: ""; position: absolute; top: 0.25rem; left: 0.25rem; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--muted); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 1.625rem; background: var(--on-accent); }
/* Few choices: all in view, the chosen one in a lighter tone. */
/* A slider: the track filled up to the value in the accent, small marks
   on the usual levels, and the amount in words next to it. */
.range { flex: none; display: flex; align-items: center; gap: 1rem; }
.range .track { position: relative; width: 10rem; height: 0.5rem; border-radius: 1rem; background: color-mix(in srgb, var(--text) 22%, var(--surface)); }
.range .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 1rem; background: var(--accent); }
/* Stops on the filled part take the accent's own text tone, so they show on it. */
.range .stop { position: absolute; top: 50%; width: 0.375rem; height: 0.375rem; border-radius: 50%; translate: -50% -50%; background: var(--muted); }
.range .stop.past { background: var(--on-accent-muted); }
/* A ring in the panel's colour detaches the knob from the fill. */
.range .knob { position: absolute; top: 50%; width: 1.375rem; height: 1.375rem; border-radius: 50%; translate: -50% -50%; background: var(--text); box-shadow: 0 0 0 0.1875rem var(--surface); }
.range .amount { min-width: 4rem; text-align: right; color: var(--muted); font-weight: 600; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.setting.on .range .amount { color: var(--text); }
.high-contrast .range .track { box-shadow: inset 0 0 0 var(--line) var(--ring); }
.choice { display: flex; gap: 0.25rem; padding: 0.25rem; border-radius: 0.75rem; background: var(--bg); }
.choice span { padding: 0.5rem 1rem; border-radius: 0.5rem; color: var(--muted); font-weight: 600; font-size: 1.125rem; }
.choice span.sel { background: var(--surface-hover); color: var(--text); }
/* Customizing the buttons: the controller drawn in the middle, what each
   button does on its side. */
/* Three columns: the left hand's seven buttons, the controller, the right
   hand's seven. The side columns share what is left equally (never less than
   --pad-side) and do not depend on their content, so opening a button's
   actions moves nothing; the drawing gives up size before the text. */
.pad-map {
  --pad-side: 18.5rem;
  position: relative;
  grid-column: 2 / span 2;
  display: grid;
  grid-template-columns: minmax(var(--pad-side), 1fr) minmax(0, calc(42.5 * var(--u))) minmax(var(--pad-side), 1fr);
  grid-template-rows: minmax(0, 1fr);
  column-gap: calc(2 * var(--u));
  align-items: stretch;
  height: 100%;
  min-height: 0;
  padding: calc(1.5 * var(--u));
  border-radius: 0.75rem;
  background: var(--surface);
}
.settings.open .pad-map { grid-column: 1 / span 2; }

.pad-side { display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: max(12px, calc(0.75 * var(--u))); min-width: 0; min-height: 0; }
.pad-side.left { justify-items: end; }
.pad-side.right { justify-items: start; }
.pad-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  align-self: center;
  max-width: 100%;
  min-height: calc(3.5 * var(--u));
  padding: calc(0.375 * var(--u)) 1rem;
  border-radius: 0.625rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
}
.pad-side.left .pad-label { flex-direction: row-reverse; text-align: right; }
.pad-label .glyph.inline { flex: none; margin: 0; color: var(--muted); }
.pad-label .value { min-width: 0; overflow-wrap: break-word; }
/* One hand: the other hand's buttons stay usable, quieter. */
.pad-side.idle .pad-label:not(.on) { color: var(--muted); }
.pad-label.on { background: var(--surface-hover); box-shadow: 0 0 0 var(--focus) var(--accent); }
.pad-label.on .glyph.inline { color: var(--text); }

/* The d-pad direction: a cross as big as the LT / LB badges, the arm of that
   direction filled. */
.btn-dpad { box-shadow: none; min-width: 0; padding: 0; }
.btn-dpad .glyph-icon { width: 1.7em; height: 1.7em; }
.btn-dpad .arm-on { fill: var(--text); stroke: none; }

/* ---------- the controller ---------- */
.pad-center { min-width: 0; min-height: 0; display: grid; place-items: center; }
.pad-drawing {
  /* The theme's colours (pad.js sets them on each drawing); these are the
     default graphite. No shadows, no gradients, no shine. */
  --pad-body: #35373c;
  --pad-paint: var(--pad-body);
  --pad-back: #212226;
  --pad-bumper: #2b2d31;
  --pad-well: #26272b;
  --pad-stick: #45474c;
  --pad-dpad: #45474c;
  --pad-face: #2a2b2f;
  --pad-line: #898781;
  --pad-mark: #898781;
  --pad-letter-a: #b2d69c;
  --pad-letter-b: #e9938b;
  --pad-letter-x: #9bb9d9;
  --pad-letter-y: #d6c178;
  /* The focus reads the same on any theme: a black ring outside the accent,
     a blue inside with ivory letters. */
  --pad-halo: #000000;
  --pad-on: color-mix(in srgb, var(--accent) 45%, #16171a);
  --pad-stroke: 3px;
  --pad-detail: 2px;
  --pad-focus: 3.5px;
  width: 100%;
  max-height: 100%;
  display: block;
  overflow: visible;
}
.pad-drawing * { vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.pad-drawing .body { fill: var(--pad-paint); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .trigger { fill: var(--pad-back); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .bumper { fill: var(--pad-bumper); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .well { fill: var(--pad-well); stroke: var(--pad-line); stroke-width: var(--pad-detail); }
.pad-drawing .cap { fill: var(--pad-stick); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .cross { fill: var(--pad-dpad); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .arm { fill: transparent; stroke: none; }
.pad-drawing .arrow { fill: var(--pad-mark); }
.pad-drawing .face { fill: var(--pad-face); stroke: var(--pad-line); stroke-width: var(--pad-stroke); }
.pad-drawing .small { fill: var(--pad-face); stroke: var(--pad-line); stroke-width: var(--pad-detail); }
.pad-drawing .mark { fill: none; stroke: var(--pad-mark); stroke-width: var(--pad-detail); }
.pad-drawing .mark.thin { stroke-width: 1.5px; }
.pad-drawing text { font-family: var(--font-display); font-weight: 600; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.pad-drawing .letter-a { fill: var(--pad-letter-a); }
.pad-drawing .letter-b { fill: var(--pad-letter-b); }
.pad-drawing .letter-x { fill: var(--pad-letter-x); }
.pad-drawing .letter-y { fill: var(--pad-letter-y); }

/* The button in focus: accent outline over a dark halo, its letter or arrow
   still readable. On the bumpers only the band lights up. */
.pad-drawing .halo { fill: none; stroke: var(--pad-halo); stroke-width: calc(var(--pad-focus) + 6px); }
.pad-drawing .guide-mark { fill: var(--pad-mark); }
.pad-drawing .on .key { stroke: var(--accent); stroke-width: var(--pad-focus); fill: var(--pad-on); }
.pad-drawing .on text { fill: var(--text); }
.pad-drawing .on .arrow { fill: var(--text); }

/* The guide from the row in focus to its button, with the same dark halo
   where it crosses the controller. */
.pad-guide { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pad-guide path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.pad-guide .line { stroke: var(--accent); stroke-width: 3px; }
.pad-guide .halo { stroke: #000000; stroke-width: 9px; }

/* ---------- Color del control: the themes, the controller beside them ---------- */
.pad-theme-row { justify-content: flex-start; gap: 1rem; }
.pad-theme-row .name { flex: 1; }
.setting .tick, .pad-theme-row .tick { flex: none; width: 1.5rem; height: 1.5rem; color: var(--accent); }
.pad-chip { flex: none; display: flex; }
.pad-chip span { width: 1.5rem; height: 1.5rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.pad-chip span + span { margin-left: 0.25rem; }
.pad-chip-icon { flex: none; width: 1.5rem; height: 1.5rem; margin: 0 0.875rem 0 0.875rem; color: var(--muted); }
/* As tall as the list, the controller in its middle. */
.pad-theme-card { align-self: stretch; display: grid; place-items: center; padding: calc(2 * var(--u)); }
.pad-theme-card .pad-drawing { max-height: 100%; }

/* ---------- a button's actions, in place of its column ---------- */
/* The list shows whole rows only (its height is set in pad.js) and snaps to
   them; it fades only over its own padding where it continues, so no action
   is ever cut or looks switched off. */
.pad-actions {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: calc(0.25 * var(--u));
  padding: 1.5rem calc(0.5 * var(--u));
  border-radius: 0.75rem;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
  scroll-padding-block: 1.5rem;
}
/* A little wider than its column: into the gap next to the drawing and part
   of the card's margin, so a name, «original» and the tick fit on one line. */
.pad-actions.left { margin: 0 calc(-2.5 * var(--u)) 0 calc(-1 * var(--u)); }
.pad-actions.right { margin: 0 calc(-1 * var(--u)) 0 calc(-2.5 * var(--u)); }
.pad-actions.more-down { mask-image: linear-gradient(#000 calc(100% - 1.5rem), transparent calc(100% - 1rem)); }
.pad-actions.more-up { mask-image: linear-gradient(transparent 1rem, #000 1.5rem); }
.pad-actions.more-up.more-down { mask-image: linear-gradient(transparent 1rem, #000 1.5rem, #000 calc(100% - 1.5rem), transparent calc(100% - 1rem)); }
.pad-action {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: calc(3.5 * var(--u));
  padding: calc(0.375 * var(--u)) 0.75rem;
  border-radius: 0.625rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--muted);
  scroll-snap-align: start;
}
/* «original» on the same line as its name, next to the tick. */
.pad-action .name { flex: 1; min-width: 0; white-space: nowrap; }
.pad-action .original { flex: none; font-size: 1.125rem; font-weight: 400; color: var(--muted); }
.pad-action .tick { flex: none; width: 1.5rem; height: 1.5rem; color: var(--accent); }
.pad-action.current { color: var(--text); }
.pad-action.on { background: var(--surface-hover); color: var(--text); box-shadow: 0 0 0 var(--focus) var(--accent); }
.pad-action.on .original { color: var(--text); }

/* ---------- high contrast: black, white lines, a thick yellow focus ---------- */
.high-contrast .pad-map { box-shadow: inset 0 0 0 var(--line) var(--ring); }
.high-contrast .pad-drawing {
  --pad-body: #000000;
  --pad-paint: #000000;
  --pad-back: #000000;
  --pad-bumper: #000000;
  --pad-well: #000000;
  --pad-stick: #000000;
  --pad-dpad: #000000;
  --pad-face: #000000;
  --pad-line: #ffffff;
  --pad-mark: #ffffff;
  --pad-letter-a: #ffffff;
  --pad-letter-b: #ffffff;
  --pad-letter-x: #ffffff;
  --pad-letter-y: #ffffff;
  --pad-on: #000000;
  --pad-halo: #000000;
  --pad-stroke: 4px;
  --pad-detail: 3px;
  --pad-focus: 5px;
}
.high-contrast .pad-drawing text { fill: #ffffff; }
.high-contrast .pad-drawing .on .key { fill: none; }
.high-contrast .pad-drawing .on .arm { fill: none; }
.high-contrast .pad-guide .line { stroke-width: 3px; }
.high-contrast .pad-guide .halo { stroke: #000000; }
.panel.more-below { mask-image: linear-gradient(180deg, #000 calc(100% - 4rem), transparent); }
.panel.more-above { mask-image: linear-gradient(0deg, #000 calc(100% - 4rem), transparent); }
.panel.more-above.more-below { mask-image: linear-gradient(180deg, transparent, #000 4rem, #000 calc(100% - 4rem), transparent); }
.panel-title { padding: 0.75rem 1.25rem 0.25rem; font-weight: 600; font-size: 1rem; color: var(--muted); }
/* A list's tick box: the accent when on. */
.check { flex: none; width: 1.875rem; height: 1.875rem; border-radius: 0.5rem; display: grid; place-items: center; box-shadow: inset 0 0 0 0.125rem var(--ring-strong); }
.check.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.check .icon { width: 1.25rem; height: 1.25rem; }
.swatches { display: flex; gap: 0.875rem; }
.swatch { width: 1.875rem; height: 1.875rem; border-radius: 50%; }
/* The chosen colour: a subtle grey ring, never a white one. */
.swatch.sel { box-shadow: 0 0 0 0.125rem var(--surface), 0 0 0 0.25rem var(--muted); }
/* Tiles view: the categories as tiles; one open shows its options under its name. */
.settings.tiles { display: grid; grid-template-columns: repeat(3, 17.5rem); gap: 1.25rem; align-content: start; }
.settings.tiles .cat { flex-direction: column; justify-content: center; height: 8.2rem; background: var(--surface); color: var(--text); }
.settings.tiles .cat .icon { width: 2.25rem; height: 2.25rem; color: var(--muted); }
.cat-title { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.5rem; font-family: var(--font-display); font-weight: 600; font-size: 2.25rem; }
.cat-title .icon { width: 2.25rem; height: 2.25rem; color: var(--muted); }
.settings-hints { display: flex; gap: 2rem; padding: 0 4rem; height: 3rem; align-items: center; font-weight: 600; font-size: 1.25rem; white-space: nowrap; }
.settings-hints .hint { display: flex; align-items: center; gap: 0.625rem; }
.settings-hints .spacer { flex: 1; }

/* Keeping a button swap: a small card over a dimmed screen, the two answers
   as the app's action button and a hint. */
.confirm { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 75%, transparent); }
.confirm[hidden] { display: none; }
.confirm-card { width: min(44rem, calc(100% - 8rem)); padding: 2.25rem 2.5rem; border-radius: 0.75rem; background: var(--surface); }
.confirm-card h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 2.25rem; }
.confirm-card p { margin: 1rem 0 0; font-size: 1.375rem; color: var(--muted); }
.confirm-actions { display: flex; align-items: center; gap: 2rem; margin-top: 2rem; }
.confirm-actions .action { margin-top: 0; }
.confirm-actions .hint { display: inline-flex; align-items: center; gap: 0.625rem; font-weight: 600; font-size: 1.25rem; }

/* ---------- music stage: the cover's colour fills the screen, the cover sits big on the right ---------- */
/* Something failed: a note over everything under the tabs, for a few
   seconds. It covers nothing that moves, and never pushes the page. */
.toast { position: fixed; top: 5.25rem; left: 50%; translate: -50% 0; z-index: 5; max-width: 60rem; padding: 1rem 1.5rem; border-radius: 0.75rem; background: var(--bg); box-shadow: inset 0 0 0 var(--line) var(--ring-strong); font-size: 1.125rem; line-height: 1.4; }
.toast[hidden] { display: none; }
.toast b { font-weight: 600; }
.toast span { color: var(--muted); }

.backdrop { background: var(--bg); transition: background-color 400ms ease; }
.stage-cover {
  position: absolute;
  right: calc(4 * var(--u));
  top: calc(8 * var(--u));
  height: calc(38 * var(--u));
  width: calc(38 * var(--u));
  border-radius: calc(1.25 * var(--u));
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease;
}
/* The cover's two main colours, blended across the screen. */
body.music-stage .backdrop { background: linear-gradient(120deg, var(--stage, var(--surface)) 15%, var(--stage-2, var(--stage, var(--surface))) 85%); }
body.music-stage .hero, body.music-stage .wall, body.music-stage .trailer { opacity: 0; }
body.music-stage .stage-cover.loaded { opacity: 1; }
/* Lyrics: in the cover's place (Y), the line being sung lit and centred;
   the rest fade towards the edges. */
.lyrics {
  position: absolute;
  top: calc(8 * var(--u));
  height: calc(38 * var(--u));
  left: calc(62 * var(--u));
  right: calc(4 * var(--u));
  overflow: hidden;
  opacity: 0;
  transition: opacity 400ms ease;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
body.lyrics-view .lyrics { opacity: 1; }
body.lyrics-view .stage-cover.loaded { opacity: 0; }
.lyrics .lines { transition: transform 500ms ease; }
.lyrics .line {
  margin: 0;
  padding: calc(1 * var(--u)) 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: calc(3.4 * var(--u));
  line-height: 1.25;
  color: color-mix(in srgb, var(--text) 45%, transparent);
  transition: color 300ms ease;
}
.lyrics .line.now { color: var(--text); }
.lyrics .line.gap { letter-spacing: 0.2em; }
@media (prefers-reduced-motion: reduce) {
  .lyrics, .lyrics .lines, .lyrics .line { transition: none; }
}
.high-contrast .lyrics .line { color: var(--muted); }
.high-contrast .lyrics .line.now { color: var(--text); }

/* Oscurecer el fondo: a plain layer over the background (not over the
   music stage, which has its own colours). */
.scrim::after { content: ""; position: absolute; inset: 0; background: rgb(20, 20, 22); opacity: var(--dim, 0); }
body.music-stage .scrim::after { opacity: 0; }

/* Personalizar: a panel on the right, under the tabs, as tall as its rows
   (fitQuick keeps it above the row of tiles). Its place and width are
   properties, so other panels can reuse it. */
.quick { --quick-w: 40rem; --quick-top: 7.5rem; --quick-right: 4rem; position: absolute; top: var(--quick-top); right: var(--quick-right); width: var(--quick-w); max-height: calc(100% - 12rem); z-index: 4; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem 0.75rem 0.5rem; border-radius: 0.75rem; background: var(--surface); box-shadow: inset 0 0 0 var(--line) var(--ring-strong); }
.quick[hidden] { display: none; }
/* Room inside the scroll box for the focus ring, which is drawn outside the row. */
.quick .quick-rows { display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; scrollbar-width: none; min-height: 0; padding: 0.375rem; margin: -0.375rem; }
.quick .settings-hints { flex: none; padding: 0 1.25rem; }
/* Where more rows go on, a short fade: the rows are compact. */
.quick-rows.more-below { mask-image: linear-gradient(180deg, #000 calc(100% - 2rem), transparent); }
.quick-rows.more-above { mask-image: linear-gradient(0deg, #000 calc(100% - 2rem), transparent); }
.quick-rows.more-above.more-below { mask-image: linear-gradient(180deg, transparent, #000 2rem, #000 calc(100% - 2rem), transparent); }
/* What the focused row does, in plain words: two lines at most. */
.quick .quick-about { flex: none; display: grid; margin: 0.25rem 1.25rem 0; color: var(--muted); font-size: 1.125rem; line-height: 1.4; }
.quick .quick-about span { grid-area: 1 / 1; visibility: hidden; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quick .quick-about span.now { visibility: visible; }
/* Compact rows: the panel stays above the row of tiles. */
.quick .setting { min-height: 3.25rem; font-size: 1.125rem; }

/* Settings: the background stays, dimmed, so every label reads over it. */
body.settings-open .scrim, body.search-open .scrim { background: color-mix(in srgb, var(--bg) 88%, transparent); }
body.music-stage .scrim {
  background: linear-gradient(90deg, rgba(20, 20, 22, 0.55) 0%, rgba(20, 20, 22, 0) 60%),
    linear-gradient(0deg, rgba(20, 20, 22, 0.5) 0%, rgba(20, 20, 22, 0) 40%);
}


/* ---------- music player ---------- */
.player { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.player .lead { align-items: flex-end; }
.player .source { margin: 0; font-weight: 600; font-size: 1.125rem; color: var(--muted); }
.player .info { max-width: 44rem; }
.player .meta { font-size: 1.5rem; color: var(--text); opacity: 0.75; }

/* One bar where the other tabs have their row: buttons, progress, volume. */
.player-bar { margin-top: auto; padding: 0.5rem 4rem; display: flex; align-items: center; gap: 2.5rem; }
.transport { display: flex; align-items: center; gap: 1rem; flex: none; }
/* Three equal buttons; filled icons read better at a distance. */
.transport-button { width: 4.25rem; height: 4.25rem; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); color: var(--text); }
.transport-button .icon { width: 1.625rem; height: 1.625rem; fill: currentColor; }
.transport-button.on { box-shadow: 0 0 0 var(--focus) var(--accent); }
.progress { flex: 1; min-width: 0; display: flex; align-items: center; gap: 1rem; }
.progress .time { font-weight: 600; font-size: 0.9375rem; color: var(--muted); min-width: 2.75rem; }
.progress .time:last-child { text-align: right; }
.bar { flex: 1; height: 0.375rem; border-radius: 0.1875rem; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.bar .fill { height: 100%; border-radius: inherit; background: var(--text); }
.volume { display: flex; align-items: center; gap: 0.875rem; color: var(--text); }
.player-bar .volume { flex: none; width: 14rem; }
.volume .icon { width: 1.5rem; height: 1.5rem; flex: none; }
.volume .bar { min-width: 8rem; }

/* Volume changed from another tab: a small pill next to the clock. */
.topbar-end { display: flex; align-items: center; gap: 1.5rem; }
.volume-toast { height: 2.5rem; padding: 0 1rem; border-radius: 0.75rem; background: var(--surface); box-shadow: inset 0 0 0 var(--line) var(--ring); }
.volume-toast[hidden] { display: none; }
.volume-toast .glyph { display: none; }


/* Tabs centred on the screen; the volume pill and the clock stay on the right. */
/* A fixed row, as tall as the volume pill, so showing it moves nothing. */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 2.5rem; }
.tabs { grid-column: 2; }
.tabs > * { line-height: 1; }
.topbar-end { grid-column: 3; justify-self: end; }

/* ---------- high contrast: plain black behind everything ---------- */
.high-contrast .wall, .high-contrast .hero, .high-contrast .trailer, .high-contrast .scrim { display: none; }
.high-contrast body.music-stage .backdrop { background: var(--bg); }
/* Outlined panels and a plain switch: no tone differences to tell things apart. */
.high-contrast .panel, .high-contrast .preview-card, .high-contrast .cat.sel { box-shadow: inset 0 0 0 var(--line) var(--ring); }
.high-contrast .cat.sel.on { box-shadow: inset 0 0 0 var(--line) var(--ring), 0 0 0 var(--focus) var(--accent); }
.high-contrast .switch:not(.on) { background: var(--bg); box-shadow: inset 0 0 0 var(--line) var(--ring); }
.high-contrast .switch:not(.on)::after { background: var(--text); }
.high-contrast .choice { box-shadow: inset 0 0 0 var(--line) var(--ring); }
.high-contrast .choice span.sel { background: var(--text); color: var(--bg); }
