/* The shell's screens (#69 step 5; the TS app's apps/host/src/shell.css): home with the room and
   the games, a game's setup, how to play, settings, controls, the controller test. The colours
   are app.css's variables; the Paper theme changes them for the menus only (not the match). */

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.1em;
  padding: 1.1em 2em 2em;
}

.theme-paper .screen,
.theme-paper .menu {
  --ui: #e9e4d2;
  --ui-line: rgba(43, 40, 54, 0.14);
  --ui-text: #2b2836;
  --ui-dim: rgba(43, 40, 54, 0.66);
  --ui-key: rgba(43, 40, 54, 0.1);
  --focus: #1f6fd1;
  background: #d8d2bd;
  color: var(--ui-text);
  color-scheme: light;
}

.theme-paper.high-contrast .screen,
.theme-paper.high-contrast .menu {
  --ui: #ffffff;
  --ui-line: rgba(0, 0, 0, 0.6);
  --ui-dim: rgba(0, 0, 0, 0.85);
  background: #f4efdc;
}

.theme-paper .chip[aria-pressed='true'],
.theme-paper .btn.primary,
.theme-paper .start {
  color: #fffaf0;
}

.theme-paper .corner {
  color: rgba(43, 40, 54, 0.6);
}

.screen .row .wrap {
  flex: 1;
  min-width: 0;
}

/* Button hints along the bottom during play, when switched off in the settings. */
.no-hints .pg-hints {
  display: none !important;
}

.topbar {
  margin-top: 0.9em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6em;
}

.logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em;
  margin: 0;
  font-size: 1.4em;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.logo svg {
  width: 1em;
  height: 1em;
}

.logo span {
  margin-left: 0.3em;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
}

.ghost {
  font-weight: 800;
  background: transparent;
  border: 2px solid var(--ui-line);
  border-radius: 0.7em;
  padding: 0.4em 0.9em;
  cursor: pointer;
}

.screen .panel {
  width: auto;
  padding: 1.1em 1.3em;
  border-radius: 1.1em;
}

.screen .panel > h2,
.screen .panel h2 {
  margin: 0 0 0.6em;
  font-size: 1.15em;
  font-weight: 900;
}

.dim {
  color: var(--ui-dim);
}

.hint {
  margin: 0.8em 0 0;
  color: var(--ui-dim);
  font-size: max(var(--fs-small), 0.85em);
}

.home-grid,
.setup-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(20em, 1fr) 2fr;
  gap: 1.2em;
  align-items: start;
}

.setup-grid {
  grid-template-columns: 2fr minmax(17em, 1fr);
}

.home-grid > *,
.setup-grid > * {
  min-width: 0;
}

/* Under 50 lines of text wide (data-fit narrow or medium): one column. */
:root:not([data-fit='wide']) .home-grid,
:root:not([data-fit='wide']) .setup-grid {
  grid-template-columns: 1fr;
}

/* ------------------------------------------------------------ players */

.players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6em;
}

.pcard {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7em;
  padding: 0.55em 0.8em;
  border-radius: 0.9em;
  background: color-mix(in srgb, var(--c, transparent) 14%, transparent);
  border: 2px solid color-mix(in srgb, var(--c, var(--ui-line)) 55%, transparent);
}

.pcard.empty {
  border-style: dashed;
  border-color: var(--ui-line);
  background: transparent;
}

.pcard-icon svg {
  width: 2.1em;
  height: 2.1em;
  display: block;
}

.pcard-body {
  flex: 1;
  min-width: 8em;
}

.pcard-name {
  font-weight: 900;
}

.pcard-device {
  color: var(--ui-dim);
  font-size: max(var(--fs-small), 0.8em);
}

.pcard-device .away {
  color: #ffb86b;
  font-weight: 900;
}

.theme-paper .pcard-device .away {
  color: #b35a00;
}

/* The room's VIP phone (#72 item 25): it picks the game and starts it from its lobby. */
.vip-badge {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  font-size: max(var(--fs-small), 0.72em);
  font-weight: 900;
  vertical-align: 0.12em;
  color: #2b2100;
  background: #ffd25e;
}

/* The line under a setup's title: who can start it from their phone. */
.vip-hint {
  margin: 0.3em 0 0;
  font-size: max(var(--fs-small), 0.85em);
  font-weight: 700;
}

