/* Home page (/): start screen with the Jogar button, then the game view. */
html:has(> body.home) {
  background: #c4b280;
}

body.home {
  --sun: #f2b84b;
  --sun-deep: #d9772b;
  --ink: #2b2114;
  margin: 0;
  min-height: 100vh;
  /* The pictures are the .home-bg layers below (z-index -1): the body must
   * not paint over them, so the fallback colour goes on <html>. */
  background: transparent;
  color: var(--ink);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  padding: 3rem clamp(1rem, 6vw, 6rem);
}

.kicker {
  margin: 0 0 0.5rem;
  color: #9a4a10;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.home h1 {
  margin: 0 0 1rem;
  font-family: Impact, "Arial Black", "Segoe UI Black", sans-serif;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  color: #fff;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 #000;
}

.home-logo {
  display: block;
  width: clamp(12rem, 30vw, 22rem);
  height: auto;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.35));
}

.home h1 span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.38em;
  letter-spacing: 0.12em;
  color: var(--sun);
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 3px 3px 0 #000;
}

.tagline {
  margin: 0 0 2rem;
  max-width: 28rem;
  font-size: 1.1rem;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
}

.play-button {
  padding: 0.9rem 3.2rem;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--sun), var(--sun-deep));
  color: #1a1004;
  border: 2px solid #000;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(217, 119, 43, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.play-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(217, 119, 43, 0.5);
}

.play-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.play-button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.hint {
  margin: 1.2rem 0 0;
  font-size: 0.9rem;
  color: #4a3b24;
}

.home .disclaimer {
  margin: 2.5rem 0 0;
  max-width: 28rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #5e5038;
}

/* The art (transparent cut-out) stands in the bottom-right corner and
 * drifts slowly right, then back left, in a loop. */
.hero-art {
  position: absolute;
  right: 4vw;
  bottom: 0;
  height: min(100vh, 1536px);
  max-width: 60vw;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 24px rgba(60, 40, 10, 0.35));
  animation: drift 9s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes drift {
  from { transform: translateX(-3vw); }
  to { transform: translateX(3vw); }
}

/* Backgrounds, fixed behind the start screen. Both drift on the art's
 * timing but the other way and by less (parallax: the city is farther
 * away). The second fades in over the first and out again, so they take
 * turns. Layers are wider than the screen so the drift shows no edge.
 * URLs are relative: they inherit the /v/<version>/ prefix. */
.home-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.home-bg-layer {
  position: absolute;
  inset: 0 -3vw;
  background: center / cover no-repeat;
  animation: bg-drift 9s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

.home-bg-layer.bg-a { background-image: url("home-bg.jpg"); }

.home-bg-layer.bg-b {
  background-image: url("home-bg2.webp");
  opacity: 0;
  animation: bg-drift 9s ease-in-out infinite alternate, bg-turn 36s ease-in-out infinite;
}

@keyframes bg-drift {
  from { transform: translateX(1.5vw); }
  to { transform: translateX(-1.5vw); }
}

/* 36 s: first picture ~15 s, 3 s fade, second ~15 s, 3 s fade back. */
@keyframes bg-turn {
  0%, 42% { opacity: 0; }
  50%, 92% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art, .home-bg-layer { animation: none; }
  .home-bg-layer.bg-b { animation: bg-turn 36s ease-in-out infinite; }
}

/* Touch screens: a note that the game itself needs keyboard and mouse
 * (the radio and the saves work fine there). */
.touch-note {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .touch-note {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 1.1rem 0 0;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(43, 33, 20, 0.25);
    border-left: 4px solid var(--sun-deep);
    border-radius: 8px;
    background: rgba(255, 248, 230, 0.82);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--ink);
  }
  /* The keyboard hint says the same for desktop: drop it here. */
  .hint {
    display: none;
  }
}

/* Phones (portrait): one centred column. The art stands behind the
 * lower half, faded into the background, and a soft light wash keeps the
 * text readable over the pictures. */
