/* ============ Puzlento design system ============
   White background, Poki-style tile mosaic.       */
:root {
  --bg: #eef1f5;
  --ink: #06315c;          /* deep navy text */
  --ink-soft: #35597e;
  --muted: #6f8aa5;
  --accent: #0aa1ff;
  --accent-dark: #0079d1;
  --line: #e3ecf4;
  --card: #ffffff;
  --wash: #f2f7fc;         /* light panel background */
  --r: 16px;
  --shadow-1: 0 2px 6px rgba(6, 49, 92, .08);
  --shadow-2: 0 10px 24px rgba(6, 49, 92, .16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1880px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-head { padding: 14px 0 10px; }
.site-head .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: -.5px; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo svg { display: block; }
.nav-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: #ffffff; color: var(--ink-soft);
  font-weight: 700; font-size: 14px; text-decoration: none;
  border: 1px solid var(--line); cursor: pointer; font-family: var(--font);
  transition: background .15s, color .15s, transform .15s;
  box-shadow: 0 1px 2px rgba(6, 49, 92, .05);
}
.chip:hover { background: #e6f4ff; color: var(--accent-dark); text-decoration: none; transform: translateY(-1px); }
.chip.on { background: var(--accent); color: #fff; }

/* ---------- Tile mosaic (Poki-style) ---------- */
.mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, 104px);
  grid-auto-rows: 104px;
  grid-auto-flow: dense;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 28px;
}

.tile {
  position: relative; display: block; border-radius: var(--r); overflow: hidden;
  background: var(--wash);
  box-shadow: var(--shadow-1);
  transform: translateZ(0);
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .tname {
  position: absolute; inset: auto 0 0 0; padding: 26px 10px 8px;
  font-weight: 800; font-size: 14px; color: #fff; text-align: center;
  background: linear-gradient(180deg, rgba(4,26,48,0) 0%, rgba(4,26,48,.78) 100%);
  opacity: 0; transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile:hover, .tile:focus-visible { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-2); z-index: 2; text-decoration: none; }
.tile:hover .tname, .tile:focus-visible .tname { opacity: 1; transform: translateY(0); }
.t2 { grid-column: span 2; grid-row: span 2; }
.t3 { grid-column: span 3; grid-row: span 3; }
.t2 .tname { font-size: 16px; }
.t3 .tname { font-size: 19px; }
@media (max-width: 430px) {
  .mosaic { grid-template-columns: repeat(auto-fill, 86px); grid-auto-rows: 86px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .tile .tname, .chip { transition: none; }
}

/* ---------- Section headings ---------- */
.h-row { display: flex; align-items: baseline; gap: 12px; margin: 18px 0 4px; }
.h-row h1, .h-row h2 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.h-row .sub { color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---------- Game page (razlozhi-style: game fills the first screen) ---------- */
.gp { padding-top: 2px; }

.stage-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-1); overflow: hidden;
}
.stage {
  position: relative; background: var(--wash);
  height: calc(100vh - 148px);
  height: calc(100dvh - 148px);
  min-height: 420px;
  display: flex; align-items: center; justify-content: center;
}
.stage:fullscreen { height: 100vh; background: var(--wash); }
#game { position: absolute; inset: 0; }

.gamebar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; }
.gamebar .gb-cover { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.gamebar h1 { font-size: 19px; margin: 0; line-height: 1.2; letter-spacing: -.2px; }
.gamebar .gb-by { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.gamebar .gb-actions { margin-left: auto; display: flex; gap: 8px; }
.gb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  font: 700 13.5px var(--font); border-radius: 999px; padding: 8px 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.gb-btn:hover { background: var(--wash); }
.gb-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.gb-btn svg { width: 16px; height: 16px; }

/* ---------- Article / SEO copy ---------- */
.article { max-width: 860px; margin: 6px 0 8px; }
.article h2 { font-size: 21px; margin: 26px 0 8px; letter-spacing: -.2px; }
.article h3 { font-size: 16.5px; margin: 18px 0 6px; }
.article p, .article li { color: #2c4d70; font-size: 15.5px; }
.article ul, .article ol { padding-left: 22px; }
.article .meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Static pages ---------- */
.prose { max-width: 760px; padding: 8px 0 40px; }
.prose h1 { font-size: 30px; letter-spacing: -.5px; }
.prose p, .prose li { color: #2c4d70; font-size: 16px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 28px; background: #ffffff; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; padding: 22px 16px 26px; }
.site-foot a { color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.site-foot .cright { color: var(--muted); font-size: 13.5px; margin-right: auto; }

/* ---------- Game UI shared bits (used by game scripts) ---------- */
.gt-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  pointer-events: none;
}
.gt-bar > * { pointer-events: auto; }
.gt-btn {
  border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer;
  background: #ffffffee; color: var(--ink-soft); font: 700 13px var(--font);
  box-shadow: 0 1px 4px rgba(6,49,92,.14);
}
.gt-btn:hover { background: #fff; color: var(--accent-dark); }
.gt-stat {
  margin-left: auto; display: flex; gap: 8px; align-items: center;
}
.gt-pill {
  background: #06315ccc; color: #fff; border-radius: 999px;
  font: 700 12.5px/1 var(--font); padding: 8px 12px; letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.gt-overlay {
  position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  background: rgba(8, 30, 55, .55); backdrop-filter: blur(3px); color: #fff; padding: 20px;
}
.gt-overlay .big { font-size: 44px; line-height: 1; }
.gt-overlay h2 { margin: 0; font-size: 30px; letter-spacing: -.4px; }
.gt-overlay p { margin: 0; font-size: 15.5px; opacity: .92; max-width: 420px; }
.gt-overlay .gt-cta {
  margin-top: 8px; border: 0; cursor: pointer; border-radius: 999px;
  background: var(--accent); color: #fff; font: 800 16px var(--font); padding: 13px 26px;
  box-shadow: 0 6px 18px rgba(10,161,255,.45);
}
.gt-overlay .gt-cta:hover { background: var(--accent-dark); }
.gt-overlay .gt-cta.alt { background: #ffffff22; box-shadow: none; font-weight: 700; font-size: 14px; padding: 10px 20px; }
.confetti-bit { position: absolute; width: 10px; height: 14px; top: -20px; z-index: 45; pointer-events: none; }
