:root {
  font-family: Arial, "Segoe UI", sans-serif;
  --ink: #292929;
  --muted: #555;
  --accent: #087e8f;
  --focus: #00c9bd;
  --line: #d3d3d3;
  --background: #ebebeb;
  --paper: #fff;
  --hover: #f7f7f7;
  --slot: #e0e0e0;
  --shortcut: #f8f8f8;
  --primary-bg: #087484;
  color: var(--ink);
  background: var(--background);
}

body { min-height: 100svh; }
button { border-radius: 3px; font-weight: 500; background: var(--paper); color: var(--ink); }
button:hover { background: var(--hover); }
input, textarea, select { font: inherit; background: var(--paper); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
select option { background: var(--paper); color: var(--ink); }
button:focus-visible, input:focus-visible, iframe:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.system-icon { width: 1.3em; height: 1.3em; display: block; }
.status-bar {
  border: 0;
  background: transparent;
  min-height: clamp(70px, 13vh, 110px);
  padding: 0 clamp(20px, 5vw, 84px);
}
#status-profiles, .status-right { display: flex; align-items: center; gap: .8rem; }
#status-profiles { min-width: 0; overflow-x: auto; padding: 7px; margin-left: -7px; scrollbar-width: none; }
.status-right { flex: none; font-size: clamp(16px, 2vw, 29px); font-weight: 500; }
.status-right #battery { font-size: .78em; }
.profile-disc {
  display: grid;
  place-items: center;
  width: clamp(38px, 5vw, 66px);
  height: clamp(38px, 5vw, 66px);
  flex: none;
  border: 2px solid #fff;
  border-radius: 50%;
  padding: 0;
  background: var(--avatar-color, #71cccf);
  color: #272727;
  font-size: clamp(18px, 2.4vw, 32px);
  font-weight: 700;
}
.profile-disc:hover { background: var(--avatar-color, #71cccf); }
.profile-disc .system-icon { width: 52%; height: 52%; }
.profile-disc .avatar { width: 100%; height: 100%; background: transparent; font-size: inherit; }
.avatar.avatar-picture {
  overflow: hidden;
}
.avatar-picture img { display: block; width: 100%; height: 100%; object-fit: contain; }
.avatar-framed { position: relative; }
.avatar-framed img {
  position: absolute;
  width: var(--portrait-width);
  height: var(--portrait-width);
  left: var(--portrait-left);
  top: var(--portrait-top);
  max-width: none;
}
.avatar-picture[data-character="DreamWorksShrek"] img { transform: scale(.88); }
.avatar-picture[data-character="DreamWorksDonkey"] img { transform: translate(-11%, 15%) scale(1.35); }
.avatar-picture[data-character="DreamWorksFiona"] img { transform: translate(-13%, 18%) scale(1.25); }
.avatar-picture[data-character="DreamWorksPussInBoots"] img { transform: translate(4%, 45%) scale(2); }
.avatar-picture[data-character="DreamWorksToothless"] img { transform: translate(-32%, 31%) scale(1.55); }
.avatar-picture[data-character="DreamWorksPo"] img { transform: translate(7%, 34%) scale(1.6); }
.avatar-picture[data-character="DreamWorksTigress"] img { transform: translate(0, 22%) scale(1.35); }
.avatar-picture[data-character="DreamWorksLordFarquaad"] img { transform: translate(0, 36%) scale(1.8); }
.avatar-picture[data-character="DreamWorksShrekClassic"] img { transform: translate(1%, 39%) scale(1.65); }
.avatar-picture[data-character="DreamWorksPrivate"] img { transform: translate(-10%, 23%) scale(1.35); }
.avatar-picture[data-character="DreamWorksPoppy"] img,
.avatar-picture[data-character="DreamWorksBranch"] img,
.avatar-picture[data-character="DreamWorksDJSuki"] img,
.avatar-picture[data-character="DreamWorksCreek"] img { transform: translateY(-14%); }
.avatar-picture:is(
  [data-character="DisneyJudyHopps"], [data-character="DisneyNickWilde"],
  [data-character="DisneyBellwether"], [data-character="DisneyGoGoTomago"],
  [data-character="DisneyHoneyLemon"], [data-character="DisneyGazelle"],
  [data-character="PixarMiguelRivera"], [data-character="PixarImelda"],
  [data-character="PixarCeliaMae"], [data-character="PixarDeanHardscrabble"],
  [data-character="DreamWorksTipTucci"], [data-character="DreamWorksFionaRoyalDress"]
) img { transform: translateY(35%) scale(1.6); }
.profile-disc .avatar.avatar-picture { background-color: var(--paper); }
.profile-heading { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.3rem; }
.profile-heading .heading { flex: 1; margin: 0; }
.profile-heading > .avatar { flex: none; }
.profile-launcher {
  width: min(820px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1rem 3rem #0004;
}
.profile-launcher[open] { animation: profile-drop 180ms ease-out; }
.profile-launcher::backdrop { background: #0008; }
.profile-launch-heading { padding: 1.5rem 1rem 0; text-align: center; }
.profile-launch-heading h2 { font-weight: 500; }
.profile-launch-heading p { margin-top: .25rem; }
.launch-profiles {
  display: flex;
  gap: 1rem;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1rem;
  overflow-x: auto;
}
.launch-profiles button {
  display: grid;
  flex: 0 0 clamp(6.75rem, 16vw, 8.75rem);
  justify-items: center;
  align-content: start;
  gap: .65rem;
  min-height: 8rem;
  padding: .65rem;
  border: 2px solid transparent;
  background: var(--background);
  overflow-wrap: anywhere;
}
.launch-profiles button[data-highlighted] { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.launch-profiles .avatar { width: 4.25rem; height: 4.25rem; font-size: 1.65rem; }
.profile-launch-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .4rem 1rem;
  border-top: 1px solid var(--line);
}
.profile-launch-actions button { background: transparent; border-color: transparent; }
@keyframes profile-drop { from { opacity: 0; transform: translateY(-1.5rem); } }
@media (prefers-reduced-motion: reduce) { .profile-launcher[open] { animation: none; } }
.picture-picker { display: grid; grid-template-columns: clamp(140px, 19vw, 230px) minmax(0, 1fr); gap: clamp(12px, 3vw, 38px); border-top: 1px solid var(--line); padding-top: 1rem; }
.picture-sidebar { display: grid; align-content: start; gap: 1rem; position: sticky; top: 1rem; align-self: start; }
.picture-current { display: grid; justify-items: center; gap: .6rem; text-align: center; }
.picture-current .avatar { width: min(100%, 160px); height: auto; aspect-ratio: 1; border-radius: 0; font-size: 2.8rem; }
.picture-categories { display: grid; gap: .45rem; }
.picture-categories button { padding-block: .5rem; text-align: left; }
.picture-categories [aria-current] { border-left: 4px solid var(--focus); color: var(--accent); }
.picture-grid { display: grid; align-content: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 85px), 1fr)); gap: .55rem; }
.picture-grid button { display: grid; place-items: center; padding: 0; aspect-ratio: 1; border-radius: 0; }
.picture-grid button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--focus); }
.picture-grid button:focus-visible { outline-offset: 0; }
.picture-grid .avatar { width: 100%; height: 100%; border-radius: 0; background: transparent !important; }
.picture-grid button[data-color] { background: var(--swatch); }
.picture-grid.background-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 52px), 1fr)); }
@media (max-width: 540px) {
  .picture-picker { grid-template-columns: 1fr; }
  .picture-sidebar { position: static; }
  .picture-categories { display: flex; flex-wrap: wrap; }
  .picture-current .avatar { width: 90px; }
}