@media (max-width: 760px) {
  #hero {
    align-items: flex-start;
  }
  #hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(255, 246, 222, 0.55) 0%, rgba(255, 246, 222, 0.25) 45%, rgba(255, 246, 222, 0.6) 100%);
    pointer-events: none;
  }
  .hero-art {
    right: 50%;
    max-width: none;
    height: 62dvh;
    bottom: calc(var(--radio-h, 9rem) - 1rem);
    opacity: 0.22;
    filter: none;
    animation-name: drift-centre;
  }
  .hero-text {
    box-sizing: border-box;
    width: 100%;
    max-width: 30rem;
    margin: 0 auto;
    padding: calc(4.2rem + env(safe-area-inset-top)) 1.25rem 1rem;
    text-align: center;
  }
  .kicker {
    font-size: 0.75rem;
  }
  .home h1 {
    margin-bottom: 0.9rem;
  }
  .home-logo {
    width: min(15rem, 62vw);
    margin: 0 auto;
  }
  .home h1 span {
    font-size: 1.15rem;
  }
  .tagline {
    margin: 0 auto 1.5rem;
    font-size: 1rem;
  }
  /* Jogar on its own row, full width; Novo jogo and Jogos salvos share
   * the row under it (a lone one takes it all). */
  .hero-actions {
    gap: 0.6rem;
  }
  .hero-actions > button {
    min-height: 3.2rem;
    justify-content: center;
  }
  .play-button {
    flex: 1 1 100%;
    min-height: 4rem;
    padding: 0.7rem 1rem;
    font-size: 1.7rem;
  }
  .saves-button {
    flex: 1 1 8rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
  }
  .home #load {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
  }
  .home #run-status,
  .home .disclaimer,
  .touch-note {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }
  .home .disclaimer {
    margin-top: 1.5rem;
    text-align: center;
  }
  .lang-switch {
    top: calc(0.75rem + env(safe-area-inset-top));
  }
}

/* Short phones: a smaller logo so Jogar shows above the radio. */
@media (max-width: 760px) and (max-height: 700px) {
  .hero-text {
    padding-top: calc(3.6rem + env(safe-area-inset-top));
  }
  .home-logo {
    width: min(10.5rem, 50vw);
  }
  .tagline {
    margin-bottom: 1.1rem;
  }
}

@keyframes drift-centre {
  from { transform: translateX(calc(50% - 3vw)); }
  to { transform: translateX(calc(50% + 3vw)); }
}

/* Download progress, on the start screen in place of the Jogar button. */
.home #load {
  display: block;
  width: min(100%, 26rem);
  margin: 0;
  padding: 1rem 1.2rem;
  border: 2px solid #000;
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.85);
  box-shadow: 0 6px 24px rgba(60, 40, 10, 0.25);
}

.home #load[hidden] {
  display: none;
}

.load-title {
  margin: 0 0 0.6rem;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.home #load-progress {
  display: block;
  width: 100%;
  height: 1.1rem;
  accent-color: var(--sun-deep);
}

.home #load-text {
  display: block;
  margin-top: 0.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.home.loading .play-button {
  display: none;
}

/* While loading, #run-status repeats the percentage: hidden. Outside a run
 * it says why the last one ended (Parado, an error). */
.home.loading #run-status {
  display: none;
}

.home #run-status {
  margin: 0.8rem 0 0;
  max-width: 28rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.home #run-status:empty {
  display: none;
}

/* The home shows no run messages (the user asked); play.js still writes them. */
.home #run-status {
  display: none;
}

/* Players online in multiplayer (/api/online, home.js). */
.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.45rem 0.95rem 0.45rem 0.75rem;
  border: 1px solid rgba(43, 33, 20, 0.22);
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.8);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(43, 33, 20, 0.12);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.online-chip[hidden] { display: none; }
.online-chip b {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.online-dot {
  position: relative;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: #2fb32f;
  flex: none;
}
.online-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #2fb32f;
  animation: online-pulse 1.8s ease-out infinite;
}
.online-chip.empty .online-dot,
.online-chip.empty .online-dot::after { background: #9a8f7c; animation: none; }
@keyframes online-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .online-dot::after { animation: none; }
}
@media (max-width: 600px) {
  .online-chip { font-size: 0.85rem; }
}

/* Game view, after the download: the frame fills the browser window
 * (largest 4:3 box that fits, black around it), with a small exit button
 * in the corner. */
#game {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  align-items: center;
  justify-content: center;
}

.home.playing {
  background: #000;
  color: var(--fg);
  overflow: hidden;
}

.home.playing #hero {
  display: none;
}

.home.playing #game {
  display: flex;
}

.home #frame {
  display: block;
  /* home.js sets width and height from the game's resolution. */
  width: min(100vw, calc(100vh * 4 / 3));
  height: min(100vh, calc(100vw * 3 / 4));
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

.game-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

