/* ohbabyblocks.com: the game's look (dark yarn-purple, knit frames, Bungee / Rubik Bubbles / Montserrat Alternates). */

@font-face { font-family: "Bungee"; src: url("/fonts/Bungee-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Rubik Bubbles"; src: url("/fonts/RubikBubbles-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat Alternates"; src: url("/fonts/MontserratAlternates-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #1d1430;
  --bg-2: #2a1d46;
  --plate: rgba(22, 13, 38, 0.94);
  --plate-row: rgba(255, 255, 255, 0.045);
  --text: #f4efff;
  --hint: #d9ccff;        /* UiSkin.HintColor */
  --muted: #a99cc9;
  --header: #ffe680;      /* UiSkin.HeaderColor */
  --title: #ffdb59;       /* main menu BLOCKS subtitle */
  --outline: #28143c;
  --gold: #ffe347;
  --teal: #5fd3c8;
  --violet: #b98af0;
  --gutter: 16px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #4a2f7a 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 40%, rgba(54, 140, 150, 0.18) 0%, transparent 60%),
    radial-gradient(800px 500px at 0% 80%, rgba(150, 70, 190, 0.18) 0%, transparent 60%),
    var(--bg);
  font-family: "Montserrat Alternates", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding: 0 max(var(--gutter), env(safe-area-inset-left)) env(safe-area-inset-bottom);
}

h1, h2, h3 { font-family: "Bungee", Impact, sans-serif; font-weight: 400; margin: 0; letter-spacing: 0.02em; }

.muted { color: var(--muted); }

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

.hero { text-align: center; padding: 28px 0 8px; }

.logo { width: min(360px, 72%); height: auto; display: block; margin: 0 auto 4px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); }

.title {
  font-family: "Rubik Bubbles", "Bungee", sans-serif;
  font-size: clamp(48px, 11vw, 92px);
  line-height: 1;
  margin-top: -6px;
  color: var(--title);
  -webkit-text-stroke: 10px var(--outline);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--outline), 0 10px 22px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.04em;
}

.strip { display: flex; justify-content: center; gap: 6px; margin: 18px 0 10px; }
.strip img { width: clamp(34px, 9vw, 52px); height: auto; animation: bob 2.4s ease-in-out infinite; }
.strip img:nth-child(2) { animation-delay: -0.4s; }
.strip img:nth-child(3) { animation-delay: -0.8s; }
.strip img:nth-child(4) { animation-delay: -1.2s; }
.strip img:nth-child(5) { animation-delay: -1.6s; }
.strip img:nth-child(6) { animation-delay: -2s; filter: brightness(0.55) saturate(0.6); } /* the 6th, grey-blue colour */

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .strip img { animation: none; } }

.hero h1 { font-size: clamp(22px, 5vw, 32px); color: var(--hint); margin-top: 6px; }

/* ---- boards ------------------------------------------------------------------------------------------------ */

main { max-width: 1080px; margin: 0 auto; }

.group { margin-top: 34px; }

.group-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 0 6px 12px; }
.group-head h2 { font-size: clamp(24px, 5vw, 34px); color: var(--header); text-shadow: 0 3px 0 var(--outline); }
.reset { margin: 0; color: var(--hint); }
#countdown { font-family: "Bungee", sans-serif; font-weight: 400; color: var(--gold); }

.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 22px; }

/* the knit frame: the braided knit square (Case_background_texture, recoloured) as a 9-slice */
.board {
  position: relative;
  border: 30px solid transparent;
  border-image: url("/img/frame_teal.webp") 42 fill / 30px / 0 round;
  min-width: 0;
}
.board.purple { border-image-source: url("/img/frame_purple.webp"); }

/* the dark plate inside the knit, so names stay readable */
.board::before {
  content: "";
  position: absolute;
  inset: -6px;
  background: var(--plate);
  border-radius: 14px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  z-index: 0;
}
.board > * { position: relative; z-index: 1; }

.board h3 { font-size: 24px; color: var(--header); padding: 6px 10px 0; }
.board .sub { margin: 2px 10px 12px; font-size: 14px; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0 0 4px; }

.row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 4px 10px;
  border-radius: 10px;
}
.row:nth-child(odd) { background: var(--plate-row); }

.rank {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-family: "Bungee", sans-serif;
  font-size: 16px;
  color: var(--muted);
}
.rank.medal { background: center / contain no-repeat; color: #fff; text-shadow: 0 2px 0 var(--outline), 0 0 6px var(--outline); font-size: 18px; }
.rank.r1 { background-image: url("/img/block_yellow.webp"); }
.rank.r2 { background-image: url("/img/block_blue.webp"); }
.rank.r3 { background-image: url("/img/block_orange.webp"); }

.name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.top .name { color: #fff; }

.score { font-family: "Bungee", sans-serif; font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.score small { font-family: "Montserrat Alternates", sans-serif; font-weight: 700; font-size: 13px; color: var(--hint); margin-left: 6px; }

.empty { padding: 22px 12px 26px; text-align: center; color: var(--hint); }
.empty img { width: 44px; display: block; margin: 0 auto 8px; opacity: 0.9; }

.more {
  display: block;
  margin: 10px auto 2px;
  padding: 8px 18px;
  font: 400 14px "Bungee", sans-serif;
  color: var(--outline);
  background: var(--gold);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 3px 0 #b88a1a;
  cursor: pointer;
}
.more:hover { filter: brightness(1.06); }
.more:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---- footer ------------------------------------------------------------------------------------------------ */

footer { max-width: 1080px; margin: 40px auto 0; padding: 18px 6px 34px; text-align: center; font-size: 14px; }
footer p { margin: 4px 0; }
.demo-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #ff9a3c; color: var(--outline); font-family: "Bungee", sans-serif; font-weight: 400; }

@media (max-width: 520px) {
  .board { border-width: 22px; border-image-width: 22px; }
  .board h3 { font-size: 20px; }
  .row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; padding: 4px 6px; }
  .rank { width: 34px; height: 34px; font-size: 14px; }
  .name { font-size: 15px; }
  .score { font-size: 15px; }
}
