/* ==========================================================================
   Rowan's World — shared styles
   Blocky pixel textures (Minecraft vibes) + chunky bright UI (Roblox vibes)
   ========================================================================== */

:root {
  --tile: 64px;

  --sky-top: #4fb6ff;
  --sky-bottom: #bfeaff;
  --night-top: #0b1030;
  --night-bottom: #2c3470;

  --ink: #1d1d1d;
  --text-shadow: #3f3f3f;
  --gui: #c6c6c6;
  --gui-light: #ffffff;
  --gui-dark: #555555;
  --slot: #8b8b8b;
  --slot-dark: #373737;

  --green: #00b06f;
  --green-dark: #00784b;
  --yellow: #ffff3f;
  --red: #e2231a;
  --blue: #2f7bff;
  --purple: #8a4dff;

  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-chunky: "Lilita One", "Arial Black", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #1a1a1a url("/assets/img/stone.png");
  background-size: var(--tile);
  image-rendering: pixelated;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.5;
  overflow-x: hidden;
}

img,
.px {
  image-rendering: pixelated;
}

a {
  color: inherit;
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.6)), url("/assets/img/plank.png");
  background-size: auto, 48px;
  border-bottom: 4px solid #000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: clamp(11px, 2.4vw, 16px);
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}

.logo-block {
  width: 32px;
  height: 32px;
  flex: none;
  background: url("/assets/img/grass-side.png") center / cover;
  border: 2px solid #000;
  transition: transform 0.2s;
}

.logo:hover .logo-block {
  transform: rotate(-12deg) scale(1.1);
}

.nav {
  display: flex;
  gap: 8px;
}

/* ---------- Minecraft-style stone button ---------- */

.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px 10px;
  font: 400 11px/1.2 var(--font-pixel);
  color: #fff;
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--text-shadow);
  background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12)), #737373;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #a9a9a9, inset -3px -3px 0 #4b4b4b;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.mc-btn:hover,
.mc-btn:focus-visible {
  color: #ffffa0;
  background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12)), #6f7fbf;
  box-shadow: inset 3px 3px 0 #a5b3ef, inset -3px -3px 0 #44508a;
  outline: none;
}

.mc-btn:active {
  transform: translateY(2px);
}

.mc-btn[aria-current="page"] {
  background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12)), #3e9b3e;
  box-shadow: inset 3px 3px 0 #7fd67f, inset -3px -3px 0 #236b23;
}

/* ---------- Big chunky Roblox-style play button ---------- */

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px 18px;
  font: 400 clamp(22px, 4vw, 30px) / 1 var(--font-chunky);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  background: var(--green);
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.25), inset 0 4px 0 rgba(255, 255, 255, 0.3), 0 6px 0 #000;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}

.play-btn:hover,
.play-btn:focus-visible {
  background: #13c97f;
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.25), inset 0 4px 0 rgba(255, 255, 255, 0.3), 0 8px 0 #000;
  outline: none;
}

.play-btn:active {
  transform: translateY(5px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), inset 0 4px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #000;
}

.play-btn .tri {
  width: 0;
  height: 0;
  border-left: 18px solid #fff;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
}

.play-btn--small {
  padding: 8px 16px 11px;
  font-size: 20px;
  border-width: 3px;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25), inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 4px 0 #000;
}

.play-btn--small .tri {
  border-left-width: 13px;
  border-top-width: 8px;
  border-bottom-width: 8px;
}

/* ---------- Sky ---------- */

.sky {
  position: relative;
  overflow: hidden;
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
  transition: background 1.2s;
  isolation: isolate;
}

.sky::after {
  /* night tint layer, faded in by body.night */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(var(--night-top), var(--night-bottom));
  opacity: 0;
  transition: opacity 1.2s;
}

body.night .sky::after {
  opacity: 1;
}

.stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 1.2s;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 25% 60%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 40% 15%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 45%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 70% 25%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 85% 55%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 12%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 5% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 63% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 33% 35%, #fff 50%, transparent 51%);
}

body.night .stars {
  opacity: 1;
  animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
  to {
    opacity: 0.55;
  }
}

/* The square Minecraft-y sun. It's a button: click for night mode. */
.sun {
  position: absolute;
  top: 36px;
  left: 7%;
  z-index: 2;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #fff9c4;
  box-shadow: 0 0 0 10px rgba(255, 245, 150, 0.55), 0 0 0 22px rgba(255, 245, 150, 0.25), 0 0 60px 30px rgba(255, 240, 120, 0.4);
  transition: background 0.8s, box-shadow 0.8s, transform 0.3s;
}