.game-bar:hover,
.game-bar:focus-within {
  opacity: 1;
}

.game-bar button {
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.home #input-status {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.85rem;
  color: #ddd;
  pointer-events: none;
  white-space: nowrap;
}

.home #input-status:empty {
  display: none;
}

/* Radio player, fixed at the bottom of the start screen: a row of station
 * chips over the player (station, controls, progress, volume). --accent
 * follows the chosen station (radio.js). */
#radio {
  --accent: var(--sun);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  color: #f3efe8;
  background: linear-gradient(180deg, rgba(28, 20, 9, 0.9), rgba(12, 8, 3, 0.97));
  box-shadow: 0 -10px 30px rgba(40, 25, 5, 0.35);
  backdrop-filter: blur(10px);
}

#radio::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -3px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

#radio[hidden],
.home.playing #radio {
  display: none;
}

.radio-stations {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem clamp(1rem, 4vw, 4rem) 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.radio-stations::-webkit-scrollbar {
  display: none;
}

.radio-chip {
  flex: none;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #d8cfc0;
  font: 600 0.78rem/1.2 system-ui, "Segoe UI", sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.radio-chip img {
  width: 1.15rem;
  height: 1.15rem;
  margin: -0.2rem 0.35rem -0.2rem -0.45rem;
  vertical-align: middle;
  object-fit: contain;
}

.radio-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.radio-chip[aria-checked="true"] {
  border-color: var(--chip);
  background: var(--chip);
  color: #160f05;
}

.radio-chip:focus-visible,
.radio-icon:focus-visible,
.radio-play:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.radio-main {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(12rem, 1.4fr) auto;
  align-items: center;
  gap: 1.4rem;
  padding: 0.55rem clamp(1rem, 4vw, 4rem) 0.75rem;
}

.radio-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.radio-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#radio-name {
  font-family: Impact, "Arial Black", sans-serif;
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#radio-now {
  font-size: 0.8rem;
  color: #b9b0a2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Album cover: the station's logo from the game, on a dark card that
 * glows in the station colour while it plays; the equalizer sits in its
 * corner. */
.radio-cover {
  position: relative;
  flex: none;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 25%, #2c2416, #0b0804 75%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

#radio.on .radio-cover {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--accent), 0 0 26px color-mix(in srgb, var(--accent) 45%, transparent);
}

.radio-cover img {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  animation: cover-in 0.35s ease;
}

.radio-cover img[hidden] {
  display: none;
}

@keyframes cover-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: none; }
}

/* Equalizer: low and still when paused, bouncing while it plays. */
.radio-eq {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 18px;
  height: 16px;
  padding: 4px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.7);
  box-sizing: content-box;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#radio.on .radio-eq {
  opacity: 1;
  transform: none;
}

.radio-eq i {
  flex: 1;
  height: 45%;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.5;
}

#radio.on .radio-eq i {
  opacity: 1;
  animation: eq 0.9s ease-in-out infinite alternate;
}

#radio.on .radio-eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
#radio.on .radio-eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.1s; }
#radio.on .radio-eq i:nth-child(4) { animation-delay: -0.15s; animation-duration: 0.8s; }

@keyframes eq {
  from { height: 20%; }
  to { height: 100%; }
}

.radio-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.radio-icon,
.radio-play {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.radio-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: transparent;
  color: #d8cfc0;
  transition: background 0.15s ease, color 0.15s ease;
}

.radio-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.radio-icon.small {
  width: 2rem;
  height: 2rem;
}

.radio-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.radio-play {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: #160f05;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease;
}

.radio-play:hover {
  transform: scale(1.06);
}

.radio-play svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: currentColor;
}

.radio-play .i-pause,
#radio.on .radio-play .i-play,
#radio-mute.muted .i-vol,
#radio-mute:not(.muted) .i-mute {
  display: none;
}

#radio.on .radio-play .i-pause {
  display: block;
}

.radio-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #b9b0a2;
}

.radio-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

#radio-bar {
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.radio-volume {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.radio-volume input {
  width: 6.5rem;
  accent-color: var(--accent);
}

/* Room for the player under the start screen text (--radio-h: home.js
 * measures the bar; the fallback is its desktop height). */
.home #hero {
  min-height: 100dvh;
  padding-bottom: calc(var(--radio-h, 8rem) + 4rem);
  box-sizing: border-box;
}

