:root {
  --bg: #e8e3d8;
  --panel: rgba(252, 250, 246, 0.92);
  --panel-soft: #f3efe6;
  --ink: #1f1c18;
  --muted: #69635d;
  --line: rgba(50, 44, 38, 0.14);
  --shadow: 0 22px 55px rgba(50, 39, 28, 0.12);
  --accent: #3b3937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.5), transparent 25%),
    linear-gradient(180deg, #f2ede4 0%, #e4dccf 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Aptos", "Trebuchet MS", sans-serif;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

strong {
  font-weight: 700;
}

.page {
  width: min(1360px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.header-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
  min-width: 0;
}

.title-block {
  display: grid;
  gap: 10px;
}

.eyebrow,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}

.intro {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: flex-end;
  align-items: center;
}

.top-nav-link {
  padding: 0 16px;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1;
  border-right: 1px solid rgba(50, 44, 38, 0.18);
  transition: color 180ms ease, opacity 180ms ease;
}

.top-nav-link:first-child {
  padding-left: 0;
}

.top-nav-link:last-child {
  padding-right: 0;
  border-right: 0;
}

.top-nav-link:hover {
  color: #c96a3d;
}

.social-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.social-link {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(50, 44, 38, 0.1);
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.social-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(30, 25, 20, 0.2);
  opacity: 0.92;
}

.social-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  display: block;
}

.back-button,
.button {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  font: inherit;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.back-button {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.button {
  background: var(--ink);
  color: #f7f4ee;
  cursor: pointer;
}

.back-button:hover,
.button:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 25, 20, 0.28);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(61, 51, 40, 0.1);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 20px;
}

.game-card,
.side-card {
  display: grid;
  gap: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.hud-item,
.info-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(59, 52, 45, 0.08);
}

.hud-item {
  display: grid;
  gap: 6px;
}

.hud-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.hud-value {
  font-size: 1.28rem;
  font-weight: 700;
}

.game-shell {
  position: relative;
  min-height: 560px;
  border-radius: 22px;
  border: 1px dashed rgba(62, 54, 47, 0.18);
  overflow: hidden;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(85, 76, 66, 0.04) 0,
      rgba(85, 76, 66, 0.04) 14px,
      transparent 14px,
      transparent 28px
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(241, 235, 225, 0.82));
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(243, 239, 230, 0.42);
  backdrop-filter: blur(6px);
}

.game-overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 22px;
  background: rgba(252, 250, 246, 0.92);
  border: 1px solid rgba(61, 51, 40, 0.1);
  box-shadow: 0 18px 42px rgba(50, 39, 28, 0.08);
}

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

.overlay-stat {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(243, 239, 230, 0.76);
  border: 1px solid rgba(59, 52, 45, 0.08);
  display: grid;
  gap: 6px;
}

.overlay-copy,
.info-copy {
  color: var(--muted);
  line-height: 1.65;
}

.stack {
  display: grid;
  gap: 14px;
}

.footer {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: 22px;
  border: 1px solid rgba(59, 52, 45, 0.1);
  background: rgba(255, 255, 255, 0.42);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.footer-copy {
  color: var(--muted);
  line-height: 1.65;
}

.footer-links {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 16px;
  align-items: center;
}

.footer-link {
  color: var(--ink);
  font-size: 0.94rem;
}

.footer-link:hover {
  color: #c96a3d;
}

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

@media (max-width: 720px) {
  .page {
    width: min(100% - 22px, 1360px);
    padding-top: 22px;
  }

  .topbar,
  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-nav,
  .social-links,
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    justify-items: stretch;
  }

  .back-button,
  .button {
    width: 100%;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .overlay-stats {
    grid-template-columns: 1fr;
  }

  .game-shell {
    min-height: 400px;
  }

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

  .footer-links {
    grid-auto-flow: row;
    gap: 8px;
  }
}