.sun:hover {
  transform: rotate(8deg) scale(1.06);
}

body.night .sun {
  background:
    linear-gradient(#c9c9d6, #c9c9d6) 18px 14px / 14px 14px no-repeat,
    linear-gradient(#c9c9d6, #c9c9d6) 44px 40px / 10px 10px no-repeat,
    linear-gradient(#c9c9d6, #c9c9d6) 16px 46px / 8px 8px no-repeat,
    #eef0ff;
  box-shadow: 0 0 0 10px rgba(200, 210, 255, 0.25), 0 0 50px 20px rgba(180, 190, 255, 0.25);
}

/* Flat blocky clouds */
.clouds {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.cloud {
  position: absolute;
  left: -260px;
  height: 26px;
  background: rgba(255, 255, 255, 0.92);
  animation: drift linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
}

.cloud::before {
  left: 20%;
  top: -18px;
  width: 45%;
  height: 18px;
}

.cloud::after {
  left: 50%;
  bottom: -14px;
  width: 35%;
  height: 14px;
}

body.night .cloud {
  background: rgba(190, 200, 235, 0.35);
}

.cloud:nth-child(1) { top: 60px;  width: 200px; animation-duration: 70s; animation-delay: -10s; }
.cloud:nth-child(2) { top: 150px; width: 140px; animation-duration: 95s; animation-delay: -60s; }
.cloud:nth-child(3) { top: 40px;  width: 260px; animation-duration: 120s; animation-delay: -30s; }
.cloud:nth-child(4) { top: 230px; width: 180px; animation-duration: 85s; animation-delay: -75s; }
.cloud:nth-child(5) { top: 110px; width: 120px; animation-duration: 60s; animation-delay: -45s; }

@keyframes drift {
  to {
    transform: translateX(calc(100vw + 520px));
  }
}

/* ---------- Ground layers (grass -> dirt -> stone) ---------- */

.grass-edge {
  height: var(--tile);
  background: url("/assets/img/grass-side.png") repeat-x;
  background-size: var(--tile);
  border-top: 4px solid #2c5e16;
}

.dirt-layer {
  height: calc(var(--tile) * 1.5);
  background: url("/assets/img/dirt.png");
  background-size: var(--tile);
  box-shadow: inset 0 -30px 30px -10px rgba(0, 0, 0, 0.35);
}

.underground {
  position: relative;
  padding: 48px 16px 72px;
  background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.55)), url("/assets/img/stone.png");
  background-size: auto, var(--tile);
}

.ore {
  position: absolute;
  width: var(--tile);
  height: var(--tile);
  background-size: cover;
  filter: brightness(0.75);
}

.bedrock {
  padding: 28px 16px;
  text-align: center;
  color: #d9d9d9;
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 2;
  text-shadow: 2px 2px 0 #000;
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), url("/assets/img/bedrock.png");
  background-size: auto, var(--tile);
  border-top: 4px solid #000;
}

.bedrock a {
  color: var(--yellow);
}

/* ---------- Inventory panel ---------- */

.panel {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 32px) 32px;
  background: var(--gui);
  border: 4px solid;
  border-color: var(--gui-light) var(--gui-dark) var(--gui-dark) var(--gui-light);
  outline: 4px solid #000;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.45);
}

.panel-title {
  margin: 0 0 6px;
  font: 400 clamp(14px, 3vw, 22px) / 1.4 var(--font-pixel);
  color: #3f3f3f;
}

.panel-sub {
  margin: 0 0 22px;
  color: #444;
  font-size: 17px;
}

.panel-foot {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

/* ---------- Game cards ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 4px solid #000;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #000;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translate(-3px, -3px) rotate(-1deg);
  box-shadow: 9px 9px 0 #000;
  outline: none;
}

.game-card:hover .thumb-art,
.game-card:focus-visible .thumb-art {
  transform: scale(1.15) rotate(6deg);
}

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 4px solid #000;
  background-color: var(--card-color, var(--blue));
  background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.35)), var(--card-tex, none);
  background-size: auto, 48px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-art {
  font-size: 84px;
  line-height: 1;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
  transition: transform 0.2s;
}

.thumb .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 8px 5px;
  font: 400 9px/1 var(--font-pixel);
  color: #000;
  background: var(--yellow);
  border: 3px solid #000;
  transform: rotate(-4deg);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.card-title {
  margin: 0;
  font: 400 26px/1.1 var(--font-chunky);
  letter-spacing: 0.5px;
}

.card-desc {
  margin: 0;
  flex: 1;
  color: #444;
  font-size: 15px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 9px 3px;
  font: 400 13px/1.4 var(--font-chunky);
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--purple);
  border: 2px solid #000;
  border-radius: 999px;
}

.tag:nth-child(3n + 2) { background: var(--blue); }
.tag:nth-child(3n + 3) { background: #ff7a00; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

/* Empty "coming soon" inventory slots */
.slot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 300px;
  padding: 20px;
  text-align: center;
  background: var(--slot);
  border: 4px solid;
  border-color: var(--slot-dark) #fff #fff var(--slot-dark);
  color: #e8e8e8;
}