/* Credits: a small strip at the bottom of the start screen, just above
 * the radio player (the hero's padding leaves room for it). */
.credits {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--radio-h, 8rem) + 0.9rem);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.5rem;
  padding: 0 1rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.credits > span {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.credits a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(43, 33, 20, 0.25);
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.75);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.credits a:hover {
  background: #fff8e6;
  transform: translateY(-1px);
}

.credits a:focus-visible {
  outline: 2px solid var(--sun-deep);
  outline-offset: 2px;
}

.credits svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.home.playing .credits {
  display: none;
}

@media (max-width: 760px) {
  .home #hero {
    padding-bottom: calc(var(--radio-h, 9rem) + 6rem);
  }
  .credits > span {
    flex-basis: 100%;
    text-align: center;
  }
}

@media (max-width: 900px) {
  .radio-main {
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
  }
  .radio-progress {
    grid-column: 1 / -1;
  }
  .radio-volume {
    display: none;
  }
}

/* Phones: a compact two-row player. Chips scroll sideways with faded
 * edges; the cover shrinks; the progress line runs under the controls;
 * the bar clears the home indicator (safe area). */
@media (max-width: 760px) {
  #radio {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .radio-stations {
    gap: 0.35rem;
    padding: 0.5rem 0.9rem 0.1rem;
    scroll-snap-type: x proximity;
    scroll-padding: 0 0.9rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 0.9rem, #000 calc(100% - 2rem), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 0.9rem, #000 calc(100% - 2rem), transparent);
  }
  .radio-chip {
    scroll-snap-align: start;
    padding: 0.4rem 0.75rem;
  }
  .radio-main {
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.6rem;
    padding: 0.45rem 0.9rem 0.6rem;
  }
  .radio-info {
    gap: 0.65rem;
  }
  .radio-cover {
    width: 3rem;
    height: 3rem;
    border-radius: 8px;
  }
  .radio-eq {
    right: 3px;
    bottom: 3px;
    width: 12px;
    height: 10px;
    padding: 3px;
  }
  #radio-name {
    font-size: 1.05rem;
  }
  .radio-controls {
    gap: 0.2rem;
  }
  .radio-icon {
    width: 2.6rem;
    height: 2.6rem;
  }
  .radio-play {
    width: 2.9rem;
    height: 2.9rem;
  }
  .radio-progress {
    gap: 0.5rem;
    font-size: 0.7rem;
  }
}

/* Phones turned sideways (little height): the player is one row
 * (station, controls, progress) under the chips, and the start screen
 * gets a smaller logo. */
@media (max-height: 520px) and (orientation: landscape) {
  .radio-stations {
    padding-top: 0.4rem;
  }
  .radio-main {
    grid-template-columns: minmax(9rem, 1fr) auto minmax(8rem, 1.3fr);
    gap: 1rem;
    padding: 0.35rem clamp(0.9rem, 4vw, 2rem) 0.45rem;
  }
  .radio-progress {
    grid-column: auto;
  }
  .radio-cover {
    width: 2.6rem;
    height: 2.6rem;
  }
  #hero {
    align-items: flex-start;
  }
  .hero-text {
    max-width: 30rem;
    padding: 1rem clamp(1rem, 5vw, 3rem);
    padding-left: max(clamp(1rem, 5vw, 3rem), env(safe-area-inset-left));
  }
  .kicker {
    display: none;
  }
  .home-logo {
    width: 6.5rem;
  }
  .home h1 {
    margin-bottom: 0.5rem;
  }
  .home h1 span {
    font-size: 1rem;
  }
  .tagline {
    margin-bottom: 1rem;
    font-size: 0.95rem;
  }
  .hero-actions > button {
    min-height: 3.2rem;
  }
  .play-button {
    padding: 0.5rem 2.2rem;
    font-size: 1.5rem;
  }
  .hero-text {
    max-width: 36rem;
    padding-top: 0.8rem;
  }
  .hero-art {
    height: calc(100dvh - var(--radio-h, 7rem));
    bottom: var(--radio-h, 7rem);
  }
}

/* ---- Language switch (i18n.js), top right ---------------------------- */
.lang-switch {
  position: fixed;
  top: 1rem;
  right: clamp(1rem, 3vw, 2.5rem);
  z-index: 6;
  display: flex;
  padding: 3px;
  border: 1px solid rgba(43, 33, 20, 0.25);
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.75);
  backdrop-filter: blur(6px);
}

