:root {
  color-scheme: dark;
  --bg: #17141f;
  --panel: #251e33;
  --panel-2: #30263d;
  --ink: #fff8eb;
  --muted: #cfc2dd;
  --line: rgba(255, 255, 255, 0.14);
  --purple: #8d55ff;
  --green: #6ee7a8;
  --yellow: #ffd166;
  --red: #ff6b6b;
  --blue: #74c0fc;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(141, 85, 255, 0.18), transparent 28rem),
    linear-gradient(135deg, #17141f 0%, #231b2d 44%, #1d2730 100%);
  color: var(--ink);
  overflow-x: hidden;
}

.site-nav,
.site-footer {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-nav {
  position: relative;
  z-index: 2;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-link img {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-nav nav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-nav a,
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-footer a:hover {
  color: var(--ink);
}

button,
a {
  font: inherit;
}

.shell {
  width: min(1480px, 100%);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.seo-content,
.page-content {
  width: min(980px, calc(100% - 40px));
  margin: 18px auto 34px;
  padding: 24px;
  border: 1px solid var(--line);
  background: rgba(37, 30, 51, 0.82);
  line-height: 1.7;
}

.seo-content h2,
.page-content h1,
.page-content h2 {
  margin-bottom: 10px;
  letter-spacing: 0;
}

.seo-content p,
.page-content p,
.page-content li {
  color: var(--muted);
}

.page-content ul {
  padding-left: 20px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

.game-frame,
.side-panel {
  border: 1px solid var(--line);
  background: rgba(37, 30, 51, 0.88);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.game-frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.4vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 8px;
  min-width: 360px;
}

.scoreboard span {
  min-height: 58px;
  padding: 9px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
}

.scoreboard b {
  display: block;
  color: var(--ink);
  font-size: 1.28rem;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  background: #8bd1ff;
  overflow: hidden;
  border-block: 1px solid var(--line);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(rgba(23, 20, 31, 0.18), rgba(23, 20, 31, 0.72)),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 18rem);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.overlay p {
  max-width: 620px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(0.98rem, 1.5vw, 1.15rem);
}

.poster-dog {
  position: relative;
  width: 128px;
  height: 96px;
}

.poster-dog .face {
  position: absolute;
  inset: 16px 12px 0;
  border-radius: 44% 44% 36% 36%;
  background: linear-gradient(145deg, #a06cff, #6c35d8);
  box-shadow: inset -16px -10px 0 rgba(55, 27, 120, 0.28);
}

.poster-dog .face::before,
.poster-dog .face::after {
  content: "";
  position: absolute;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1b1029;
}

.poster-dog .face::before {
  left: 28px;
}

.poster-dog .face::after {
  right: 28px;
}

.poster-dog .ear {
  position: absolute;
  top: 0;
  width: 44px;
  height: 60px;
  border-radius: 50% 50% 28% 28%;
  background: #5d2dc2;
}

.poster-dog .ear.left {
  left: 0;
  transform: rotate(-24deg);
}

.poster-dog .ear.right {
  right: 0;
  transform: rotate(24deg);
}

.primary-btn,
.controls button,
.share-links a {
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-2);
  text-decoration: none;
}

.primary-btn {
  min-width: 150px;
  padding: 0 18px;
  border-color: rgba(255, 209, 102, 0.7);
  background: var(--yellow);
  color: #211406;
  font-weight: 900;
  cursor: pointer;
}

.controls {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  cursor: pointer;
}

.controls .icon-button {
  aspect-ratio: 1 / 1;
  justify-self: center;
  width: 48px;
  padding: 0;
  border-color: rgba(255, 209, 102, 0.55);
}

.share-icon {
  position: relative;
  width: 22px;
  height: 22px;
}

.share-icon::before,
.share-icon::after {
  content: "";
  position: absolute;
  background: var(--yellow);
}

.share-icon::before {
  left: 5px;
  top: 10px;
  width: 14px;
  height: 3px;
  transform: rotate(-28deg);
  box-shadow: 1px 8px 0 var(--yellow);
}

.share-icon::after {
  left: 1px;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow:
    13px 8px 0 var(--yellow),
    1px 16px 0 var(--yellow);
}

.controls button:active,
.primary-btn:active {
  transform: translateY(1px);
}

kbd {
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-size: 0.76rem;
}

.side-panel {
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto minmax(120px, 1fr) auto auto;
  gap: 14px;
  min-height: 0;
}

.how-to,
.mission {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.how-to p:last-child,
.mission p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.mission h2 {
  margin-bottom: 8px;
  font-size: 1.32rem;
}

.feed {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  overflow: hidden;
}

.feed p {
  margin: 0;
  padding: 10px;
  border-left: 3px solid var(--purple);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  line-height: 1.35;
}

.share-links {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 8px;
  justify-content: start;
}

.share-links a {
  display: grid;
  place-items: center;
  padding: 0;
}

.share-icon-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-weight: 900;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.share-icon-link:hover,
.controls .icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 209, 102, 0.85);
}

.x-link {
  background: #111;
}

.fb-link {
  background: #1877f2;
}

.fb-link span {
  font-family: Arial, sans-serif;
  font-size: 1.55rem;
  line-height: 1;
}

.leaderboard {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.leaderboard-head .label {
  margin: 0;
}

.leaderboard-head button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
}

.player-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.player-row label {
  color: var(--muted);
  font-size: 0.82rem;
}

.player-row input,
.player-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  color: var(--ink);
}

.player-row input {
  min-width: 0;
  padding: 0 9px;
}

.player-row button {
  grid-column: 1 / -1;
  cursor: pointer;
}

.leaderboard ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.86rem;
}

.leaderboard strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard b {
  color: var(--yellow);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .side-panel {
    min-height: 260px;
  }
}

@media (max-width: 720px) {
  .site-nav,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .scoreboard {
    min-width: 0;
  }

  .canvas-wrap {
    min-height: 280px;
  }

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

  .controls button:last-child {
    grid-column: 1 / -1;
  }
}
