@font-face {
  font-family: Press;
  src: url('./assets/press-start-2p.ttf') format('truetype');
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #f4f4e7;
  --muted: #bdcac4;
  --warm: #d8fa68;
  --line: #40514e;
  --panel: #1c292a;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #101719;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 14% 5%, #365a534d, transparent 48rem), #101719;
}
#lobby,
#arena {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(14px, 3.2vw, 42px);
  padding-bottom: max(26px, env(safe-area-inset-bottom));
}
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #ffe7a2;
  outline-offset: 3px;
}
.mast {
  display: flex;
  align-items: end;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(128px, 17vw, 190px);
  padding: clamp(16px, 3vw, 32px);
  border: 2px solid #577765;
  border-radius: 12px;
  background: #263e37;
}
.mast::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(80deg, #0c1919f2 0%, #10241ecc 29%, #162e2855 58%, transparent 84%),
    url('./assets/world-panoramas.webp') center top / 100% 400% no-repeat;
}
.mast-copy {
  max-width: 68%;
}
.overline {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 0.55rem;
  font: 700 0.82rem/1.1 'Trebuchet MS', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #e1f0bf;
}
.overline img {
  width: 24px;
  height: 24px;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
.mast h1,
.setup h2,
#sheet h2 {
  font-family: Press, monospace;
  line-height: 1.45;
  margin: 0;
}
.mast h1 {
  font-size: clamp(18px, 3.2vw, 35px);
  letter-spacing: -0.055em;
  line-height: 1.25;
  text-transform: uppercase;
  text-shadow: 0 3px #12241c;
}
.mast h1 span {
  display: block;
  color: var(--warm);
}
.mast::after {
  content: '';
  position: absolute;
  inset: 5px;
  pointer-events: none;
  --corner: linear-gradient(#d6edaa, #d6edaa);
  background:
    var(--corner) left top / 14px 2px, var(--corner) left top / 2px 10px,
    var(--corner) right bottom / 14px 2px, var(--corner) right bottom / 2px 10px;
  background-repeat: no-repeat;
}
.catalog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 17px);
}
.cover-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 8px;
  text-align: left;
  text-decoration: none;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  transition:
    transform 0.14s ease,
    border-color 0.14s ease;
}
.cover-card:hover {
  transform: translateY(-2px);
}
.cover-card[aria-pressed='true'] {
  border-color: var(--warm);
  background: #28372f;
}
.art {
  width: 100%;
  aspect-ratio: 1.5;
  background: #24372e url('./assets/playroom-covers.webp') no-repeat;
  background-size: 300% 200%;
  border-bottom: 1px solid var(--line);
}
.art-maze {
  background: url('./games/block-maze/assets/share/cover.png') right center / 178% auto no-repeat;
}
.art-jump {
  background-position: center bottom;
}
.art-dash {
  background-position: right bottom;
}
.offline-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 0.35rem 1.5rem;
}
.offline-extra details[open] {
  flex-basis: 100%;
}
#offline-tools #continue-saved {
  justify-self: start;
}
.art-coop {
  background-position: left top;
}
.art-golf {
  background-position: center top;
}
.art-mystery {
  background-position: right top;
}
.art-rhythm {
  background-position: left bottom;
}
.card-copy {
  display: grid;
  gap: 6px;
  padding: clamp(10px, 1.3vw, 16px);
}
.card-copy small {
  font-weight: 650;
  color: var(--warm);
  font-size: 0.75rem;
}
.card-copy strong {
  font-size: clamp(0.98rem, 1.45vw, 1.3rem);
  line-height: 1.18;
}
.card-copy > span,
.setup p,
#sheet p {
  font-size: 0.91rem;
  line-height: 1.45;
  color: var(--muted);
}
.setup {
  margin-top: 18px;
  padding: clamp(15px, 2.7vw, 28px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1b2728;
}
.setup h2,
#sheet h2 {
  font-size: clamp(14px, 2.2vw, 23px);
}
.setup p {
  margin: 0.45rem 0 0.9rem;
}
#party,
.launch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-pick,
.launch button,
.playbar button {
  border: 1px solid #52665e;
  background: #283838;
  border-radius: 8px;
  min-height: 42px;
  padding: 8px 13px;
}
#party {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 800px;
}
.hero-pick {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  position: relative;
  border: 2px solid #455550;
  border-radius: 4px;
  background: #202d2e;
  text-align: left;
}
.hero-pick[aria-pressed='true'] {
  border-color: var(--warm);
}
.hero-pick::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 15px;
  height: 15px;
  border: 2px solid #e2edcc;
  background: #192521a6;
}
.hero-pick[aria-pressed='true']::before {
  background: var(--warm);
}
.hero-pick[aria-pressed='true']::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 11px;
  width: 5px;
  height: 10px;
  border: solid #243528;
  border-width: 0 3px 3px 0;
  transform: rotate(42deg);
}
.hero-pick .face {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 0;
}
.hero-label {
  padding: 7px 8px;
  font: clamp(0.63rem, 1.2vw, 0.78rem)/1.4 Press, monospace;
}
.face {
  width: 44px;
  height: 33px;
  background-image: url('./assets/hero-portraits.webp');
  background-size: 200% 200%;
  background-position: 0 0;
  border-radius: 5px;
}
.face-maxim {
  background-position: 100% 0;
}
.face-mom {
  background-position: 0 100%;
}
.face-dad {
  background-position: 100% 100%;
}
.face-pasha {
  background: url('./assets/pasha-portrait.webp') center/cover;
}
.launch {
  margin-top: 14px;
}
.launch .primary {
  border-color: #dbf999;
  background: var(--warm);
  color: #1d2a22;
  font-weight: 750;
  min-width: 130px;
}
.launch button:disabled {
  opacity: 0.45;
  cursor: default;
}
.playbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.playbar h1 {
  text-align: center;
  font-size: clamp(14px, 2.3vw, 23px);
  margin: 0;
}
.playbar button {
  white-space: nowrap;
  font-size: 0.9rem;
}
#sheet {
  width: min(390px, 90%);
  padding: 24px;
  border: 1px solid #81957d;
  border-radius: 14px;
  background: #202e2d;
  color: var(--ink);
}
#sheet::backdrop {
  background: #100d1ac9;
}
#sheet p {
  margin: 0.75rem 0;
}
@media (max-width: 760px) {
  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-copy > span {
    font-size: 0.82rem;
  }
  .card-copy {
    gap: 4px;
  }
  .mast-copy {
    max-width: 100%;
  }
  .mast::before {
    background-size: 100% 100%, auto 400%;
  }
  #party {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .setup {
    margin-top: 12px;
  }
}
@media (max-width: 420px) {
  #lobby,
  #arena {
    padding: 12px;
  }
  .card-copy small {
    font-size: 0.68rem;
  }
  .card-copy > span {
    font-size: 0.77rem;
  }
  .playbar button {
    font-size: 0.78rem;
    padding: 7px;
  }
  .hero-pick {
    font-size: 0.85rem;
  }
  .face {
    width: 33px;
    height: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cover-card {
    transition: none;
  }
  .cover-card:hover {
    transform: none;
  }
}