.lang-switch button {
  min-width: 2.6rem;
  padding: 0.3rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 700 0.8rem/1 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff6e2;
}

.lang-switch button:focus-visible {
  outline: 2px solid var(--sun-deep);
  outline-offset: 2px;
}

.home.playing .lang-switch {
  display: none;
}

/* ---- Play + saved games ---------------------------------------------- */
/* Jogar, Novo jogo and Jogos salvos: one row, all as tall as Jogar
 * (stretch; the smaller buttons centre their text with inline-flex). */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.9rem;
}

/* Same height on a wrapped line too (narrow screens): Jogar's own height. */
.hero-actions > button {
  box-sizing: border-box;
  min-height: 4.8rem;
}

.saves-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: rgba(255, 248, 230, 0.7);
  color: var(--ink);
  font: 700 1rem/1 system-ui, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.saves-button svg {
  width: 1.25rem;
  height: 1.25rem;
}

.saves-button:hover {
  transform: translateY(-2px);
  background: #fff8e6;
}

.saves-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.saves-button[hidden],
.home.loading .saves-button,
.home.playing .saves-button {
  display: none;
}

/* ---- Saved games dialog ---------------------------------------------- */
/* Opens with the panel rising and the slot cards following one by one;
 * closes by fading (dialog and backdrop transitions, allow-discrete). */
.saves-dialog {
  width: min(46rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #f3efe8;
  overflow: visible;
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.2, 0.9, 0.25, 1.15),
    overlay 0.34s allow-discrete, display 0.34s allow-discrete;
}

.saves-dialog[open] {
  opacity: 1;
  transform: none;
}

@starting-style {
  .saves-dialog[open] {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
}

.saves-dialog::backdrop {
  background: rgba(20, 12, 4, 0);
  backdrop-filter: blur(0);
  transition: background 0.3s ease, backdrop-filter 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.saves-dialog[open]::backdrop {
  background: rgba(20, 12, 4, 0.55);
  backdrop-filter: blur(4px);
}

@starting-style {
  .saves-dialog[open]::backdrop {
    background: rgba(20, 12, 4, 0);
    backdrop-filter: blur(0);
  }
}

.saves-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100dvh - 2rem);
  padding: 1.4rem clamp(1rem, 3vw, 1.8rem) 1.2rem;
  box-sizing: border-box;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(40, 29, 13, 0.97), rgba(16, 11, 5, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.saves-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, transparent, var(--sun), var(--sun-deep), transparent);
}

.saves-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.saves-head h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sun);
}

.saves-lead {
  margin: 0.35rem 0 0;
  max-width: 36rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #c9bfae;
}

.saves-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: #e8dfd0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.2s ease;
}

.saves-x svg {
  width: 1.1rem;
  height: 1.1rem;
}

.saves-x:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(90deg);
}

.saves-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.save-btn {
  padding: 0.5rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3efe8;
  font: 600 0.85rem/1.1 system-ui, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.save-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.save-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.save-btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--sun), var(--sun-deep));
  color: #1a1004;
}

.save-btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f6c665, #e0833a);
}

.save-btn.danger:hover {
  border-color: #e5533c;
  background: rgba(229, 83, 60, 0.18);
}

.save-btn:focus-visible,
.saves-x:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.saves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.save-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.85rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  animation: card-in 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
  animation-delay: calc(0.06s * var(--i, 0) + 0.08s);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.save-card:hover {
  border-color: rgba(242, 184, 75, 0.45);
  background: rgba(242, 184, 75, 0.06);
}

.save-card.empty {
  border-style: dashed;
  background: transparent;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.save-num {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--sun), var(--sun-deep));
  color: #1a1004;
  font: 400 1.35rem/1 Impact, "Arial Black", sans-serif;
}

.save-card.empty .save-num {
  background: rgba(255, 255, 255, 0.08);
  color: #8f8575;
}

.save-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.save-body strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.save-card.empty .save-body strong {
  color: #b3a998;
  font-weight: 600;
}

.save-meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: #a99f8f;
}

.save-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.save-actions .save-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.saves-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
  color: #9ccc65;
}

.saves-status.bad {
  color: #ff8a73;
}

.saves-where {
  margin: 0;
  font-size: 0.75rem;
  color: #8f8575;
  overflow-wrap: anywhere;
}