.vip-hint .vip-badge {
  margin: 0 0.3em 0 0;
}

.pcard-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
}

.mini {
  font-size: max(var(--fs-small), 0.78em);
  font-weight: 800;
  background: var(--ui-key);
  border: 0;
  border-radius: 0.6em;
  padding: 0.35em 0.7em;
  margin: 0.15em 0.2em 0 0;
  cursor: pointer;
}

/* ------------------------------------------------------------ the room code: read aloud, hidden (#72 item 24) */

.code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4em;
}

/* The speaker next to the code: round, at least the touch size. */
.speak-code {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: max(var(--touch-min), 2.4em);
  height: max(var(--touch-min), 2.4em);
  padding: 0;
  font-size: max(var(--fs-small), 1em);
  line-height: 1;
  color: inherit;
  background: color-mix(in srgb, currentColor 12%, transparent);
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 50%;
  cursor: pointer;
}

.speak-code span {
  font-size: 1.3em;
}

/* In place of the QR code and the code while they are hidden (streaming). */
.code-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  padding: 0.8em;
  text-align: center;
  border: 2px dashed color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 0.5em;
}

.code-cover p {
  margin: 0;
}

.code-cover-title {
  font-size: 1.3em;
  font-weight: 900;
}

.code-cover-why {
  font-size: max(var(--fs-small), 0.85em);
  opacity: 0.8;
}

/* ------------------------------------------------------------ games */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13em), 1fr));
  gap: 1em;
}

.gcard {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  padding: 1em;
  border-radius: 1em;
  background: color-mix(in srgb, var(--ui-text) 5%, transparent);
  border: 2px solid var(--ui-line);
  text-align: left;
  cursor: pointer;
}

.gcard-art {
  display: block;
  color: var(--ui-text);
}

.gcard-art svg,
.gcard-art img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 8em;
}

/* The rendered pictures keep their shape when max-height trims them, and fade out at the
   edges so a board cut by the frame melts into the card. */
.gcard-art img {
  object-fit: contain;
  user-select: none;
  mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, transparent 100%);
}

.gcard-name {
  font-size: 1.3em;
  font-weight: 900;
}

.gcard-tag {
  color: var(--ui-dim);
}

.gcard-meta {
  margin-top: 0.3em;
  font-size: max(var(--fs-small), 0.75em);
  font-weight: 800;
  color: var(--ui-dim);
}

.gcard.soon {
  justify-content: center;
  align-items: center;
  text-align: center;
  border-style: dashed;
  opacity: 0.6;
  min-height: 8em;
  cursor: default;
}

/* ------------------------------------------------------------ setup, settings, help */

.setup-main,
.settings-panel,
.help-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  align-items: flex-start;
}

.settings-panel,
.help-panel {
  max-width: 54em;
  width: 100%;
  margin: 0 auto;
}

.screen .settings-panel > h2,
.screen .help-panel > h2,
.screen .setup-title h2 {
  margin: 0;
  font-size: 2.2em;
  font-weight: 900;
}

.setup-actions {
  display: flex;
  gap: 0.6em;
}

.setup-title {
  display: flex;
  gap: 1.2em;
  align-items: center;
}

.setup-title .gcard-art {
  width: 9em;
}

.tagline {
  margin: 0.2em 0 0;
  color: var(--ui-dim);
}

.screen .rows {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  width: 100%;
}

.screen .row > .label {
  min-width: 8.5em;
}

.screen .rows h3,
.seat-list h3 {
  margin: 0.4em 0 0.2em;
  font-size: max(var(--fs-small), 0.85em);
  font-weight: 900;
  color: var(--ui-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.seat-list {
  width: 100%;
}

.wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.swatches {
  display: inline-flex;
  gap: 0.2em;
  margin-left: 0.4em;
}

/* Settings in groups (#72 build 20): Display, Sound, Controls, Accessibility on one page. */
.screen .set-group + .set-group {
  margin-top: 0.5em;
  padding-top: 0.4em;
  border-top: 1px solid var(--ui-line);
}

.screen .set-group > .hint {
  margin: 0.2em 0 0;
}

.start-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8em;
}

/* An option focused by a pad scrolls into view above the Start row, not under it. */
#app:has(.setup-main > .start-row) {
  scroll-padding-bottom: 7em;
}