/* Phone held sideways: keep the game bar slim so the board gets the height. */
@media (orientation: landscape) and (max-height: 540px) {
  #arena {
    max-width: none;
    padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .playbar {
    margin-bottom: 6px;
  }
  .playbar button {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}

.catalog > .setup {
  grid-column: 1 / -1;
  margin-top: 0;
}
.art-extra {
  background-image: url('./assets/adventure-covers.webp');
  background-size: 400% 200%;
}
.art-race { background-position: 0% 0%; }
.art-bridge { background-position: 33.33333% 0%; }
.art-tactics { background-position: 66.66667% 0%; }
.art-cafe { background-position: 100% 0%; }
.art-cards { background-position: 0% 100%; }
.art-pinball { background-position: 33.33333% 100%; }
.art-photo { background-position: 66.66667% 100%; }
.art-robot { background-position: 100% 100%; }

.play-tools, .sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.sound-toggle[aria-pressed='true'] .sound-cross,
.sound-toggle[aria-pressed='false'] .sound-waves {
  display: none;
}
.sound-toggle[aria-pressed='true'] svg {
  color: var(--warm);
}
@media (max-width: 680px) {
  .playbar .sound-toggle { padding-inline: 9px; }
  .playbar .sound-toggle [data-label] { display: none; }
}

/* Catalog filter: one row of chips above the covers. */
.catalog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 clamp(8px, 1.4vw, 14px);
}
.catalog-filter button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 650;
}
.catalog-filter button[aria-pressed='true'] {
  background: var(--warm);
  border-color: var(--warm);
  color: #182221;
}