.slot-card .q {
  font: 400 54px/1 var(--font-pixel);
  color: #6d6d6d;
  text-shadow: 3px 3px 0 #c6c6c6;
}

.slot-card .soon {
  font: 400 10px/1.6 var(--font-pixel);
  color: #3f3f3f;
}

/* ---------- Section headings over the stone ---------- */

.section-title {
  margin: 0 auto 26px;
  max-width: 1100px;
  text-align: center;
  font: 400 clamp(16px, 3.4vw, 26px) / 1.4 var(--font-pixel);
  color: #fff;
  text-shadow: 3px 3px 0 #000;
}

/* ---------- Generic textured pixel heading ---------- */

.pixel-title {
  margin: 0;
  font: 400 clamp(26px, 7.5vw, 72px) / 1.15 var(--font-pixel);
  letter-spacing: 2px;
  color: #fff;
  text-shadow:
    3px 3px 0 #555,
    6px 6px 0 #2c2c2c,
    9px 9px 0 rgba(0, 0, 0, 0.35);
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}

.pixel-title .line {
  display: block;
}

.pixel-title .gold {
  color: #ffd83a;
  text-shadow:
    3px 3px 0 #c98f12,
    6px 6px 0 #7a5306,
    9px 9px 0 rgba(0, 0, 0, 0.35);
}

/* Yellow splash text, Minecraft title-screen style */
.splash {
  position: absolute;
  right: -40px;
  bottom: -6px;
  white-space: nowrap;
  font: 400 clamp(8px, 1.6vw, 14px) / 1.4 var(--font-pixel);
  font-style: normal;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #3f3f00;
  -webkit-text-stroke: 0;
  letter-spacing: 0;
  text-align: center;
  transform: rotate(-16deg);
  transform-origin: center;
  animation: splash 0.45s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes splash {
  from {
    transform: rotate(-16deg) scale(1);
  }
  to {
    transform: rotate(-16deg) scale(1.08);
  }
}

/* ---------- Home hero ---------- */

.hero {
  position: relative;
  z-index: 3;
  max-width: 1100px;
  margin: 0 auto;
  padding: 110px 16px 150px;
  text-align: center;
}

.hero-title {
  position: relative;
  display: inline-block;
  cursor: pointer;
  user-select: none;
}

.tagline {
  max-width: 560px;
  margin: 34px auto 30px;
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 800;
  color: #0e2a47;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
  transition: color 1.2s;
}

body.night .tagline {
  color: #e6ebff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

/* Minecraft-ish hotbar showing mined block counts */
.hotbar {
  display: inline-flex;
  margin-top: 34px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.55);
  border: 3px solid #000;
}

.hotbar-slot {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 3px solid #8b8b8b;
  border-right-width: 0;
  background: rgba(0, 0, 0, 0.25);
}

.hotbar-slot:last-child {
  border-right-width: 3px;
}

.hotbar-slot i {
  width: 30px;
  height: 30px;
  background-size: cover;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.hotbar-slot b {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font: 400 10px/1 var(--font-pixel);
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
}

.hotbar-slot.bump {
  animation: bump 0.3s;
}

@keyframes bump {
  50% {
    transform: scale(1.25);
    border-color: #fff;
  }
}

.hint {
  margin: 10px 0 0;
  font: 400 9px/1.6 var(--font-pixel);
  color: rgba(14, 42, 71, 0.75);
}

body.night .hint {
  color: rgba(230, 235, 255, 0.75);
}

/* ---------- Floating 3D blocks (click to mine!) ---------- */

.floaters {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  perspective: 900px;
}

.floater {
  position: absolute;
  animation: bob 4s ease-in-out infinite;
}

.floater:nth-child(1) { top: 22%; right: 9%; --s: 92px; }
.floater:nth-child(2) { top: 58%; left: 6%;  --s: 70px; animation-delay: -1.3s; }
.floater:nth-child(3) { top: 30%; left: 12%; --s: 52px; animation-delay: -2.6s; }
.floater:nth-child(4) { top: 62%; right: 24%; --s: 58px; animation-delay: -0.7s; }

@keyframes bob {
  50% {
    transform: translateY(-18px);
  }
}

.cube {
  --s: inherit;
  position: relative;
  width: var(--s);
  height: var(--s);
  padding: 0;
  border: 0;
  background: none;
  transform-style: preserve-3d;
  animation: sway 9s ease-in-out infinite alternate;
  cursor: crosshair;
  pointer-events: auto;
}

.floater:nth-child(even) .cube {
  animation-direction: alternate-reverse;
}

@keyframes sway {
  from {
    transform: rotateX(-24deg) rotateY(20deg);
  }
  to {
    transform: rotateX(-24deg) rotateY(70deg);
  }
}

.cube .face {
  position: absolute;
  inset: 0;
  background-image: var(--crack, none), var(--tex);
  background-size: cover;
  image-rendering: pixelated;
  outline: 1px solid rgba(0, 0, 0, 0.35);
}

.cube .f-front  { transform: translateZ(calc(var(--s) / 2)); filter: brightness(0.9); }
.cube .f-back   { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.7); }
.cube .f-right  { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.75); }
.cube .f-left   { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.8); }
.cube .f-top    { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube .f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.5); }