/* The tutorial and challenges, under the Start row. */
.setup-solo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
}

/* The setup's Start row stays at the bottom of the screen while the options scroll under it:
   Start has the focus from the first frame, and a TV cannot scroll to it (#70). */
.setup-main > .start-row {
  position: sticky;
  bottom: 0;
  z-index: 2;
  align-self: stretch;
  padding: 0.6em 0;
  /* The panel's look (--ui over the page's --bg), solid, so the options do not show through. */
  background: linear-gradient(var(--ui), var(--ui)), var(--bg);
  box-shadow: 0 -0.6em 0.8em -0.3em var(--bg);
}

.start {
  padding: 0.6em 1.6em;
  border-radius: 0.8em;
  border: 0;
  background: var(--ui-text);
  color: #1d1a26;
  font-size: 1.15em;
  font-weight: 900;
  cursor: pointer;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
  padding: 0.5em 1em;
  border-radius: 0.7em;
  border: 2px solid var(--ui-line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mode-btn span {
  color: var(--ui-dim);
  font-size: max(var(--fs-small), 0.8em);
}

.start:disabled,
.mode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.help-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20em), 1fr));
  gap: 0.8em 1.6em;
}

.help-body section h3 {
  margin: 0 0 0.3em;
  font-size: 1.1em;
  font-weight: 900;
}

.help-body p,
.help-body ul {
  margin: 0 0 0.4em;
  color: var(--ui-dim);
  line-height: 1.45;
}

.help-body b {
  color: var(--ui-text);
}

.help-body ul {
  padding-left: 1.1em;
}

.ctl-row .chip {
  min-width: 12em;
}

.name-input {
  width: 14em;
  padding: 0.4em 0.6em;
  border-radius: 0.6em;
  border: 2px solid var(--ui-line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 1.2em;
  font-weight: 800;
}

.theme-paper .name-input,
.theme-paper .code-input {
  background: #fffaf0;
}

/* ------------------------------------------------------------ rename: the on-screen keyboard (#72 item 17) */

.screen.rename {
  padding-bottom: 1em;
}

.screen.rename .settings-panel {
  width: min(46em, 100%);
  max-width: 46em;
  gap: 0.6em;
}

.screen.rename .settings-panel > h2 {
  margin: 0;
  font-size: 1.5em;
}

.screen.rename .hint {
  margin: 0;
}

/* Only a touch screen can tap the box for its own keyboard (js/ui.ts). */
.kb-touch-hint {
  display: none;
}

:root[data-touch] .kb-touch-hint {
  display: inline;
}

/* The name, its count and Save stay at the top while the keys scroll under them (a phone, a
   TV at big text), so the name is always in sight while typing. */
.rename-row {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  align-self: stretch;
  padding: 0.4em 0;
  /* The panel's look (--ui over the page's --bg), solid, so the keys do not show through. */
  background: linear-gradient(var(--ui), var(--ui)), var(--bg);
  box-shadow: 0 0.6em 0.8em -0.3em var(--bg);
}

/* Little room (big text on a phone): the box says "Name" to a screen reader, not on screen, so
   the row stays short. */
:root[data-fit='narrow'] .rename-row > .label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A key focused by a pad scrolls into view under the name row, not behind it. */
#app:has(.rename-row) {
  scroll-padding-top: 5em;
}

.rename-row .name-input {
  flex: 1 1 6em;
  width: auto;
  min-width: 0;
  max-width: 16em;
}

.rename-row .btn {
  flex: none;
  padding-inline: 0.9em;
}

.rename-count {
  flex: none;
  color: var(--ui-dim);
  font-size: max(var(--fs-small), 0.8em);
  font-variant-numeric: tabular-nums;
}

.kb {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  width: 100%;
}

/* The keys wrap to the width (A–Z order reads on at any text size): at most 10 a row, each at
   least 44 px (a phone fits 6 or 7 a row; a phone's own keyboard has 10 smaller ones). */
.kb-keys {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(44px, 1.7em, calc((100% - 3.6em) / 10)), 1fr)
  );
  gap: 0.4em;
}

.kb-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.8em;
  width: 100%;
}

.kb-row {
  display: flex;
  flex: 1 1 14em;
  flex-wrap: wrap;
  gap: 0.4em;
}

.kb-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
}