/* Drop target: shows while files are dragged over the panel. */
.saves-drop {
  position: absolute;
  inset: 0.5rem;
  display: grid;
  place-items: center;
  border: 2px dashed var(--sun);
  border-radius: 12px;
  background: rgba(16, 11, 5, 0.88);
  color: var(--sun);
  font: 400 1.5rem/1.2 Impact, "Arial Black", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.saves-panel.drop .saves-drop {
  opacity: 1;
}

@media (max-width: 600px) {
  .saves-grid {
    grid-template-columns: 1fr;
  }
  .lang-switch {
    top: 0.6rem;
  }
}

/* The autosave card (runtime autosave, slot 9) sits above the 8 slots and
 * spans the row. */
.save-card.auto {
  grid-column: 1 / -1;
  border-color: rgba(120, 200, 140, 0.4);
  background: linear-gradient(90deg, rgba(120, 200, 140, 0.12), rgba(255, 255, 255, 0.03));
}

.save-card.auto .save-num {
  background: linear-gradient(180deg, #8fdc9f, #3e9a5a);
}

/* Multiplayer (mp.js): the button beside Jogar, the name dialog, and over
 * the game the name tags, the status box and the join/leave feed. */
.mp-button {
  background: linear-gradient(180deg, #7fd0ff, #2f86c9);
  box-shadow: 0 6px 24px rgba(47, 134, 201, 0.35);
}
.mp-button:hover {
  box-shadow: 0 10px 30px rgba(47, 134, 201, 0.5);
}
.home.loading .mp-button {
  display: none;
}
.mp-dialog {
  max-width: min(26rem, calc(100vw - 32px));
  padding: 0;
  border: 2px solid #000;
  border-radius: 8px;
  background: #fff8e6;
  color: #1a1004;
}
.mp-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.mp-panel {
  display: grid;
  gap: 0.7rem;
  padding: 1.4rem;
}
.mp-panel h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mp-lead {
  margin: 0;
  line-height: 1.45;
}
.mp-panel label {
  font-weight: 700;
}
.mp-panel input {
  padding: 0.6rem 0.7rem;
  border: 2px solid #1a1004;
  border-radius: 6px;
  font: 600 1.05rem system-ui, "Segoe UI", sans-serif;
}
.mp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.mp-actions .play-button {
  padding: 0.5rem 1.6rem;
  font-size: 1.3rem;
}
.hero-actions > .mp-actions button,
.mp-actions button {
  min-height: 0;
}
.mp-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.mp-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  will-change: transform;
}
.mp-tag b {
  font: 700 13px/1 system-ui, "Segoe UI", sans-serif;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 1px 2px #000;
  white-space: nowrap;
}
.mp-tag small {
  display: flex;
  align-items: center;
  gap: 4px;
  font: 700 11px/1 system-ui, "Segoe UI", sans-serif;
  text-shadow: 0 0 2px #000, 0 1px 2px #000;
  white-space: nowrap;
}
.mp-tag small img { width: 16px; height: 16px; object-fit: contain; filter: drop-shadow(0 1px 1px #000); }
.mp-tag i {
  display: block;
  width: 46px;
  height: 5px;
  border: 1px solid #000;
  background: linear-gradient(90deg, #c8102e var(--hp, 100%), #3a0a0a var(--hp, 100%));
}
.mp-hud,
.mp-feed {
  position: fixed;
  left: 10px;
  z-index: 3;
  pointer-events: none;
  font: 600 13px/1.35 system-ui, "Segoe UI", sans-serif;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}
.mp-hud {
  top: 10px;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
}
.mp-feed {
  top: 42px;
  display: grid;
  gap: 2px;
}
.mp-feed p {
  margin: 0;
}
.mp-mic {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: #ddd;
  cursor: pointer;
}
.mp-mic svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
.mp-mic.on {
  border-color: #3ddc84;
  background: rgba(20, 110, 60, 0.85);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.3);
}
.mp-mic.on .mp-mic-off {
  display: none;
}
.mp-mic:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.home:not(.playing) .mp-mic,
.home:not(.playing) .mp-layer,
.home:not(.playing) .mp-hud,
.home:not(.playing) .mp-feed {
  display: none;
}

/* Character picker (phase 55): button left of the microphone, portrait grid. */
.mp-pick {
  position: fixed;
  right: 80px;
  bottom: 16px;
  z-index: 4;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
.mp-pick svg { width: 26px; height: 26px; fill: currentColor; }
.mp-pick:hover { border-color: #fff; color: #fff; }
.mp-pick:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.home:not(.playing) .mp-pick { display: none; }
.mp-skins {
  width: min(920px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: #121212;
  color: #f2f2f2;
  overflow: hidden;
}
.mp-skins[open] { display: flex; flex-direction: column; }
.mp-skins::backdrop { background: rgba(0, 0, 0, 0.6); }
.mp-skins header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mp-skins h2 { margin: 0; font-size: 1.15rem; }
.mp-skins-x {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.mp-skins-x:hover { background: rgba(255, 255, 255, 0.18); }
.mp-skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  grid-auto-rows: max-content;
  gap: 10px;
  padding: 16px 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.mp-skin {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  text-align: center;
  cursor: pointer;
}
.mp-skin:hover { background: rgba(255, 255, 255, 0.12); }
.mp-skin.on { border-color: #3ddc84; background: rgba(61, 220, 132, 0.14); }
.mp-skin:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mp-skin img, .mp-skin-none {
  display: block;
  width: 100%;
  height: auto;
  flex: none;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  background: #2a2a2a;
}
.mp-skin-none { display: grid; place-items: center; font-size: 2rem; color: #666; }
.mp-skin span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .mp-skins-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
}

/* Gangs (phase 56): button left of the character button, list, war bar. */
.mp-gang {
  position: fixed;
  right: 144px;
  bottom: 16px;
  z-index: 4;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
.mp-gang svg { width: 24px; height: 24px; fill: currentColor; }
.mp-gang.has-art { overflow: hidden; }
.mp-gang img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mp-gang:hover { border-color: #fff; }
.mp-gang:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.home:not(.playing) .mp-gang, .home:not(.playing) .mp-war { display: none; }
.mp-gangs { width: min(560px, calc(100vw - 32px)); }
.mp-gangs-hint { margin: 0; padding: 12px 18px 0; color: #bdbdbd; font-size: 0.86rem; line-height: 1.45; }
.mp-gangs-list { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 20px; overflow-y: auto; }
.mp-gang-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mp-gang-row { flex-shrink: 0; }
.mp-gang-row:hover { background: rgba(255, 255, 255, 0.12); }
.mp-gang-row.on { border-color: #3ddc84; background: rgba(61, 220, 132, 0.14); }
.mp-gang-row i { width: 44px; height: 44px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.35); box-sizing: border-box; }
.mp-gang-row img { width: 44px; height: 44px; border-radius: 50%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); transition: transform 0.15s ease; }
.mp-gang-row:hover img, .mp-gang-row.on img { transform: scale(1.08); }
/* the gang picker's header: city sunset art (web/public/mp-art, Higgsfield) */
.mp-gangs-head {
  min-height: 120px;
  align-items: flex-end !important;
  background: linear-gradient(to bottom, rgba(18, 18, 18, 0) 30%, rgba(18, 18, 18, 0.92)), url('mp-art/gangs-banner.webp') center 40% / cover no-repeat;
  border-bottom: 0 !important;
}
.mp-gangs-head h2 { font-size: 1.5rem !important; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85); }
.mp-gangs-head .mp-skins-x { flex-shrink: 0; min-height: 0; min-width: 0; width: 36px; height: 36px; align-self: flex-start; display: grid; place-items: center; padding: 0; background: rgba(0, 0, 0, 0.5); }
.mp-skins-x:focus { outline: none; }
.mp-skins-x:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mp-gang-row span { color: #bdbdbd; font-size: 0.85rem; }
.mp-war {
  position: fixed;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: min(420px, calc(100vw - 32px));
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.75);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}
.mp-war { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; column-gap: 10px; }
.mp-war[hidden] { display: none; }
.mp-war img { width: 34px; height: 34px; object-fit: contain; }
.mp-war-att { grid-column: 1; }
.mp-war span { grid-column: 2; }
.mp-war-def { grid-column: 3; }
.mp-war i { grid-column: 1 / -1; display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.mp-war b { display: block; height: 100%; width: 0; transition: width 0.5s linear; }

/* Buy Me a Coffee: helps pay for the server */
.coffee-button {
  position: fixed;
  top: 1rem;
  right: calc(clamp(1rem, 3vw, 2.5rem) + 6.6rem);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: 2px solid #1a1a1a;
  border-radius: 999px;
  background: #ffdd00;
  color: #1a1a1a;
  font: 700 0.95rem/1.2 system-ui, "Segoe UI", sans-serif;
  text-decoration: none;
  box-shadow: 0 3px 0 #1a1a1a;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.coffee-button svg { width: 1.3rem; height: 1.3rem; flex: none; }
.coffee-button:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #1a1a1a; }
.coffee-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.home.playing .coffee-button { display: none; }
.coffee-short { display: none; }
@media (max-width: 760px) {
  .coffee-button { top: 0.6rem; right: auto; left: 1rem; padding: 0.5rem 0.85rem; font-size: 0.85rem; }
  .coffee-long { display: none; }
  .coffee-short { display: inline; }
}

/* The multiplayer map (M), over the running game */
.mp-map {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(5, 10, 18, 0.72);
  backdrop-filter: blur(2px);
  cursor: grab;
  touch-action: none;
}
.mp-map[hidden] { display: none; }
.mp-map:active { cursor: grabbing; }
.mp-map canvas { display: block; width: 100%; height: 100%; }
.mp-map-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #ddd;
  font: 600 12px/1.3 system-ui, "Segoe UI", sans-serif;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  pointer-events: none;
}
.mp-map-x {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  padding: 0;
  min-width: 0;
  min-height: 0;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.6) !important;
  color: #fff;
}
.home:not(.playing) .mp-map { display: none; }

.mp-mapbtn { right: 208px; }
.home:not(.playing) .mp-mapbtn { display: none; }


/* Spawn city for new multiplayer players (art: mp-art/spawn-*.webp, Higgsfield) */
.spawn-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  background: #07060f url('mp-art/spawn-bg.webp') center / cover no-repeat;
  overflow-y: auto;
}
.spawn-dialog[open] { display: grid; place-items: center; animation: spawn-in 0.35s ease-out; }
.spawn-dialog::backdrop { background: #000; }
@keyframes spawn-in { from { opacity: 0; } to { opacity: 1; } }
.spawn-wrap {
  width: min(1120px, 100%);
  padding: 32px 24px 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.spawn-head { text-align: center; max-width: 640px; }
.spawn-kicker {
  margin: 0 0 6px;
  color: #ffcf4d;
  font: 700 0.8rem/1 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.spawn-head h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.02em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
}
.spawn-lead { margin: 10px 0 0; color: #d6d2e8; font-size: 1rem; line-height: 1.5; text-shadow: 0 2px 8px #000; }
.spawn-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; width: 100%; }
.spawn-card {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.spawn-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.spawn-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.35) 38%, transparent 60%);
}
.spawn-card:hover, .spawn-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--city);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--city), 0 0 36px color-mix(in srgb, var(--city) 45%, transparent);
  outline: none;
}
.spawn-card:hover img, .spawn-card:focus-visible img { transform: scale(1.06); }
.spawn-info { position: absolute; left: 20px; right: 20px; bottom: 64px; z-index: 1; display: grid; gap: 6px; }
.spawn-info b {
  font-family: Impact, "Arial Black", sans-serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 18px color-mix(in srgb, var(--city) 70%, transparent), 0 2px 6px #000;
}
.spawn-info span { color: #e4e1ee; font-size: 0.95rem; line-height: 1.4; }
.spawn-go {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  z-index: 1;
  padding: 9px 0;
  border-radius: 999px;
  background: var(--city);
  color: #111;
  font: 800 0.85rem/1 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  opacity: 0.88;
  transition: opacity 0.2s ease;
}
.spawn-card:hover .spawn-go, .spawn-card:focus-visible .spawn-go { opacity: 1; }
.spawn-cancel {
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #eee;
  font: 600 0.9rem/1 system-ui, "Segoe UI", sans-serif;
  cursor: pointer;
}
.spawn-cancel:hover { background: rgba(255, 255, 255, 0.12); }
@media (max-width: 760px) {
  .spawn-dialog[open] { place-items: start center; }
  .spawn-wrap { padding: 24px 16px; gap: 18px; }
  .spawn-cards { grid-template-columns: 1fr; gap: 14px; }
  .spawn-card { aspect-ratio: 16 / 8; }
  .spawn-card img { object-position: center 35%; }
  .spawn-card::after { background: linear-gradient(to right, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 85%); }
  .spawn-info { bottom: auto; top: 50%; transform: translateY(-50%); right: 40%; }
  .spawn-go { left: auto; right: 14px; bottom: 14px; padding: 8px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .spawn-card, .spawn-card img, .spawn-dialog[open] { transition: none; animation: none; }
}
