:root {
  color-scheme: light;
  --bg: #f5fafc;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-2: #ffffff;
  --line: rgba(34, 84, 105, 0.16);
  --text: #102733;
  --muted: #5f7682;
  --mint: #16c6a1;
  --coral: #f47c67;
  --gold: #f5c84c;
  --blue: #2389e8;
  --violet: #8b6de8;
  --shadow: 0 22px 54px rgba(37, 78, 96, 0.14);
  --soft-shadow: 0 14px 32px rgba(37, 78, 96, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(22, 198, 161, 0.18), transparent 24rem),
    radial-gradient(circle at 86% 12%, rgba(35, 137, 232, 0.18), transparent 28rem),
    linear-gradient(180deg, #f9fdff 0%, #eef8fb 52%, #f7fbf7 100%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(35, 137, 232, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 137, 232, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 74%);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button:hover {
  border-color: var(--mint);
  background: #f5fffc;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 0 24px;
  position: relative;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1fr);
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 250, 253, 0.9));
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: grid;
  gap: 10px;
  width: min(100%, 760px);
}

.eyebrow {
  margin: 0 0 4px;
  color: #0a8d72;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
}

h1 {
  max-width: 10ch;
  font-size: clamp(2.15rem, 4.6vw, 4.35rem);
  text-shadow: none;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 3.8rem);
}

.tagline {
  max-width: 470px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.trust-badges span {
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(22, 198, 161, 0.2);
  border-radius: 999px;
  background: rgba(22, 198, 161, 0.08);
  color: #0e725e;
  font-size: 0.84rem;
  font-weight: 900;
}

.game-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(234, 246, 250, 0.82);
}

