/* PlayOola — shared styles */
:root {
  --lilac: #F2EEFF;
  --lilac-2: #E6DFFF;
  --grape: #1E1446;
  --grape-soft: #4A3F78;
  --pink: #FF5FA2;
  --teal: #1FC8B0;
  --sun: #FFD23F;
  --tang: #FF7A1A;
  --white: #FFFFFF;
  --radius-tile: 20px;
  --radius-btn: 999px;
  --shadow-hard: 4px 4px 0 var(--grape);
  --shadow-hard-lg: 6px 6px 0 var(--grape);
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lilac);
  color: var(--grape);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tang); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex; align-items: center;
  font-weight: 800; font-size: 26px; letter-spacing: -0.03em;
  text-decoration: none; line-height: 1;
}
.logo .oo { display: inline-flex; gap: 0.06em; margin: 0 0.04em; }
.logo .oo i {
  display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%;
  background: var(--pink); border: 0.08em solid var(--grape);
  transform: translateY(0.06em);
}
.logo .oo i + i { background: var(--teal); }

/* ---------- Header ---------- */
.site-header { padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav { display: flex; gap: 20px; font-weight: 600; font-size: 16px; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-btn);
  background: var(--sun); color: var(--grape);
  border: 2.5px solid var(--grape); box-shadow: var(--shadow-hard);
  font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--grape); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--grape); }
.btn.pink { background: var(--pink); color: var(--white); }
.btn.teal { background: var(--teal); }
.btn.ghost { background: var(--white); }
.btn.small { padding: 8px 16px; font-size: 15px; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 36px; }
.hero h1 {
  margin: 0; font-weight: 800; letter-spacing: -0.045em; line-height: 0.92;
  font-size: clamp(64px, 13vw, 156px);
}
.hero h1 .oo { display: inline-flex; gap: 0.05em; margin: 0 0.03em; vertical-align: baseline; }
.hero h1 .oo i {
  display: inline-block; width: 0.66em; height: 0.66em; border-radius: 50%;
  background: var(--pink); border: 0.06em solid var(--grape);
  box-shadow: 0.04em 0.04em 0 var(--grape);
  animation: bounce 900ms cubic-bezier(.3,1.6,.5,1) both;
}
.hero h1 .oo i + i { background: var(--teal); animation-delay: 140ms; }
@keyframes bounce {
  0% { transform: translateY(-0.9em) scale(.9, 1.1); }
  55% { transform: translateY(0) scale(1.15, .85); }
  75% { transform: translateY(-0.12em) scale(.97, 1.03); }
  100% { transform: translateY(0) scale(1, 1); }
}
.hero p { font-size: clamp(19px, 2.4vw, 23px); max-width: 30ch; margin: 18px 0 24px; color: var(--grape-soft); font-weight: 500; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Toolbar: filters + search ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--lilac); padding: 12px 0;
  border-bottom: 2.5px solid transparent;
}
.toolbar.stuck { border-bottom-color: var(--grape); }
.toolbar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 16px; border-radius: var(--radius-btn);
  border: 2.5px solid var(--grape); background: var(--white);
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--grape); color: var(--white); }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 2.5px solid var(--grape); border-radius: var(--radius-btn);
  padding: 6px 14px; min-width: 220px; flex: 0 1 300px;
}
.search input { border: 0; outline: 0; font: inherit; font-size: 16px; width: 100%; background: transparent; color: var(--grape); }
.search:focus-within { box-shadow: var(--shadow-hard); }

/* ---------- Game grid ---------- */
.games { padding: 20px 0 64px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.tile {
  position: relative; display: flex; flex-direction: column;
  background: var(--white); border: 2.5px solid var(--grape); border-radius: var(--radius-tile);
  box-shadow: var(--shadow-hard); overflow: hidden; text-decoration: none;
  transition: transform .1s ease, box-shadow .1s ease;
}
.tile:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-lg); }
.tile:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--grape); }
.tile .art { aspect-ratio: 4 / 3; border-bottom: 2.5px solid var(--grape); }
.tile .art img { width: 100%; height: 100%; object-fit: cover; }
.tile .info { padding: 12px 16px 16px; }
.tile h3 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.tile p { margin: 4px 0 0; font-size: 15px; color: var(--grape-soft); }
.tile .cat {
  position: absolute; top: 12px; left: 12px;
  background: var(--white); border: 2px solid var(--grape); border-radius: var(--radius-btn);
  padding: 2px 10px; font-size: 13px; font-weight: 700;
}
@media (min-width: 760px) {
  .tile.featured { grid-column: span 2; flex-direction: row; }
  .tile.featured .art { flex: 1.4; aspect-ratio: auto; min-height: 260px; border-bottom: 0; border-right: 2.5px solid var(--grape); }
  .tile.featured .info { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
  .tile.featured h3 { font-size: 34px; }
  .tile.featured p { font-size: 17px; margin-top: 8px; }
}
.empty { padding: 40px 0; font-size: 19px; }
.empty button { background: none; border: 0; text-decoration: underline; cursor: pointer; font-weight: 700; padding: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 2.5px solid var(--grape); padding: 28px 0 40px; font-size: 15px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Game page ---------- */
.game-page main { padding: 4px 0 48px; }
.game-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.game-head h1 { margin: 0; font-size: clamp(34px, 6vw, 52px); font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.scores { display: flex; gap: 10px; }
.score-box {
  background: var(--white); border: 2.5px solid var(--grape); border-radius: 14px;
  padding: 4px 14px; text-align: center; min-width: 78px;
}
.score-box span { display: block; font-size: 13px; font-weight: 600; color: var(--grape-soft); }
.score-box strong { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stage {
  position: relative; margin: 0 auto;
  background: var(--grape); border: 2.5px solid var(--grape); border-radius: var(--radius-tile);
  box-shadow: var(--shadow-hard-lg); overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.stage canvas { display: block; width: 100%; height: auto; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
  background: rgba(30, 20, 70, 0.78); color: var(--white);
}
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0; font-size: clamp(30px, 6vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.overlay p { margin: 0; font-size: 17px; max-width: 28ch; opacity: .92; }
.how { max-width: 640px; margin: 24px auto 0; }
.how h2 { font-size: 22px; margin: 0 0 6px; font-weight: 800; }
.how p { margin: 0 0 8px; color: var(--grape-soft); }
.game-tools { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.more { margin-top: 48px; }
.more h2 { font-size: 26px; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.02em; }
.more .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }

/* d-pad for touch */
.dpad { display: none; margin: 18px auto 0; width: 180px; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); gap: 6px; justify-content: center; }
.dpad button {
  border: 2.5px solid var(--grape); border-radius: 14px; background: var(--white);
  box-shadow: 3px 3px 0 var(--grape); font-size: 22px; font-weight: 800; cursor: pointer;
  touch-action: manipulation;
}
.dpad button:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--grape); }
.dpad .up { grid-column: 2; grid-row: 1; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 3; }
@media (pointer: coarse) { .dpad { display: grid; } }

/* ---------- Text pages ---------- */
.prose { max-width: 68ch; padding: 12px 0 64px; }
.prose h1 { font-size: clamp(40px, 7vw, 64px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 12px 0 24px; }
.prose h2 { font-size: 24px; font-weight: 800; margin: 32px 0 8px; }
.prose p, .prose li { color: var(--grape-soft); }
.prose a { font-weight: 600; }

@media (max-width: 560px) {
  .nav { gap: 14px; font-size: 15px; }
  .search { flex: 1 1 100%; min-width: 0; }
  .grid { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