body[data-screen="home"] #screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  min-height: 0;
}
.software-title {
  margin: 0 6.7vw;
  min-height: 1.4em;
  color: #087e8f;
  font-size: clamp(18px, 2.55vw, 36px);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -.02em;
}
.software-row {
  --tile: clamp(128px, min(20vw, 39vh), 325px);
  display: flex;
  gap: clamp(7px, .85vw, 15px);
  padding: 8px 6.7vw 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.software-tile {
  position: relative;
  display: block;
  flex: 0 0 var(--tile);
  width: var(--tile);
  height: var(--tile);
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 0;
  overflow: hidden;
  background: #e0e0e0;
}
.software-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.software-update {
  position: absolute;
  inset: auto 0 0;
  padding: .4em .5em;
  background: #162633ed;
  color: #fff;
  font-size: clamp(.8rem, 1.5vw, 1rem);
  font-weight: 600;
}
.software-tile:focus-visible, .software-tile[data-selected], .shortcut:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}
.software-options {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(7px, 1.45vw, 23px);
  padding: clamp(20px, 5vh, 53px) 12px 0;
}
.shortcut {
  display: grid;
  place-items: center;
  width: clamp(37px, min(7.1vw, 13vh), 110px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #e2e2e2;
  border-radius: 50%;
  color: var(--icon-color, #515151);
  background: #f8f8f8;
}
.shortcut .system-icon { width: 52%; height: 52%; }
.shortcut-caption {
  min-height: 1.5em;
  margin-top: .5rem;
  text-align: center;
  color: #087e8f;
  font-size: clamp(14px, 1.8vw, 25px);
}
.system-footer {
  width: calc(100% - clamp(32px, 8vw, 124px));
  margin: 0 auto;
  min-height: clamp(52px, 9vh, 82px);
  padding: .35rem .4rem;
  border-top: 1px solid #373737;
  background: transparent;
  color: var(--ink);
  font-size: clamp(14px, 1.7vw, 24px);
}
.system-footer button { display: inline-flex; align-items: center; gap: .4em; border: 0; background: transparent; padding: .35em .45em; }
.footer-actions { display: flex; gap: clamp(6px, 2vw, 30px); }
kbd { display: inline-grid; place-items: center; width: 1.3em; aspect-ratio: 1; border-radius: 50%; color: #fff; background: #383838; font: 700 .83em Arial, sans-serif; }
.system-footer #home-button { padding: .3em; }
.system-footer button:hover { background: #dcdcdc; }

body[data-screen="wake"] .status-bar, body[data-screen="wake"] .system-footer { display: none; }
body[data-screen="wake"] #screen { display: flex; width: 100%; padding: 0; }
body[data-screen="game"] .status-bar, body[data-screen="game"] .system-footer { display: none; }
body[data-screen="game"] { background: #110d20; overflow: hidden; }
body[data-screen="game"] #screen {
  position: fixed;
  inset: var(--safe-height, 0px) var(--safe-area, 0px);
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: auto;
  background: #110d20;
  color: #fff;
}
body[data-screen="game"] .frame { display: block; width: 100%; height: 100%; border-radius: 0; }
.game-layout {
  min-height: 100%;
  padding: clamp(.75rem, 2.5vmin, 2rem);
  align-items: center;
  gap: clamp(1rem, 4vw, 4rem);
}
.game-layout canvas { width: min(40vw, 40dvh, 100%); border-radius: 6px; }
.game-controls p { color: #d2c7ec; }
.game-controls button { color: var(--ink); }
.lock-screen { display: grid; grid-template-columns: minmax(210px, 28%) 1fr; min-height: 100svh; width: 100%; }
.lock-news { background: #292929; color: white; padding: clamp(14px, 2.5vw, 36px); display: grid; align-content: start; gap: 1rem; }
.lock-news h2 { color: #fff; font-weight: 500; }
.lock-news .story { border-color: #474747; }
.lock-news .empty { background: #343434; border-color: #474747; }
.lock-news .empty p { color: #eee; }
.lock-content { display: grid; align-content: center; justify-items: center; gap: 1.5rem; padding: 1rem; }
.lock-content .system-icon { width: 72px; height: 72px; color: #404040; }
.lock-content button { display: flex; align-items: center; gap: .6em; background: transparent; border-color: transparent; font-size: clamp(18px, 2.4vw, 30px); }
.panel, .story, .empty, .game-tile, .stats > div, form { border-radius: 4px; }
.album-grid img { max-width: 100%; }
.leaderboard-caption { margin-bottom: 1rem; }
.leaderboard-row { display: grid; grid-template-columns: 2.8rem auto minmax(0, 1fr) auto; }
.leaderboard-row .rank { font-weight: 700; color: var(--accent); }
.leaderboard-row .avatar { width: 2.5rem; height: 2.5rem; }
.leaderboard-row strong { font-variant-numeric: tabular-nums; }
.leaderboard-you { border-color: var(--accent); }
.leaderboard-player { min-width: 0; overflow-wrap: anywhere; }
.leaderboard-player button { border: 0; background: transparent; text-align: left; padding: .2rem; }
.record-article { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.record-article .cover { object-fit: contain; }
@media (max-width: 660px) { .record-article { grid-template-columns: 1fr; } }
.publish-qr { display: grid; justify-items: center; gap: .8rem; max-width: 520px; margin: auto; text-align: center; }
.publish-qr img { width: min(260px, 100%); height: auto; image-rendering: pixelated; }
.portal-address { overflow-wrap: anywhere; user-select: all; }
.controller-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.controller-section { display: grid; align-content: start; gap: .85rem; }
.controller-section:first-child { grid-column: 1 / -1; }
.controller-section > button { justify-self: start; }
.controller-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: .75rem; }
.controller-card { display: grid; gap: .45rem; overflow-wrap: anywhere; }
.controller-card .system-icon { width: 2.2rem; height: 2.2rem; color: var(--accent); }
.battery-list { display: grid; gap: .55rem; padding: 0; margin: 0; list-style: none; }
.battery-list li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

body { padding: var(--safe-height, 0) var(--safe-area, 0); }
.lock-screen { min-height: calc(100svh - 2 * var(--safe-height, 0px)); }
.settings-layout { display: grid; grid-template-columns: minmax(11rem, 22%) minmax(0, 1fr); align-items: start; gap: 1rem; }
.settings-nav { display: grid; align-content: start; gap: .3rem; padding: .45rem; }
.settings-nav button { display: flex; align-items: center; gap: .7rem; min-height: 3.15rem; text-align: left; border: 0; border-radius: 8px; }
.settings-nav .system-icon { flex: none; width: 1.2rem; height: 1.2rem; }
.settings-nav [aria-current] { background: var(--section-tint); color: var(--ink); font-weight: 700; }
.settings-pane { display: grid; gap: .9rem; align-content: start; padding: clamp(1rem, 2.6vw, 2rem); }
.settings-nav, .settings-pane { background: var(--paper); border: 1px solid var(--line); border-radius: var(--section-radius); }
.settings-pane h2 { font-size: clamp(1.5rem, 2.6vw, 2.15rem); }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: 9px; }
.setting-row output { min-width: 4ch; text-align: center; }
.settings-pane > button { justify-self: start; }
.settings-pane [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
#mapping-status:empty { display: none; }

:root[data-theme="dark"] {
  color-scheme: dark;
  background: #2d2d2d;
  --ink: #f1f1f1;
  --muted: #c1c1c1;
  --line: #565656;
  --accent: #61dfd9;
}
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.theme-grid button { display: grid; gap: .6rem; min-width: 0; padding: .45rem .45rem .65rem; border-radius: 9px; text-align: left; overflow-wrap: anywhere; }
.theme-preview {
  --background: #ebebeb; --paper: #fff; --slot: #e0e0e0; --focus: #00c9bd;
  display: grid; justify-items: center; align-content: space-between;
  aspect-ratio: 16 / 10; width: 100%; padding: 8%; border-radius: 5px; background: var(--background);
}
.preview-profiles { justify-self: start; width: 10%; aspect-ratio: 1; border-radius: 50%; background: var(--focus); box-shadow: .8em 0 var(--paper); }
.preview-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4%; width: 100%; }
.preview-tile { width: 100%; aspect-ratio: 1; border-radius: 2px; background: var(--slot); }
.preview-tile:first-child { outline: 2px solid var(--focus); outline-offset: -1px; background: var(--paper); }
.preview-shortcuts { width: 7%; aspect-ratio: 1; border-radius: 50%; background: var(--paper); box-shadow: -.65em 0 var(--paper), .65em 0 var(--paper); }

[data-theme="dark"], [data-palette="dark"] {
  --background: #2d2d2d; --paper: #3c3c3c; --hover: #4b4b4b; --slot: #373737;
  --shortcut: #3c3c3c; --primary-bg: #0d7777; --focus: #00c9bd;
}
[data-theme="ocean"], [data-palette="ocean"] {
  --background: #dceefc; --paper: #f5fbff; --hover: #e9f6ff; --slot: #c2deef; --shortcut: #f5fbff;
  --ink: #18354b; --muted: #3b5c72; --line: #a9c8de; --accent: #145c91; --focus: #237fc0; --primary-bg: #145c91;
}
[data-theme="mint"], [data-palette="mint"] {
  --background: #dcf1e5; --paper: #f4fff8; --hover: #e9f9ef; --slot: #c4e5d0; --shortcut: #f4fff8;
  --ink: #193b31; --muted: #395e4e; --line: #abcdb9; --accent: #23694e; --focus: #29865f; --primary-bg: #23694e;
}
[data-theme="lavender"], [data-palette="lavender"] {
  --background: #eee6fb; --paper: #fcf8ff; --hover: #f3ebfc; --slot: #dfd0f0; --shortcut: #fcf8ff;
  --ink: #38254c; --muted: #634e76; --line: #c7b4db; --accent: #674296; --focus: #8051b4; --primary-bg: #674296;
}
[data-theme="peach"], [data-palette="peach"] {
  --background: #fce8db; --paper: #fff8f2; --hover: #fef0e5; --slot: #f1d1be; --shortcut: #fff8f2;
  --ink: #502f23; --muted: #745346; --line: #dab6a4; --accent: #8a472b; --focus: #bc6441; --primary-bg: #8a472b;
}
[data-theme="midnight"], [data-palette="midnight"] {
  --background: #17243b; --paper: #263751; --hover: #344968; --slot: #213149; --shortcut: #263751;
  --ink: #f0f5ff; --muted: #b9cbe3; --line: #506786; --accent: #9acbff; --focus: #7dbbff; --primary-bg: #265a8c;
}
:root[data-theme="midnight"] { color-scheme: dark; }
:root[data-character-tone] {
  --background: var(--character-background);
  --ink: color-mix(in srgb, var(--character-accent) 30%, #181722);
  --muted: color-mix(in srgb, var(--ink) 77%, var(--background));
  --line: color-mix(in srgb, var(--character-accent) 24%, var(--background));
  --paper: color-mix(in srgb, var(--background) 19%, #fff);
  --hover: color-mix(in srgb, var(--character-highlight) 17%, var(--paper));
  --slot: color-mix(in srgb, var(--character-highlight) 23%, var(--paper));
  --accent: var(--character-accent);
  --focus: color-mix(in srgb, var(--character-highlight) 50%, var(--character-accent));
  --shortcut: var(--paper);
  --primary-bg: color-mix(in srgb, var(--accent) 68%, #171722);
}
:root[data-character-tone="dark"] {
  color-scheme: dark;
  --ink: #faf6ee;
  --muted: color-mix(in srgb, var(--ink) 75%, var(--background));
  --paper: color-mix(in srgb, var(--background) 91%, #fff);
  --primary-bg: color-mix(in srgb, var(--accent) 43%, #1c181c);
}
:where(button:not(.profile-disc):not(.primary)), .row, .panel, .story, .empty,
.game-tile, .stats > div, form, input { background: var(--paper); }
:where(button:not(.profile-disc):not(.primary)):hover { background: var(--hover); }
button.primary { background: var(--primary-bg); color: #fff; }
button.primary:hover { background: color-mix(in srgb, var(--primary-bg) 85%, #000); color: #fff; }
.shortcut { background: var(--shortcut); color: var(--icon-color, var(--ink)); border-color: var(--line); }
.software-tile { background: var(--slot); border-color: var(--line); }
.software-title, .shortcut-caption { color: var(--accent); }
.system-footer { border-color: var(--muted); }
.lock-content .system-icon { color: var(--ink); }
.lock-content .unlock { background: transparent; color: var(--ink); }
.system-footer button:not(:hover) { background: transparent; }

body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"], [data-screen="splitSetup"]) {
  --section-radius: 16px;
  --section-color: #16897d;
  --section-tint: color-mix(in srgb, var(--section-color) 17%, var(--paper));
  --section-border: color-mix(in srgb, var(--section-color) 30%, var(--line));
  background: color-mix(in srgb, var(--section-color) 5%, var(--background));
}
body:is([data-screen="store"], [data-screen="gameDetails"]) { --section-color: #d4772b; }
body:is([data-screen="news"], [data-screen="story"]) { --section-color: #d04f68; }
body[data-screen="players"] { --section-color: #7064c9; }
body[data-screen="chat"] { --section-color: #16897d; }
.chat-panel { max-width: 780px; margin: auto; display: grid; gap: .75rem; }
.chat-feed { height: clamp(180px, 45vh, 460px); overflow: auto; list-style: none; margin: 0; padding: 0 .5rem; }
.chat-message { border-bottom: 1px solid var(--line); padding: .65rem 0; overflow-wrap: anywhere; }
.chat-message p { margin: .25rem 0 0; }
.chat-meta { display: flex; justify-content: space-between; gap: .75rem; }
.chat-meta time, .chat-rules { color: var(--muted); font-size: .88em; }
.chat-compose { display: flex; gap: .5rem; }
.chat-compose input { flex: 1; min-width: 0; padding: .65rem; border: 1px solid var(--line); border-radius: 8px; }
.chat-panel > p { margin: 0; }
.chat-panel > p:empty { display: none; }
body[data-screen="splitSetup"] { --section-color: #6e59b5; }
body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"]) .status-bar {
  min-height: clamp(60px, 10vh, 86px);
}
body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"]) #screen {
  width: min(1230px, 100%);
  padding: .8rem clamp(1rem, 3vw, 2.6rem) 2.4rem;
}
body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"]) .system-footer {
  position: sticky; bottom: 0; z-index: 1;
  background: color-mix(in srgb, var(--section-color) 5%, var(--background));
}
body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"])
  :where(#screen) button:not(.primary, [aria-current]) { background: var(--paper); }
body:is([data-screen="settings"], [data-screen="store"], [data-screen="gameDetails"], [data-screen="news"], [data-screen="story"], [data-screen="chat"], [data-screen="players"])
  :where(#screen) button:not(.primary, [aria-current]):hover { background: var(--hover); }
.section-heading { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.section-heading-title { display: flex; align-items: center; gap: clamp(.65rem, 1.5vw, 1rem); min-width: 0; }
.section-heading-title h1 { font-size: clamp(1.85rem, 4vw, 3.45rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.section-emblem {
  display: grid; place-items: center; flex: none;
  width: clamp(2.65rem, 5vw, 3.75rem); aspect-ratio: 1; border-radius: 26%;
  background: var(--section-color); color: #fff;
}
.section-emblem .system-icon { width: 52%; height: 52%; }
.section-heading button, .store-grid button, .store-feature button, .store-detail button,
.story-actions button, .player-card button { border-radius: 8px; scroll-margin-block-end: 5rem; }
body:has(.section-heading) #toast { bottom: calc(clamp(52px, 9vh, 82px) + .75rem); z-index: 2; }
.section-chip, body[data-screen="news"] .story-meta .tag {
  display: inline-block; width: fit-content; max-width: 100%; padding: .32rem .66rem;
  border-radius: 999px; background: var(--section-tint); color: var(--ink);
  font-size: .8rem; font-weight: 700;
}
body[data-screen="news"] .story-meta .tag { background: color-mix(in srgb, var(--section-color) 19%, var(--paper)); }
.settings-pane button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }

.store-status:empty, .store-grid:empty, .store-media:empty, body[data-screen="store"] .section:empty { display: none; }
.store-status { margin-bottom: .75rem; }
.store-feature, .store-detail, .news-feature {
  display: grid; grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); align-items: stretch;
  gap: 0; padding: 0; overflow: hidden; border: 1px solid var(--section-border);
  border-radius: var(--section-radius); background: var(--paper);
}
.store-feature > .cover, .news-feature > .cover { height: 100%; min-height: 0; aspect-ratio: 2 / 1; }
.store-detail > .cover { align-self: start; }
.store-feature .tile-body, .store-detail .tile-body, .news-feature .story-body {
  align-content: center; padding: clamp(1rem, 2.8vw, 2.1rem); gap: .85rem;
}
.store-feature h3, .news-feature h3 { font-size: clamp(1.65rem, 3vw, 2.55rem); letter-spacing: -.04em; line-height: 1.08; }
.store-tile-meta, .story-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; color: var(--muted); font-size: .85rem; }
.store-feature .tile-body > button, .store-grid .tile-body > button { justify-self: start; }
.store-grid, .news-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); margin-top: 1rem; }
.store-grid .game-tile { border-radius: var(--section-radius); grid-template-rows: auto 1fr; }
.store-grid .tile-body { padding: .3rem 1rem 1rem; align-content: start; }
.store-grid .actions { align-self: end; }
.store-grid .game-tile .cover { aspect-ratio: 2 / 1; }
.store-detail .tile-body { align-content: start; }
.store-media:has(> *) { margin-top: 1.5rem; }
.store-media video, .store-media .cover { border-radius: 10px; }

body[data-screen="news"] .story { border-radius: var(--section-radius); }
.news-grid .story { display: grid; grid-template-rows: auto 1fr; }
.news-grid .story-body { grid-template-rows: auto auto 1fr auto; }
.story-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.story-actions > span { color: var(--muted); font-size: .85rem; }
.news-grid [data-kind="record"], .news-feature[data-kind="record"] { --section-color: #c48532; }
.news-grid [data-kind="best"], .news-feature[data-kind="best"] { --section-color: #5f74bd; }
.news-grid [data-kind="achievement"], .news-feature[data-kind="achievement"] { --section-color: #d04f68; }
.record-article { border-radius: var(--section-radius); padding: clamp(1rem, 2.7vw, 2rem); }
.record-article .cover { border-radius: 10px; }
.lock-news .story-actions > span { color: var(--muted); }

.players-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.player-card {
  display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--section-radius); background: var(--paper);
}
.player-card-active { border-color: var(--section-border); }
.player-card-art {
  min-height: 9rem; display: grid; place-items: center; position: relative;
  background: linear-gradient(150deg, var(--section-tint), color-mix(in srgb, var(--section-color) 35%, var(--paper)));
}
.player-card-art .avatar { width: 5.1rem; height: 5.1rem; font-size: 2rem; box-shadow: 0 0 0 4px var(--paper); }
.player-card-art .section-chip { position: absolute; inset: .65rem .65rem auto auto; background: var(--paper); }
.player-card-body { display: grid; gap: .85rem; align-content: start; padding: 1rem; }
.player-card-body h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
.player-card-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
.player-card-stats div { display: grid; gap: .25rem; padding: .55rem .65rem; border-radius: 7px; background: var(--section-tint); }
.player-card-stats strong { font-size: 1.15rem; }
.player-card-stats span { color: var(--muted); font-size: .8rem; }

.split-seat-grid { margin: 1rem 0; }
.split-seat-card { display: grid; gap: .65rem; border-radius: var(--section-radius); padding: 1rem; }
.split-seat-card h2 { font-size: 1.25rem; }
.split-seat-card button { min-width: 0; text-align: left; overflow-wrap: anywhere; background: var(--paper); }
.split-seat-card button:disabled { opacity: .75; }
.split-seat-card button:hover:not(:disabled) { background: var(--hover); }
.split-setup-status { margin-top: .65rem; }
body[data-screen="splitPlay"] { background: #141322; overflow: hidden; }
body[data-screen="splitPlay"] :is(.status-bar, .system-footer) { display: none; }
body[data-screen="splitPlay"] #screen {
  position: fixed; inset: var(--safe-height, 0px) var(--safe-area, 0px);
  width: auto; height: auto; margin: 0; padding: 0;
}
.split-play-grid {
  display: grid; grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr));
  gap: 2px; height: 100%; background: #555168;
}
.split-play-grid[data-count="2"] { grid-template-columns: minmax(0, 1fr); }
.split-play-grid[data-count="3"] > :first-child { grid-column: span 2; }
.split-pane {
  display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0;
  overflow: hidden; background: #141322; color: #f5f1ff;
}
.split-pane-label {
  background: #252239; padding: 4px 10px; font-size: clamp(.72rem, 1.4vmin, .95rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0;
}
.split-pane-body { position: relative; overflow: hidden; container-type: size; }
.split-pane-body > .frame { display: block; width: 100%; height: 100%; border-radius: 0; pointer-events: none; }
.split-pane-body .game-layout { height: 100%; flex-wrap: nowrap; gap: clamp(.5rem, 3cqw, 2rem); padding: 4px; }
.split-pane-body .game-layout canvas { width: min(40cqw, 46cqh); height: auto; }
.split-pane-body .game-controls { min-width: 0; }
.split-pane-body .game-controls h2 { font-size: clamp(.85rem, 4cqh, 1.35rem); }
.split-pane-body .game-controls strong { font-size: clamp(.9rem, 5cqh, 1.7rem); }
.split-lobby { height: 100%; display: grid; place-content: center; gap: .55rem; padding: .7rem; text-align: center; }
.split-lobby p { color: #d2cbe7; font-size: clamp(.8rem, 2.5cqh, 1rem); }
.split-lobby h3 { font-size: clamp(1rem, 5cqh, 2rem); }

.theme-collections { gap: .35rem; margin-block: .05rem .15rem; }
.theme-collections button { padding: .5rem .8rem; border-radius: 999px; }
body[data-screen="settings"] .theme-collections button[aria-pressed="true"] {
  border-color: var(--accent); background: var(--section-tint);
}
.character-theme-preview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; }
:root[data-character-tone] body { isolation: isolate; }
#theme-landscape { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .16; overflow: hidden; }
#theme-landscape img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 67% 50%; }
body:is([data-screen="game"], [data-screen="splitPlay"]) #theme-landscape { display: none; }
body[data-screen="home"] #theme-landscape { opacity: 1; }
body[data-screen="home"] #theme-landscape::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, #10152bb3 12%, transparent 38%, transparent 65%, #15172bc7 86%);
}
:root[data-character-tone] body[data-screen="home"] :is(.status-right, .system-footer) {
  color: #fff; text-shadow: 0 1px 4px #15213a;
}
:root[data-character-tone] body[data-screen="home"] .system-footer { border-color: #fff9; }
:root[data-character-tone] body[data-screen="home"] .software-row { --tile: clamp(120px, min(18vw, 36vh), 290px); }
:root[data-character-tone] body[data-screen="home"] :is(.software-title, .shortcut-caption) {
  width: fit-content; max-width: calc(100% - 13.4vw); color: #fff; overflow-wrap: anywhere;
  background: #172237df; border-radius: 6px; padding: .1em .38em;
}
:root[data-character-tone] body[data-screen="home"] :is(.software-title, .shortcut-caption):empty { visibility: hidden; }
:root[data-character-tone] body[data-screen="home"] .shortcut-caption { align-self: center; }
:root[data-character-tone] body[data-screen="home"] .shortcut { color: var(--accent); border-color: var(--paper); }
:root[data-character-tone] body[data-screen="home"] .shortcut:hover { background: var(--hover); }
:root[data-character-tone] body[data-screen="home"] :is(.software-tile[data-selected], .shortcut:focus-visible) {
  outline-color: #f8ffff; box-shadow: 0 0 0 7px var(--focus);
}

@media (max-width: 800px) {
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .controller-layout { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; flex-wrap: wrap; }
  .settings-nav button { min-height: 2.55rem; padding: .5rem; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-feature, .store-detail, .news-feature { grid-template-columns: minmax(0, 1fr); }
  .store-feature > .cover, .store-detail > .cover, .news-feature > .cover { height: auto; }
  .software-options { gap: 5px; }
  .shortcut { width: clamp(30px, 11.5vw, 51px); }
  .lock-screen { grid-template-columns: minmax(0, 1fr); }
  .lock-news { order: 1; }
  .lock-content { padding: 3rem 1rem; }
}
