:root {
  --sage: #7c915b;
  --sage-lt: #a3b57a;
  --sage-dark: #5a6b40;
  --sage-deep: #3d4a2c;
  --cream: #f4f0e6;
  --ink: #12160e;
  --ink-2: #1a2214;
  --amber: #c9842a;
  --amber-lt: #e0b060;
  --wood: #8a6230;
  --muted: #c5cbb8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: #0c100c;
  color: var(--cream);
  font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
}

a {
  color: var(--sage-lt);
}

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

.skip:focus {
  position: fixed;
  left: 12px;
  top: 8px;
  z-index: 20;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: normal;
  background: var(--cream);
  color: var(--ink);
  padding: 8px 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(12, 16, 12, 0.92);
  border-bottom: 1px solid rgba(124, 145, 91, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.brand h1 {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
}

.brand p {
  font-size: 11px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
}

.top-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.top-links a {
  color: var(--cream);
  text-decoration: none;
  border: 1px solid var(--sage);
  padding: 6px 10px;
  border-radius: 4px;
}

.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 48px 16px 28px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 107, 64, 0.45), transparent 55%),
    linear-gradient(180deg, #10160f 0%, #0c100c 70%);
}

.now-playing {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--sage-lt);
}

.arcade-title {
  margin-top: 10px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(44px, 13vw, 108px);
  letter-spacing: 0.1em;
  line-height: 0.95;
  color: var(--cream);
  text-shadow:
    0 0 10px rgba(124, 145, 91, 0.9),
    0 0 28px rgba(201, 132, 42, 0.45),
    0 4px 0 #3d4a2c;
}

.hero-rule {
  width: min(420px, 70%);
  height: 3px;
  margin: 18px auto 12px;
  border: 0;
  background: linear-gradient(90deg, var(--amber), var(--sage-lt));
}

.select-line {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-note {
  max-width: 560px;
  margin: 16px auto 0;
  font-size: 16px;
  line-height: 1.45;
  color: #e8eadf;
}

.grid-floor {
  height: 72px;
  max-width: 100%;
  margin-top: 28px;
  background:
    linear-gradient(180deg, transparent, rgba(12, 16, 12, 0.9)),
    repeating-linear-gradient(
      90deg,
      transparent 0 38px,
      rgba(124, 145, 91, 0.28) 38px 39px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 18px,
      rgba(201, 132, 42, 0.18) 18px 19px
    );
  transform: perspective(280px) rotateX(62deg);
  transform-origin: center top;
  /* contain 3D floor bleed inside .hero overflow:hidden */
  will-change: transform;
}

.games {
  width: 100%;
  max-width: 1120px;
  margin: -8px auto 40px;
  padding: 0 12px;
  box-sizing: border-box;
}

.games h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

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

.card {
  display: flex;
  flex-direction: column;
  background: #141a12;
  border: 1px solid rgba(124, 145, 91, 0.7);
  box-shadow: 0 0 16px rgba(124, 145, 91, 0.18);
  text-decoration: none;
  color: inherit;
  min-height: 280px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 0 22px rgba(201, 132, 42, 0.35);
  outline: none;
}

.card h3 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  padding: 10px 8px 8px;
  color: #efb56a;
}

.thumb {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  image-rendering: pixelated;
  background:
    repeating-linear-gradient(
      0deg,
      #1a2214 0 11px,
      #24301c 11px 12px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 11px,
      rgba(201, 132, 42, 0.12) 11px 12px
    );
}

.card p {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.4;
  color: #d7dccf;
  padding: 12px 14px 8px;
  flex: 1;
}

.play {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage-lt);
  text-align: right;
  padding: 8px 14px 14px;
}

.card.locked {
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
}

.card.locked .play {
  color: #8a9080;
}

.site-footer {
  border-top: 1px solid rgba(124, 145, 91, 0.35);
  padding: 28px 18px 40px;
  text-align: center;
  background: #0a0d09;
}

.site-footer p,
.site-footer li {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #d8dccf;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}

.btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--sage);
  padding: 9px 14px;
  border-radius: 4px;
  cursor: pointer;
}

.btn.primary {
  background: var(--sage);
  color: var(--cream);
  border-color: var(--sage-lt);
}

.fine {
  margin-top: 12px;
  font-size: 12px !important;
  color: #9aa28e !important;
}

.install-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto 18px;
  padding: 12px 14px;
  border: 1px solid var(--sage);
  background: #171d14;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  box-sizing: border-box;
}

.game-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #0c100c;
}

.game-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #141a12;
  border-bottom: 1px solid rgba(124, 145, 91, 0.4);
  font-family: Arial, Helvetica, sans-serif;
}

.game-bar h1 {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  min-width: 160px;
}

.game-bar a,
.game-bar button {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--cream);
  background: transparent;
  border: 1px solid var(--sage);
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}

.bar-actions {
  display: flex;
  gap: 6px;
}

.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 12px 8px;
  max-width: 100%;
  overflow: hidden;
}

#game {
  display: block;
  width: min(100%, calc((100dvh - 140px) * var(--aspect, 0.67)));
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 140px);
  background: #000;
  border: 5px solid var(--sage-deep);
  border-radius: 6px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  box-sizing: border-box;
}

.hint {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  padding: 0 12px 8px;
}

.touch {
  display: none;
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px 12px 18px;
  justify-content: space-between;
  pointer-events: none;
}

.touch .pad {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: rgba(44, 51, 31, 0.62);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.touch.build,
.touch.sort {
  display: none;
  gap: 8px;
  justify-content: center;
}

.touch.build .pad,
.touch.sort .pad {
  width: auto;
  min-width: 86px;
  border-radius: 10px;
  padding: 8px 10px;
}

.game-foot {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  text-align: center;
  color: #9aa28e;
  padding: 6px 12px 14px;
}

.game-foot a {
  color: var(--sage-lt);
}

body.embedded .topbar,
body.embedded .site-footer .extra {
  display: none;
}

body.embedded .hero {
  padding-top: 24px;
}

body.embedded,
html:has(body.embedded) {
  overflow-x: hidden;
  max-width: 100%;
}

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

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
  }
  .brand h1 {
    font-size: 12px;
    letter-spacing: 0.08em;
    overflow-wrap: anywhere;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .arcade-title {
    letter-spacing: 0.02em;
    font-size: clamp(36px, 11vw, 72px);
    overflow-wrap: anywhere;
    max-width: 100%;
  }
  .hero {
    padding-left: 12px;
    padding-right: 12px;
  }
  .hero-note {
    font-size: 15px;
    padding: 0 2px;
  }
  .cta-row .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

@media (hover: none) and (pointer: coarse) {
  .touch-needed {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .grid-floor,
  .arcade-title {
    transition: none;
    transform: none;
    animation: none;
  }
}