.cube--grass .face        { --tex: url("/assets/img/grass-side.png"); }
.cube--grass .f-top       { --tex: url("/assets/img/grass-top.png"); }
.cube--grass .f-bottom    { --tex: url("/assets/img/dirt.png"); }
.cube--diamond .face      { --tex: url("/assets/img/diamond-ore.png"); }
.cube--gold .face         { --tex: url("/assets/img/gold-block.png"); }
.cube--emerald .face      { --tex: url("/assets/img/emerald-ore.png"); }

.cube[data-stage="1"] { --crack: url("/assets/img/crack-1.png"); }
.cube[data-stage="2"] { --crack: url("/assets/img/crack-2.png"); }
.cube[data-stage="3"] { --crack: url("/assets/img/crack-3.png"); }
.cube[data-stage="4"] { --crack: url("/assets/img/crack-4.png"); }

.cube.hit {
  animation: sway 9s ease-in-out infinite alternate, hit 0.12s;
}

@keyframes hit {
  50% {
    scale: 0.92;
  }
}

.cube.broken {
  visibility: hidden;
}

.cube.respawn {
  animation: sway 9s ease-in-out infinite alternate, respawn 0.4s ease-out;
}

@keyframes respawn {
  from {
    scale: 0;
  }
}

.particle {
  position: fixed;
  z-index: 100;
  width: 10px;
  height: 10px;
  pointer-events: none;
  background-size: 400%;
  image-rendering: pixelated;
  animation: fly 0.7s ease-out forwards;
}