/* The keys' height follows the screen's height too, so a TV at 150 % text shows them all. */
.kb-key {
  min-width: 44px;
  min-height: max(44px, min(2.3em, 7.5vh));
  padding: 0 0.3em;
  border: 2px solid var(--ui-line);
  border-bottom-width: 0.18em;
  border-radius: 0.6em;
  background: var(--ui-key);
  font-size: 1.1em;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.kb-key:active {
  transform: scale(0.94);
}

.kb-key.wide {
  flex: 1 1 3em;
  font-size: 1em;
}

.kb-key.del {
  flex-basis: 4em;
}

.kb-key.space {
  flex: 3 1 4em;
  font-size: 1em;
}

.kb-key[aria-pressed='true'] {
  border-color: var(--ui-text);
}

.reduced-motion .kb-key:active {
  transform: none;
}

/* A phone: a little less padding around the panel, so 7 keys fit a row. */
@media (max-width: 599.98px) and (orientation: portrait) {
  .screen.rename {
    padding-inline: 0.5em;
  }

  .screen.rename .settings-panel {
    padding-inline: 0.7em;
  }
}

/* No gamepad and no phone: no Ⓧ / Ⓨ / Start / Ⓑ badges on this screen (Shell/App.InputHints.cs). */
.no-pad .rename .pb {
  display: none;
}

/* Phones only have OK and Back: Ⓧ / Ⓨ / Start only with a gamepad (Ⓑ is the phone's Back). */
.no-gamepad .rename :is(.pb.x, .pb.y, .pb-start) {
  display: none;
}

/* ------------------------------------------------------------ the controller test */

/* A side panel at the right, over Home, Settings or the paused match (#72 item 28): the page
   stays in sight, dimmed; a click beside the panel closes it. Wide enough on a TV for two or
   three pad cards in a row, so eight pads fit with little scrolling (a pad cannot scroll it:
   pressing a button brings that pad's card into view instead). Full width on a narrow screen or
   at big text sizes. Above the HUD and the pause dialog, under the hold ring (z-index 60). */
.side-panel {
  position: fixed;
  inset: 0;
  z-index: 45;
}

.side-scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 16, 0.55);
}

.side-box {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(56em, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(1em, var(--safe-top)) max(1.2em, var(--safe-right)) max(1.2em, var(--safe-bottom))
    1.2em;
  border-left: 1px solid var(--ui-line);
  background: var(--bg);
  color: var(--ui-text);
  box-shadow: -0.6em 0 2em rgba(0, 0, 0, 0.35);
  animation: side-in 0.18s ease-out;
}

@keyframes side-in {
  from {
    transform: translateX(2em);
    opacity: 0;
  }
}

.reduced-motion .side-box {
  animation: none;
}

:root[data-fit='narrow'] .side-box {
  width: 100%;
  border-left: 0;
  padding-left: max(1em, var(--safe-left));
}

.side-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
}

.side-head h2 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 900;
}

.side-box .hint {
  margin: 0;
}

.pad-who {
  color: var(--ui-dim);
}

.pads {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17em), 1fr));
  gap: 1em;
  width: 100%;
}

.pad {
  padding: 0.9em 1em;
  border-radius: 0.9em;
  border: 1px solid var(--ui-line);
  background: color-mix(in srgb, var(--ui-text) 4%, transparent);
}

.pad h3 {
  margin: 0;
  font-size: 1.1em;
}

.pad p {
  margin: 0.2em 0;
}

/* A short card: the title and buttons seen on one line, the name and mapping on the next, the
   stick beside the buttons. */
.pad-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 0.6em;
}

.pad .pad-id {
  overflow-wrap: anywhere;
}

.pad-body {
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin-top: 0.4em;
}

.pad-body .btns {
  flex: 1;
  min-width: 0;
}

.stick {
  position: relative;
  flex: none;
  width: 4em;
  height: 4em;
  border-radius: 50%;
  border: 2px solid var(--ui-line);
}

.stick span {
  position: absolute;
  left: calc(50% - 0.5em);
  top: calc(50% - 0.5em);
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: var(--ui-text);
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
}

.pbtn {
  min-width: 2.4em;
  padding: 0.2em 0.4em;
  border-radius: 0.5em;
  border: 2px solid var(--ui-line);
  text-align: center;
  font-size: max(var(--fs-small), 0.85em);
}

