/* ---------- base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --plate: #f3f2ee;
  --plate-edge: #d9d7d0;
}

html, body {
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #2b3a67 0%, #16203a 45%, #0c1120 100%);
  color: #eaeefb;
  overflow: hidden;
}

.scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

/* ---------- title ---------- */
.title { text-align: center; }
.title h1 {
  font-size: clamp(28px, 7vw, 46px);
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fff, #b9c6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 10px rgba(90,120,255,.35));
}
.title p {
  margin-top: 6px;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #8ea0d0;
}

/* ---------- base plate ---------- */
/* outer = raised white frame; ::before = recessed inner tray the keys sit in */
.plate {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 28px;               /* thicker frame around the tray */
  border-radius: 34px;
  background: linear-gradient(160deg, #ffffff, var(--plate) 55%, var(--plate-edge));
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,.9),
    inset 0 -6px 12px rgba(0,0,0,.12),
    0 30px 60px -20px rgba(0,0,0,.65),
    0 8px 20px rgba(0,0,0,.35);
}

/* the recessed inner tray — a stepped-down floor the keys are seated into */
.plate::before {
  content: "";
  position: absolute;
  inset: 13px;                 /* leaves the outer white frame visible */
  border-radius: 26px;
  background: linear-gradient(160deg, #edeae3, #e0ddd5);
  box-shadow:
    /* dark step where the frame drops down into the tray */
    inset 0 5px 8px rgba(0,0,0,.22),
    inset 0 2px 2px rgba(0,0,0,.18),
    /* soft light lip at the bottom edge of the recess */
    inset 0 -3px 4px rgba(255,255,255,.55),
    /* crisp highlight line separating frame from tray */
    0 1px 0 rgba(255,255,255,.85);
  z-index: 0;
}

/* keep the keys and hanger above the recessed tray */
.plate > .key { position: relative; z-index: 1; }

/* little hanger clip at the top like the real toy */
.clip {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 20px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(#fff, #e7e5df);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.9), 0 3px 5px rgba(0,0,0,.25);
}
.clip::after {
  content: "";
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #d7d5ce;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}

/* ---------- keycap button ---------- */
.key {
  --cap-bg: #fff;
  --cap-bg-2: #eee;
  position: relative;
  width: clamp(96px, 30vw, 132px);
  height: clamp(96px, 30vw, 132px);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  perspective: 500px;
}

/* the sculpted cap that actually moves */
.cap {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(158deg, var(--cap-bg), var(--cap-bg-2));
  /* the cap sits on a tall solid "wall" (stacked shadows) so it looks
     like a real chunky keycap rising off the plate */
  box-shadow:
    /* glossy top rim + inner sculpt */
    inset 0 3px 2px rgba(255,255,255,.85),
    inset 0 -5px 9px rgba(0,0,0,.30),
    /* solid side wall, getting darker toward the base */
    0 2px 0 var(--cap-side),
    0 4px 0 var(--cap-side),
    0 6px 0 var(--cap-side),
    0 8px 0 color-mix(in srgb, var(--cap-side) 78%, #000),
    0 10px 0 color-mix(in srgb, var(--cap-side) 62%, #000),
    /* ambient contact shadow on the plate */
    0 16px 18px -6px rgba(0,0,0,.55),
    0 28px 42px -12px rgba(0,0,0,.45);
  transform: translateZ(0);
  transition: transform .06s cubic-bezier(.4,.8,.4,1), box-shadow .06s ease;
  overflow: hidden;
}

/* soft top-left sheen so the plastic catches the light */
.cap::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  border-radius: 16px 16px 40% 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0));
  pointer-events: none;
}

/* the dished top face where text lives (cherry-profile look) */
.cap__face {
  position: absolute;
  inset: 9px;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.12), inset 0 -2px 4px rgba(255,255,255,.35);
}

.cap__name {
  font-family: "Anton", "Arial Narrow", "Oswald", sans-serif;
  font-weight: 400; /* Anton is already ultra-bold */
  font-size: clamp(15px, 4.4vw, 21px);
  letter-spacing: .5px;
  line-height: 1;
  text-transform: uppercase;
}
.cap__name--sm { font-size: clamp(11px, 3.3vw, 15px); }
.cap__name--top { margin-bottom: 2px; }
.cap__num {
  font-family: "Anton", "Arial Narrow", "Oswald", sans-serif;
  font-weight: 400;
  font-size: clamp(30px, 9vw, 46px);
  line-height: .9;
}

/* HAALAND uses a totally different playful, rounded, outlined sticker font */
.cap__name--haaland {
  font-family: "Luckiest Guy", "Comic Sans MS", cursive;
  font-size: clamp(13px, 3.9vw, 18px);
  letter-spacing: .5px;
  color: #ffffff;
  -webkit-text-stroke: 1px #2b3d63;
  text-stroke: 1px #2b3d63;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  transform: rotate(-2deg);
}
.cap__cat { font-size: clamp(30px, 9vw, 46px); line-height: 1; }

/* stylized Haaland face drawn in SVG (default art on the cap) */
.cap__face-svg {
  width: clamp(52px, 15vw, 72px);
  height: clamp(52px, 15vw, 72px);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
/* emoji is only a last-resort fallback; SVG is the default, so hide emoji */
.cap__cat { display: none; }

/* real image sits on the Haaland cap; hidden until it loads ok.
   the artwork already contains the "HAALAND" lettering, so it fills the cap. */
.cap__catimg {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
/* when a real image loads, JS adds .has-img so the image replaces the SVG
   AND our separate HAALAND text (the picture already has its own) */
.key--haaland.has-img .cap__face-svg { display: none; }
.key--haaland.has-img .cap__name--haaland { display: none; }
.key--haaland.has-img .cap__catimg { display: block; }

/* ---------- pressed state (real depress) ---------- */
.key.is-down .cap,
.key:active .cap {
  transform: translateY(9px);
  box-shadow:
    inset 0 3px 2px rgba(255,255,255,.6),
    inset 0 -3px 6px rgba(0,0,0,.32),
    0 1px 0 var(--cap-side),
    0 2px 0 color-mix(in srgb, var(--cap-side) 62%, #000),
    0 4px 10px rgba(0,0,0,.5);
}

.key:focus-visible { outline: none; }
.key:focus-visible .cap {
  box-shadow:
    inset 0 3px 2px rgba(255,255,255,.85),
    inset 0 -5px 9px rgba(0,0,0,.30),
    0 2px 0 var(--cap-side),
    0 4px 0 var(--cap-side),
    0 6px 0 var(--cap-side),
    0 8px 0 color-mix(in srgb, var(--cap-side) 78%, #000),
    0 10px 0 color-mix(in srgb, var(--cap-side) 62%, #000),
    0 16px 18px -6px rgba(0,0,0,.55),
    0 0 0 4px rgba(120,160,255,.75);
}

/* ---------- per-player looks ---------- */

/* MESSI — white with light-blue Argentina stripes */
.key--messi { --cap-bg: #ffffff; --cap-bg-2: #f0f1f3; --cap-side: #c7c9cc; }
.key--messi .cap__stripes {
  position: absolute;
  inset: 9px;
  border-radius: 11px;
  background: repeating-linear-gradient(
    90deg,
    #ffffff 0 12px,
    #86c5ec 12px 30px
  );
  opacity: .95;
}
.key--messi .cap__name,
.key--messi .cap__num { color: #1a2b52; text-shadow: 0 1px 0 rgba(255,255,255,.5); }

/* RONALDO — red with gold text */
.key--ronaldo { --cap-bg: #e2352b; --cap-bg-2: #b81f1a; --cap-side: #8a1512; }
.key--ronaldo .cap__name,
.key--ronaldo .cap__num {
  color: #ffd34d;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* HAALAND — light blue with the cat meme */
.key--haaland { --cap-bg: #a9c9ec; --cap-bg-2: #86b0e0; --cap-side: #5f89bb; }
.key--haaland .cap__name { color: #f4f8ff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* NEYMAR — yellow with black text */
.key--neymar { --cap-bg: #ffd21e; --cap-bg-2: #f2be00; --cap-side: #c79a00; }
.key--neymar .cap__name,
.key--neymar .cap__num { color: #14140f; }

/* ---------- hint ---------- */
.hint {
  font-size: 13px;
  color: #8ea0d0;
  letter-spacing: .5px;
}
.hint kbd {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 6px;
  background: #22305a;
  border: 1px solid #38487a;
  box-shadow: 0 2px 0 #38487a;
  font-family: inherit;
  font-size: 12px;
  color: #cdd8ff;
}

/* little celebratory pulse ring when a key fires */
.key.is-fired .cap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.7);
  animation: ring .5s ease-out forwards;
}
@keyframes ring {
  from { opacity: .9; transform: scale(1); }
  to   { opacity: 0;  transform: scale(1.25); }
}