.game-tabs button {
  min-height: 44px;
  white-space: nowrap;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.game-tabs button.active {
  background: linear-gradient(135deg, var(--mint), #6df5ff);
  border-color: transparent;
  color: #071512;
  box-shadow: 0 8px 20px rgba(53, 232, 179, 0.25);
}

.register-button {
  min-height: 44px;
  background: linear-gradient(135deg, #ffffff, #eefbf8);
  border-color: transparent;
  color: #0b6e5b;
  box-shadow: inset 0 0 0 1px rgba(22, 198, 161, 0.2);
}

.game-view {
  display: none;
  grid-template-columns: minmax(300px, 620px) minmax(280px, 360px);
  gap: 22px;
  align-items: stretch;
}

.game-view.active {
  display: grid;
}

.home-view.game-view {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.policy-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(22, 198, 161, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  box-shadow: var(--soft-shadow);
}

.policy-note strong {
  color: var(--text);
  white-space: nowrap;
}

.policy-note span {
  font-weight: 750;
  line-height: 1.35;
}

.game-card {
  position: relative;
  min-height: 0;
  aspect-ratio: auto;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  align-content: start;
  justify-items: start;
  gap: 9px;
  padding: 12px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  isolation: isolate;
}

.game-card::before {
  content: none;
}

.game-card img {
  position: relative;
  width: 100%;
  height: clamp(150px, 14vw, 190px);
  object-fit: cover;
  border-radius: 8px;
  z-index: auto;
  filter: saturate(0.94) contrast(0.98);
  transition: transform 220ms ease;
}

.game-card:hover img {
  transform: scale(1.05);
}

.game-card .game-number,
.game-card small {
  color: var(--muted);
  font-weight: 800;
}

.game-card strong {
  color: var(--text);
  font-size: clamp(1.22rem, 2vw, 1.65rem);
  line-height: 1.05;
  max-width: 13ch;
  text-shadow: none;
}

.game-card em {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  border-radius: 8px;
  background: rgba(35, 137, 232, 0.1);
  color: #1166ad;
  font-style: normal;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.game-area,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.game-area {
  min-width: 0;
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.back-button {
  min-height: 42px;
  padding: 0 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.08);
}

.board-wrap {
  position: relative;
  width: min(100%, 440px);
  margin: 0 auto;
  aspect-ratio: 1 / 2;
}

canvas {
  display: block;
}

#board {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #0b1014;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 18px 42px rgba(0, 0, 0, 0.28);
}

.shooter-wrap {
  position: relative;
  width: min(100%, 430px);
  margin: 0 auto;
  aspect-ratio: 2 / 3;
}

.bubble-wrap {
  position: relative;
  width: min(100%, 430px);
  margin: 0 auto;
  aspect-ratio: 2 / 3;
}

#shooterCanvas,
#bubbleCanvas {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #081119;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 18px 42px rgba(0, 0, 0, 0.28);
}

.block-puzzle-shell {
  width: min(100%, 470px);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.block-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 0%, rgba(75, 163, 255, 0.15), transparent 35%), #10171b;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.puzzle-cell {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.055);
}

.puzzle-cell.filled {
  background: linear-gradient(180deg, var(--blue), #1b62de);
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.24);
}

.piece-tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.piece-card {
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.piece-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 216, 77, 0.22);
}

.piece-mini {
  display: grid;
  grid-template-columns: repeat(4, 18px);
  grid-template-rows: repeat(4, 18px);
  gap: 3px;
}

.piece-dot {
  border-radius: 4px;
}

.piece-dot.on {
  background: linear-gradient(180deg, var(--gold), #f59e0b);
}

.spot-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.spot-scene {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(#67c9ff 0 46%, #16b8dc 47% 55%, #f6d68c 56% 100%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.spot-scene::before {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -16%;
  height: 42%;
  border-radius: 50% 50% 0 0;
  background: #f5c978;
}

.spot-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 42%;
  height: 10%;
  background: rgba(255, 255, 255, 0.2);
}

.scene-item {
  position: absolute;
  z-index: 1;
}

.scene-sun {
  left: 67%;
  top: 13%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffd84d;
  box-shadow: 0 0 0 10px rgba(255, 216, 77, 0.25), 0 0 28px rgba(255, 216, 77, 0.8);
}

.scene-cloud {
  left: 66%;
  top: 14%;
  width: 76px;
  height: 34px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 20px -8px 0 2px #ffffff, 38px 2px 0 -2px #ffffff;
}

.scene-hut {
  left: 8%;
  top: 23%;
  width: 88px;
  height: 82px;
  background: #8f5634;
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.scene-hut::before {
  content: "";
  position: absolute;
  left: -12px;
  top: -28px;
  border-left: 56px solid transparent;
  border-right: 56px solid transparent;
  border-bottom: 34px solid #d49b4b;
}

.scene-lantern {
  left: 22%;
  top: 35%;
  width: 34px;
  height: 42px;
  border-radius: 50%;
  background: #ffd84d;
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.18), 0 0 18px rgba(255, 216, 77, 0.6);
}

.altered .scene-lantern {
  background: #ff6b5a;
}

.scene-boat {
  left: 38%;
  top: 51%;
  width: 118px;
  height: 42px;
  border-radius: 0 0 52px 52px;
  background: #f7faf9;
  border-bottom: 10px solid #4ba3ff;
  transform: rotate(-2deg);
}

.altered .scene-boat {
  border-bottom-color: #ffd84d;
}

.scene-umbrella {
  right: 7%;
  bottom: 24%;
  width: 86px;
  height: 44px;
  border-radius: 86px 86px 0 0;
  background: linear-gradient(90deg, #ffd84d 0 50%, #ffffff 50%);
}

.altered .scene-umbrella {
  background: linear-gradient(90deg, #ff6b5a 0 50%, #ffffff 50%);
}

.scene-flower {
  left: 18%;
  bottom: 10%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ff6b5a;
  box-shadow:
    24px 0 #ff6b5a,
    12px 20px #ff6b5a,
    12px -20px #ff6b5a,
    12px 0 0 9px #ffd84d;
}

.altered .scene-flower {
  background: #ffd84d;
  box-shadow:
    24px 0 #ffd84d,
    12px 20px #ffd84d,
    12px -20px #ffd84d,
    12px 0 0 9px #ff6b5a;
}

.scene-chair {
  right: 22%;
  bottom: 7%;
  width: 58px;
  height: 44px;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, #4ba3ff 0 10px, #ffffff 10px 20px);
}

.diff-marker {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  transform: translate(-50%, -50%);
  background: transparent;
  z-index: 3;
  cursor: pointer;
}

.diff-marker.found {
  border-color: var(--gold);
  background: rgba(255, 216, 77, 0.18);
  box-shadow: 0 0 22px rgba(255, 216, 77, 0.35);
}

.diff-marker.hint {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.5);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(9, 17, 24, 0.68), rgba(9, 17, 24, 0.86)),
    rgba(11, 16, 20, 0.72);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.overlay p,
.overlay span {
  margin: 0;
  color: var(--muted);
}

.overlay strong {
  font-size: clamp(1.7rem, 5vw, 3.4rem);
  line-height: 1;
}

.overlay button {
  min-width: 132px;
  min-height: 46px;
  margin-top: 8px;
  color: #071512;
  background: linear-gradient(135deg, var(--mint), #6df5ff);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(53, 232, 179, 0.24);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 10, 14, 0.72);
  backdrop-filter: blur(10px);
}

.modal-backdrop.hidden {
  display: none;
}

.register-modal {
  position: relative;
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 250, 253, 0.98));
  box-shadow: var(--shadow);
}

.register-modal h2 {
  font-size: clamp(2rem, 8vw, 3.2rem);
}

.register-copy,
.register-message {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.register-modal label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.register-modal input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.register-modal input:focus {
  outline: 2px solid rgba(53, 232, 179, 0.36);
  border-color: var(--mint);
}

.hidden-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: rgba(17, 39, 51, 0.06);
  font-size: 1.4rem;
}

.register-submit {
  min-height: 50px;
  background: linear-gradient(135deg, var(--mint), #6df5ff);
  border-color: transparent;
  color: #071512;
}

.site-footer {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto 24px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  color: var(--muted);
}

.site-footer div {
  display: grid;
  gap: 4px;
}

.site-footer strong {
  color: var(--text);
}

.site-footer span {
  max-width: 720px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.site-footer a {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(34, 84, 105, 0.14);
  border-radius: 999px;
  background: #ffffff;
  color: #0b6e5b;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.legal-shell {
  width: min(920px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 24px;
}

.legal-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.legal-card h1 {
  max-width: none;
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.legal-card h2 {
  margin-top: 24px;
  font-size: 1.2rem;
  line-height: 1.2;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.65;
}

.legal-card ul {
  padding-left: 1.2rem;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.legal-actions a {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.contact-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 900;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.contact-form input {
  min-height: 44px;
  padding: 0 12px;
}

.contact-form textarea {
  resize: vertical;
  min-height: 140px;
  padding: 12px;
}

.form-success,
.form-error {
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 850;
}

.form-success {
  border: 1px solid rgba(22, 198, 161, 0.24);
  background: rgba(22, 198, 161, 0.1);
  color: #0b6e5b;
}

.form-error {
  border: 1px solid rgba(244, 124, 103, 0.24);
  background: rgba(244, 124, 103, 0.1);
  color: #9a382b;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat,
.next-box,
.how-to {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.stat {
  min-height: 86px;
  padding: 12px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.8);
}

.stat span,
.panel-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.45rem, 3.8vw, 2.15rem);
  line-height: 1;
  color: var(--text);
}

.next-box {
  padding: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#next {
  width: 128px;
  height: 128px;
  margin: 0 auto;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 20%, rgba(85, 214, 167, 0.14), transparent 40%), #eef8fb;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.controls-row button {
  min-height: 48px;
  background: rgba(255, 255, 255, 0.78);
}

.how-to {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.how-to div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

kbd {
  min-width: 30px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f8fa;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
}

.touch-pad {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.touch-pad button,
.shooter-pad button {
  min-height: 54px;
  font-size: 1.05rem;
  touch-action: manipulation;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
}

.touch-pad button[data-action="drop"] {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--coral), #ffb35a);
  color: #180d0b;
  border-color: transparent;
}

.link-board-shell {
  position: relative;
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 216, 77, 0.12), transparent 34%),
    #10171b;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.link-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 1fr));
  gap: 7px;
  aspect-ratio: 9 / 8;
}

.tile {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, #f8e9c9, #d9bc88);
  color: #172027;
  font-size: clamp(1.15rem, 3.4vw, 2rem);
  line-height: 1;
  user-select: none;
  box-shadow:
    inset 0 5px rgba(255, 255, 255, 0.3),
    0 8px 16px rgba(0, 0, 0, 0.16);
}

.tile.empty {
  pointer-events: none;
  opacity: 0;
}

.tile.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, #ffeaa5, #e7b94d);
}

.tile.hint {
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(85, 214, 167, 0.24);
}

.link-line {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  pointer-events: none;
  overflow: visible;
}

.link-line polyline {
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.link-message {
  min-height: 28px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.shooter-pad {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.move-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(48px, 1fr));
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 8px;
}

.move-pad [data-shooter-control="up"] {
  grid-area: up;
}

.move-pad [data-shooter-control="left"] {
  grid-area: left;
}

.move-pad [data-shooter-control="down"] {
  grid-area: down;
}

.move-pad [data-shooter-control="right"] {
  grid-area: right;
}

.fire-button {
  min-height: 118px;
  background: linear-gradient(135deg, var(--blue), #6df5ff);
  border-color: transparent;
  color: #061923;
  font-size: 1.1rem;
  box-shadow: 0 14px 26px rgba(35, 137, 232, 0.18);
}

@media (max-width: 860px) {
  .app-shell {
    width: 100%;
    padding: 10px;
  }

  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    padding: 14px;
    margin-bottom: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .game-tabs {
    width: 100%;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 5px;
  }

  .game-tabs button {
    min-width: 128px;
    font-size: 0.88rem;
    min-height: 42px;
  }

  .game-view.active {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-view.game-view.active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .policy-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-area,
  .panel {
    padding: 10px;
  }

  .section-title {
    margin-bottom: 10px;
  }

  .title-actions {
    align-items: center;
    flex-direction: row;
  }

  .board-wrap {
    width: min(100%, 310px);
  }

  .shooter-wrap {
    width: min(100%, 330px);
  }

  .bubble-wrap {
    width: min(100%, 330px);
  }

  .block-puzzle-shell {
    width: min(100%, 360px);
  }

  .spot-shell {
    grid-template-columns: 1fr;
  }

  .spot-scene {
    min-height: 250px;
  }

  .panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat {
    min-height: 64px;
    padding: 8px;
  }

  .stat strong {
    font-size: 1.24rem;
  }

  .how-to {
    display: none;
  }

  .touch-pad {
    display: grid;
    gap: 8px;
  }

  .shooter-pad {
    display: grid;
  }
}

@media (max-width: 520px) {
  .topbar h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.92rem;
  }

  .game-tabs {
    margin-inline: -2px;
  }

  .home-view.game-view.active {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 0;
    padding: 16px;
  }

  .game-card strong {
    font-size: 1.7rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .next-box {
    display: none;
  }

  .link-board {
    gap: 5px;
    grid-template-columns: repeat(9, minmax(26px, 1fr));
  }

  .block-grid {
    gap: 4px;
    padding: 8px;
  }

  .piece-tray {
    gap: 8px;
  }

  .piece-card {
    min-height: 78px;
  }

  .piece-mini {
    grid-template-columns: repeat(4, 14px);
    grid-template-rows: repeat(4, 14px);
  }

  .tile {
    border-radius: 7px;
    font-size: clamp(1rem, 7vw, 1.45rem);
  }

  .touch-pad {
    grid-template-columns: repeat(2, 1fr);
  }

  .touch-pad button,
  .shooter-pad button {
    min-height: 58px;
  }

  .touch-pad button[data-action="drop"] {
    grid-column: span 1;
  }

  .shooter-pad {
    grid-template-columns: 1.2fr 0.8fr;
    gap: 8px;
  }

  .move-pad {
    grid-template-columns: repeat(3, minmax(42px, 1fr));
    gap: 7px;
  }

  .fire-button {
    min-height: 124px;
  }
}