@keyframes fly {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

/* ---------- Blocky avatar (classic Roblox-y colours) ---------- */

.avatar {
  --skin: #f5cd30;
  --shirt: #0d69ac;
  --pants: #a4bd47;
  position: absolute;
  right: clamp(16px, 13%, 220px);
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 22px 44px 22px;
  grid-template-rows: 40px 44px 44px;
  justify-items: center;
  cursor: pointer;
  transform-origin: bottom center;
}

.avatar > div {
  border: 3px solid rgba(0, 0, 0, 0.55);
}

.av-head {
  grid-column: 2;
  width: 40px;
  height: 40px;
  position: relative;
  background: var(--skin);
  border-radius: 6px;
  animation: nod 3s ease-in-out infinite;
}

.av-eye {
  position: absolute;
  top: 12px;
  width: 6px;
  height: 8px;
  background: #111;
  border-radius: 2px;
  transition: transform 0.08s;
}

.av-eye.l { left: 9px; }
.av-eye.r { right: 9px; }

.av-mouth {
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 16px;
  height: 7px;
  margin-left: -8px;
  border: 3px solid #111;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

.av-arm {
  grid-row: 2;
  width: 22px;
  height: 44px;
  background: var(--skin);
  transform-origin: top center;
}

.av-arm.l {
  grid-column: 1;
  animation: arm-idle 3s ease-in-out infinite;
}

.av-arm.r {
  grid-column: 3;
  animation: arm-idle 3s ease-in-out infinite reverse;
}

.avatar.waving .av-arm.r {
  animation: wave 0.35s ease-in-out 4 alternate;
}

.av-torso {
  grid-column: 2;
  grid-row: 2;
  width: 44px;
  height: 44px;
  background: var(--shirt);
}

.av-legs {
  grid-column: 2;
  grid-row: 3;
  width: 44px;
  height: 44px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(0, 0, 0, 0.45) 47% 53%, transparent 53%),
    var(--pants);
}

@keyframes nod {
  50% {
    transform: rotate(-4deg);
  }
}

@keyframes arm-idle {
  50% {
    transform: rotate(8deg);
  }
}

@keyframes wave {
  from {
    transform: rotate(-150deg);
  }
  to {
    transform: rotate(-190deg);
  }
}

.speech {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  translate: -50% 0;
  padding: 8px 12px;
  font: 400 16px/1.2 var(--font-chunky);
  white-space: nowrap;
  color: #000;
  background: #fff;
  border: 3px solid #000;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.speech::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: #000;
}

.avatar.waving .speech,
.avatar:hover .speech {
  opacity: 1;
  transform: none;
}

/* ---------- Page banner (games page) ---------- */

.banner {
  position: relative;
  z-index: 3;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 16px 70px;
  text-align: center;
}

.banner .pixel-title {
  font-size: clamp(22px, 6vw, 54px);
}

/* ---------- Play page ---------- */

.play-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.play-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.play-toolbar h1 {
  flex: 1;
  min-width: 180px;
  margin: 0 6px;
  font: 400 clamp(24px, 4vw, 36px) / 1.1 var(--font-chunky);
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 3px 3px 0 #000;
}

.frame-box {
  position: relative;
  width: 100%;
  height: min(75vh, 760px);
  min-height: 420px;
  background: #000;
  border: 4px solid #000;
  outline: 4px solid #555;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.45);
}

.frame-box iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.frame-box:fullscreen {
  height: 100%;
  border: 0;
  outline: 0;
}

.play-info {
  margin-top: 34px;
}

.play-info .panel {
  max-width: none;
}

.play-info p {
  margin: 0 0 10px;
  font-size: 17px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.controls li {
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  display: inline-block;
  min-width: 34px;
  padding: 6px 8px 5px;
  font: 400 10px/1 var(--font-pixel);
  text-align: center;
  color: #fff;
  background: #555;
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 #888, inset -2px -2px 0 #333;
}

.not-found {
  padding: 60px 16px;
  text-align: center;
  color: #fff;
}

/* ---------- 404 "you died" screen ---------- */

.death {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 60px 16px;
  text-align: center;
  background: linear-gradient(rgba(140, 0, 0, 0.55), rgba(60, 0, 0, 0.85)), url("/assets/img/stone.png");
  background-size: auto, var(--tile);
  color: #fff;
}

.death h1 {
  margin: 0 0 20px;
  font: 400 clamp(28px, 8vw, 64px) / 1.2 var(--font-pixel);
  text-shadow: 4px 4px 0 #3f0000;
}

.death p {
  margin: 0 0 8px;
  font: 400 clamp(10px, 2vw, 14px) / 1.8 var(--font-pixel);
  text-shadow: 2px 2px 0 #3f0000;
}

.death .score {
  color: var(--yellow);
}

.death .buttons {
  display: grid;
  gap: 12px;
  width: min(400px, 100%);
  margin: 36px auto 0;
}

.death .mc-btn {
  padding-block: 16px;
  font-size: 12px;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  :root {
    --tile: 48px;
  }

  .hero {
    padding: 120px 16px 170px;
  }

  .sun {
    width: 52px;
    height: 52px;
    top: 24px;
  }

  .floater:nth-child(1) { top: 6%;  right: 5%; --s: 56px; }
  .floater:nth-child(2) { top: auto; bottom: 40px; left: 6%; --s: 50px; }
  .floater:nth-child(3),
  .floater:nth-child(4) { display: none; }

  .avatar {
    right: 16px;
    scale: 0.8;
    transform-origin: bottom right;
  }

  .splash {
    right: -8px;
    bottom: -22px;
  }

  .mc-btn {
    padding: 9px 10px 8px;
    font-size: 9px;
  }

  .logo-block {
    width: 26px;
    height: 26px;
  }

  .frame-box {
    min-height: 320px;
    height: 62vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .cloud {
    display: none;
  }
}
