:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #eef3fb;
  --line: #d7e0ee;
  --text: #1c2940;
  --muted: #66758c;
  --accent: #4f7dff;
  --accent-2: #22c3a6;
  --warm: #ff7a59;
  --shadow: 0 18px 50px rgba(80, 110, 160, 0.12);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Noto Sans SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(79, 125, 255, 0.22), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(34, 195, 166, 0.18), transparent 50%),
    linear-gradient(180deg, #f7fbff 0%, #eef3fa 55%, #f8f1ea 100%);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(215, 224, 238, 0.8);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: #5a3208;
  background: linear-gradient(135deg, #ffd56a, #f0a202 55%, #e07a2f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sound-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 1.25em;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #f6f8fc;
  color: #5b6b82;
  font: 700 11px/1.4 "Noto Sans SC", "Segoe UI", sans-serif;
  vertical-align: middle;
}

.btn kbd,
.sound-btn kbd,
.btn-back kbd {
  background: rgba(255, 255, 255, 0.7);
}

.pad-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.chip {
  border: 1px solid var(--line);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border-radius: 999px;
}

.chip.active,
.chip:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #4f7dff, #6ea0ff);
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.hero-lobby {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 20px;
  margin-bottom: 32px;
}

.hero-lobby .hero-copy {
  max-width: 52ch;
}

.hero-lobby .hero-copy p {
  margin: 0 auto;
}

.hero-lobby .hero-art {
  width: auto;
  max-width: min(640px, 100%);
  height: auto;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, #e8f3ff, #f4fbff);
}

.catalog-bar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.catalog-bar input[type="search"] {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}

.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}