.pbtn.seen {
  border-color: #3ddc84;
}

.pbtn.down {
  background: #3ddc84;
  color: #10261a;
}

.report {
  width: 100%;
  margin: 0;
  padding: 0.8em;
  border-radius: 0.7em;
  background: rgba(0, 0, 0, 0.25);
  font-size: max(var(--fs-small), 0.8em);
  white-space: pre-wrap;
}

.summary {
  margin: 0;
}

/* Narrow screens (#70, #72: data-fit='narrow', under 36 lines of text wide): the setup's title
   wraps under its picture instead of sticking out at the side, and the page edges get thinner. */
:root[data-fit='narrow'] .screen {
  padding: 0.8em 0.5em 1.2em;
}

:root[data-fit='narrow'] .setup-title {
  flex-wrap: wrap;
  gap: 0.6em;
}

:root[data-fit='narrow'] .setup-title > * {
  min-width: 0;
  max-width: 100%;
}

:root[data-fit='narrow'] .setup-title .gcard-art {
  width: 6em;
}

:root[data-fit='narrow'] .screen .setup-title h2 {
  font-size: 1.5em;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ setup presets (#72 item 18) */

/* Quick / Classic / Long / Custom: four cards in a row, each with what it means in one line;
   two by two when the row is too narrow for four readable cards (a tablet, big text). */
.presets-box {
  flex: 1;
  min-width: 0;
  container: presets / inline-size;
}

.presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5em;
}

.chip.preset {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.1em;
  min-width: 0;
  padding: 0.4em 0.75em;
  text-align: left;
}

.chip.preset b {
  font-weight: 900;
}

.chip.preset b,
.chip.preset span {
  max-width: 100%;
  overflow-wrap: break-word;
}

@container presets (max-width: 30em) {
  .presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.chip.preset span {
  font-size: max(var(--fs-small), 0.8em);
  font-weight: 700;
  opacity: 0.8;
}

.preset-sum {
  margin: 0 0 0.3em;
}

.screen .row > .label small {
  font-size: max(var(--fs-small), 0.85em);
}

/* Who sits where: at the top of the room panel when it is beside the options (it stays in sight
   however many players join), else right under the options (one column: a phone, a tablet, big
   text). The page has both; one shows. */
.setup-room .seat-list {
  margin: 0 0 0.8em;
}

:root[data-fit='wide'] .setup-main > .seat-list,
:root:not([data-fit='wide']) .setup-room > .seat-list {
  display: none;
}

/* A TV: the seats two by two, so eight fit beside the options. */
:root[data-bp='tv'] .setup-room .seats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

:root[data-bp='tv'] .setup-room .seat {
  min-width: 0;
}

/* A TV (it cannot scroll to what a pad cannot focus), or a screen under 50 lines of text tall
   (720p, a 768p tablet; data-fit-y): Back, How to play and the title share a line, with a smaller
   picture, so the presets, seats and bots fit above the Start row even with the first-timer's
   tutorial hint. */
:root[data-bp='tv'] .setup .setup-main,
:root:not([data-fit-y='tall'], [data-fit='narrow']) .setup .setup-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.2em;
}

:root[data-bp='tv'] .setup .setup-main > :not(.setup-actions, .setup-title),
:root:not([data-fit-y='tall'], [data-fit='narrow'])
  .setup
  .setup-main
  > :not(.setup-actions, .setup-title) {
  grid-column: 1 / -1;
}

:root[data-bp='tv'] .setup .setup-title .gcard-art,
:root:not([data-fit-y='tall'], [data-fit='narrow']) .setup .setup-title .gcard-art {
  width: 4.5em;
}

:root[data-bp='tv'] .screen .setup-title h2,
:root:not([data-fit-y='tall'], [data-fit='narrow']) .screen .setup-title h2 {
  font-size: 1.6em;
}

/* Under 50 lines tall, but not a TV (which has the width for it): no tagline under the title. */
:root:not([data-fit-y='tall'], [data-bp='tv']) .setup .tagline {
  display: none;
}

/* Under 38 lines of text tall (a phone upright or a TV at 150 % text): no top bar (the setup's
   own Back is enough; Home has it), picture, tagline or first-timer's tutorial hint (the
   Tutorial button under Start still glows for them), so the presets, seats and bots stay above
   the Start row. */
:root[data-fit-y='short'] .setup > .topbar,
:root[data-fit-y='short'] .setup .setup-title .gcard-art,
:root[data-fit-y='short'] .setup .tagline,
:root[data-fit-y='short'] .setup .solo-new {
  display: none;
}

/* A phone upright and short at this text size: Advanced is one word, beside Start if it fits. */
:root[data-fit-y='short'][data-bp='xs'] .setup .adv-more {
  display: none;
}

:root[data-fit-y='short'][data-bp='xs'] .setup .start-row .advanced {
  flex: 1 1 auto;
  text-align: center;
}

/* Narrow (a phone upright, or big text): the cards two by two, labels above their buttons. */
:root[data-fit='narrow'] .presets {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* A phone (xs upright, s-land on its side): the setup's own Back is enough, so the top bar goes
   (Home has it), the title gets small, and the options start near the top. */
@media (max-width: 599.98px) and (orientation: portrait),
  (max-height: 499.98px) and (orientation: landscape) {
  :root:not(.tv) .setup > .topbar {
    display: none;
  }

  :root:not(.tv) .setup .setup-main {
    gap: 0.6em;
  }

  :root:not(.tv) .setup .setup-title {
    gap: 0.6em;
  }

  :root:not(.tv) .setup .setup-title .gcard-art {
    width: 4.5em;
  }

  :root:not(.tv) .screen .setup-title h2 {
    font-size: 1.5em;
  }

  :root:not(.tv) .setup .start {
    padding: 0.4em 1.2em;
  }

  :root:not(.tv) .setup-main > .start-row {
    padding: 0.4em 0;
  }

  :root:not(.tv) .setup .solo-new {
    margin: 0;
  }
}

/* A phone upright: no picture by the title, and Start with Advanced beside it when Advanced
   still has room for its words (at big text it goes under Start, full width). */
@media (max-width: 599.98px) and (orientation: portrait) {
  :root:not(.tv) .setup .setup-title .gcard-art {
    display: none;
  }

  :root:not(.tv) .setup .start-row .advanced {
    flex: 1 1 9em;
    text-align: left;
  }
}

/* A phone on its side: little height, so Back, How to play and the title share one line, the
   picture and tagline go, and so does the first-timer's tutorial hint (the Tutorial button
   under Start still glows for them). */
@media (max-height: 499.98px) and (orientation: landscape) {
  :root:not(.tv) .setup {
    padding-top: max(0.5em, var(--safe-top));
  }

  :root:not(.tv) .setup .setup-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 1em;
  }

  :root:not(.tv) .setup .setup-main > :not(.setup-actions, .setup-title) {
    grid-column: 1 / -1;
  }

  :root:not(.tv) .setup .setup-title .gcard-art,
  :root:not(.tv) .setup .tagline,
  :root:not(.tv) .setup .solo-new {
    display: none;
  }

  :root:not(.tv) .screen .setup-title h2 {
    font-size: 1.3em;
  }
}

/* ------------------------------------------------------------ look picker (#78: Shell/LookPicker.cs) */

.look-step {
  display: inline-flex;
  margin-right: 0.25em;
}

.look-step .mini {
  margin-right: 0;
}

.look-step .mini.arrow {
  border-radius: 0.6em 0 0 0.6em;
  padding-inline: 0.5em;
  margin-right: 1px;
}

.look-step .mini:not(.arrow) {
  border-radius: 0 0.6em 0.6em 0;
}

.look-swatches {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 1em;
  padding-left: 2.8em;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15em;
}

.swatch {
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.45em;
  background: transparent;
  cursor: pointer;
}

.swatch svg {
  width: 1em;
  height: 1em;
  display: block;
}

.swatch .dot {
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  background: var(--s);
}

.swatch.mine {
  border-color: var(--ui-text);
}

.swatch.taken {
  opacity: 0.25;
  cursor: not-allowed;
  background: repeating-linear-gradient(135deg, transparent 0 3px, var(--ui-line) 3px 5px);
}

.swatch:not(.taken):not(.mine):hover {
  border-color: var(--ui-dim);
}

@media (pointer: coarse) {
  .swatch {
    width: 2.2em;
    height: 2.2em;
  }
}

@media (max-width: 599px) {
  .look-swatches {
    padding-left: 0;
  }
}