.cat-tab.active {
  color: #5a3208;
  border-color: transparent;
  background: linear-gradient(135deg, #ffd56a, #f0a202);
  font-weight: 700;
}

.catalog-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.catalog-grid .card {
  min-height: 0;
}

.catalog-grid .thumb {
  height: 124px;
}

.card-meta {
  margin-bottom: 2px;
}

.tag {
  font-size: 11px;
  color: #b45309;
  background: #fff7ed;
  border-radius: 999px;
  padding: 2px 8px;
}

.empty-hint {
  grid-column: 1 / -1;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.btn-back:hover {
  border-color: #f0a202;
  color: #9a6700;
}

.game-title {
  font-size: 16px;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 36px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.25;
  margin: 0 0 14px;
  background: linear-gradient(120deg, #1c2940 20%, #4f7dff 70%, #22c3a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.85;
  max-width: 52ch;
}

.hero-art {
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
}

.hero-art img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 360px;
  display: block;
  object-fit: contain;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #4f7dff, #22c3a6);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(79, 125, 255, 0.25);
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 50px rgba(79, 125, 255, 0.16);
}

.thumb {
  height: 160px;
  position: relative;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card h2 {
  margin: 0;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  flex: 1;
}

.stats-panel {
  margin-top: 36px;
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}

.stats-panel h2 {
  font-size: 16px;
  margin: 0 0 16px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat {
  background: #fff;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
}

.stat .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 8px;
  color: #3b6dff;
}

.stat .value-compact {
  font-size: 16px;
  line-height: 1.45;
}

.game-shell {
  width: min(980px, calc(100% - 24px));
  margin: 24px auto 48px;
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 18px;
}

.game-stage {
  background: linear-gradient(180deg, #ffffff, #eef4fb);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 420px;
  box-shadow: var(--shadow);
}

.tetris-frame {
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, #93c5fd 0%, #c4b5fd 45%, #fda4af 100%);
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tetris-frame canvas {
  display: block;
  background: linear-gradient(180deg, #f8fbff, #eef2ff);
  border: 6px solid #ffffff;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px #c7d2fe;
}

.side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.side h2 {
  font-size: 14px;
  margin: 0 0 12px;
}

.side dl {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}

.side dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}

.help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pad {
  display: none;
  margin-top: 16px;
  gap: 8px;
  justify-content: center;
}

.pad button {
  width: 56px;
  height: 44px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.consent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 41, 64, 0.35);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.focus-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 41, 64, 0.45);
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 16px;
}

.focus-overlay[hidden] {
  display: none;
}

.focus-card,
.consent-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.focus-card h2,
.consent-card h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.focus-card p,
.consent-card p {
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 20px;
}

.consent-kicker {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.16em;
  margin: 0 0 8px;
}

.consent-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mines-wrap {
  display: inline-block;
}

.mines-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #4f7dff, #22c3a6);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px 12px 0 0;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
}

.mine-hud {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mine-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.cell .mine-icon {
  width: 16px;
  height: 16px;
}

.mines-grid {
  display: grid;
  gap: 3px;
  background: #dbe4f3;
  padding: 8px;
  border-radius: 0 0 12px 12px;
}

.cell {
  width: 24px;
  height: 24px;
  border: 0;
  background: linear-gradient(180deg, #6aa0ff, #3b6fe0);
  box-shadow: inset 0 1px 0 #c5dcff, inset 0 -2px 0 #2a54b8;
  color: #1c2940;
  font-weight: 800;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
}

.cell.open {
  background: #ece4d4;
  box-shadow: inset 0 0 0 1px #d2c6b0;
}

.cell.flag {
  background: #ffe8cc;
}

.cell.mine {
  background: #ffd4d4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cell.n1 { color: #2563eb; }
.cell.n2 { color: #16a34a; }
.cell.n3 { color: #dc2626; }
.cell.n4 { color: #7c3aed; }
.cell.n5 { color: #d97706; }
.cell.n6 { color: #0d9488; }
.cell.n7 { color: #334155; }
.cell.n8 { color: #64748b; }

.buffs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.buff {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #3b6dff;
}

#btn-sprint.is-on {
  background: linear-gradient(135deg, #ff7a59, #f0a202);
  color: #fff;
  border-color: transparent;
}

.snake-frame {
  padding: 14px;
  border-radius: 28px;
  background: linear-gradient(135deg, #e8c547, #c4a35a 40%, #8a6a32);
  box-shadow: 0 16px 40px rgba(122, 90, 40, 0.22), inset 0 1px 0 rgba(255,255,255,0.45);
}
.snake-frame canvas {
  display: block;
  border-radius: 16px;
  background: #cfe6c8;
}

.mole-stage {
  padding: 0;
  overflow: hidden;
}
.mole-world {
  width: min(520px, 100%);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mole-sky {
  height: 72px;
  background: linear-gradient(180deg, #8ec9ff, #c8e8ff);
  position: relative;
}
.mole-sky::after {
  content: "";
  position: absolute;
  right: 28px;
  top: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffe08a;
  box-shadow: 0 0 24px #ffd56a;
}
.mole-lawn {
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15), transparent 40%),
    linear-gradient(180deg, #7bc35a, #4d9a3a 55%, #3d7e2e);
  padding: 22px 18px 28px;
}
.mole-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.hole {
  height: 128px;
  border-radius: 50% 50% 40% 40%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.hole-dirt {
  position: absolute;
  inset: 38% 6% 4%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #6b4128, #2a160c);
  box-shadow: inset 0 10px 14px rgba(0,0,0,0.35);
}
.mole {
  position: absolute;
  left: 50%;
  bottom: -100px;
  width: 78px;
  margin-left: -39px;
  transition: bottom 0.18s cubic-bezier(.2,1.4,.4,1);
  z-index: 2;
}
.mole.up { bottom: 18px; }
.mole-ear {
  position: absolute;
  top: 6px;
  width: 16px;
  height: 22px;
  background: #c47a4a;
  border-radius: 10px;
}
.mole-ear.l { left: 10px; transform: rotate(-18deg); }
.mole-ear.r { right: 10px; transform: rotate(18deg); }
.mole-body {
  height: 78px;
  border-radius: 38px 38px 20px 20px;
  background: linear-gradient(180deg, #e0a070, #a05a32);
  box-shadow: 0 8px 16px rgba(0,0,0,0.22);
  position: relative;
}
.mole-eye {
  position: absolute;
  top: 26px;
  width: 12px;
  height: 12px;
  background: #1c2433;
  border-radius: 50%;
  box-shadow: inset 2px -2px 0 #fff;
}
.mole-eye.l { left: 18px; }
.mole-eye.r { right: 18px; }
.mole-nose {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 14px;
  height: 10px;
  margin-left: -7px;
  background: #f0a0b0;
  border-radius: 50%;
}
.mole.hit .mole-body { background: linear-gradient(180deg, #ffb020, #d97820); }
.mole.dizzy .mole-eye { height: 3px; top: 30px; border-radius: 2px; box-shadow: none; }
.hammer {
  position: absolute;
  right: 8px;
  top: -40px;
  width: 18px;
  height: 46px;
  background: #8a5a28;
  border-radius: 4px;
  opacity: 0;
  transform: rotate(-40deg);
  z-index: 3;
}
.hammer::after {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  width: 38px;
  height: 18px;
  background: #c0c8d4;
  border-radius: 4px;
}
.hole.smash .hammer {
  animation: smash 0.28s ease;
}
@keyframes smash {
  0% { opacity: 1; transform: rotate(-50deg) translateY(-20px); }
  60% { opacity: 1; transform: rotate(12deg) translateY(28px); }
  100% { opacity: 0; transform: rotate(18deg) translateY(10px); }
}
.pop {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  color: #fff7cc;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 0 #7a4a10;
}
.pop.show { animation: popup 0.6s ease; }
@keyframes popup {
  0% { opacity: 1; transform: translate(-50%, 10px); }
  100% { opacity: 0; transform: translate(-50%, -18px); }
}

.soko-board {
  display: grid;
  gap: 4px;
  background: linear-gradient(180deg, #d7eccf, #b7d6a8);
  padding: 12px;
  border-radius: 18px;
  border: 6px solid #8a6a32;
}
.soko-cell {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.spr { position: absolute; inset: 0; }
.spr-floor {
  background:
    repeating-linear-gradient(90deg, rgba(80,140,50,0.15) 0 4px, transparent 4px 8px),
    #8fce6a;
}
.spr-rock {
  background: linear-gradient(145deg, #9aa6b8, #5d6778);
  border-radius: 10px;
  box-shadow: inset 4px 4px 0 rgba(255,255,255,0.25), inset -4px -4px 0 rgba(0,0,0,0.18);
}
.spr-rock span {
  position: absolute;
  background: #4a5360;
  border-radius: 2px;
}
.spr-rock span:first-child { width: 16px; height: 3px; left: 8px; top: 16px; }
.spr-rock span:last-child { width: 10px; height: 3px; right: 10px; bottom: 14px; }
.spr-goal {
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #ffe08a, #f0b429);
  box-shadow: 0 0 0 3px rgba(240,180,41,0.35);
}
.spr-crate {
  inset: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #e0a070, #b56a3a);
  box-shadow: inset 0 0 0 2px #8a4a22;
}
.spr-crate i {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  background: #8a4a22;
  top: 10px;
}
.spr-crate i:last-child { top: auto; bottom: 10px; }
.spr-hero {
  inset: 8px 10px 4px;
  border-radius: 16px 16px 8px 8px;
  background: linear-gradient(180deg, #6aa0ff, #3b6fe0);
  box-shadow: 0 4px 0 #2a54b8;
}
.spr-hero b {
  position: absolute;
  top: 10px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 2px 0 0 #1c2433;
}
.spr-hero b:first-child { left: 6px; }
.spr-hero b:last-child { right: 6px; }
.spr-hero.face-left { transform: scaleX(-1); }

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, 78px);
  gap: 10px;
  background: #cfd8e8;
  padding: 12px;
  border-radius: 20px;
}
.g2048-tile {
  height: 78px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 26px;
  background: #e8edf6;
  color: #1c2940;
}
.g2048-tile.n2 { background: #eee4da; }
.g2048-tile.n4 { background: #ede0c8; }
.g2048-tile.n8 { background: #f2b179; color: #fff; }
.g2048-tile.n16 { background: #f59563; color: #fff; }
.g2048-tile.n32 { background: #f67c5f; color: #fff; }
.g2048-tile.n64 { background: #f65e3b; color: #fff; }
.g2048-tile.n128 { background: #edcf72; color: #fff; font-size: 22px; }
.g2048-tile.n256 { background: #edcc61; color: #fff; font-size: 22px; }
.g2048-tile.n512 { background: #edc850; color: #fff; font-size: 22px; }
.g2048-tile.n1024 { background: #edc53f; color: #fff; font-size: 18px; }
.g2048-tile.n2048 { background: #edc22e; color: #fff; font-size: 18px; }
.g2048-tile.n4096 { background: #3c3a32; color: #fff; font-size: 18px; }

.llk-wrap {
  position: relative;
  display: inline-block;
}
.llk-path {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.llk-board {
  display: grid;
  gap: 6px;
  background: linear-gradient(180deg, #f7fbff, #e8eefc);
  padding: 12px;
  border-radius: 20px;
}
.llk-tile {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(80, 110, 160, 0.12);
  font-size: 24px;
  cursor: pointer;
}
.llk-tile.empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
}
.llk-tile.sel {
  outline: 3px solid #f0a202;
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .hero,
  .hero-lobby,
  .grid,
  .stats-row,
  .game-shell {
    grid-template-columns: 1fr;
  }
  .pad {
    display: flex;
  }
}
