:root {
  --bg: #0b0d12;
  --panel: #11141d;
  --ink: #c8cdd8;
  --muted: #6b7280;
  --accent: #7be08a;
  --line: #232a3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(circle at 50% 0%, #161b27 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* ---- Above-the-fold app shell: header + ad + game fill the viewport ---- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 6px;
}

.site-header {
  width: 100%;
  text-align: center;
  display: block;
}
.logo {
  margin: 0;
  font-size: 30px;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 2px 0 #1c5a2e, 0 0 18px rgba(123, 224, 138, 0.25);
}
.tagline { font-size: 12px; color: var(--muted); letter-spacing: 1px; }

#stage {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0; /* allow flex child to shrink so the canvas can scale down */
}

#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border: 2px solid #2a3142;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px #000 inset;
}

#hint {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-align: center;
}

/* ---- Ad slots (placeholders until real AdSense units are pasted in) ---- */
.ad-slot {
  width: 100%;
  max-width: 728px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #0e1118, #0e1118 10px, #10141d 10px, #10141d 20px);
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.ad-leaderboard { height: 90px; margin: 0 auto; }
.ad-rectangle { height: 250px; max-width: 336px; margin: 0 auto 18px; }
.ad-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5160;
}

/* ---- Below-the-fold content ---- */
.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #e7ebf4;
  letter-spacing: 1px;
}
.card p { margin: 0 0 10px; line-height: 1.6; font-size: 14px; }
.how { margin: 0; padding-left: 18px; line-height: 1.9; font-size: 14px; }
.how b { color: #e7ebf4; }

.site-footer {
  max-width: 760px;
  margin: 24px auto 0;
  padding: 18px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer nav { margin-top: 6px; }
.site-footer .sep { margin: 0 6px; }

/* legal/info pages */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  line-height: 1.7;
}
.page h1 { color: var(--accent); letter-spacing: 2px; }
.page h2 { color: #e7ebf4; font-size: 16px; margin-top: 26px; }
.page a.back { display: inline-block; margin-bottom: 18px; }

/* ---- Portal: top nav ---- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 16px;
}
.brand {
  font-weight: bold;
  letter-spacing: 2px;
  font-size: 15px;
  color: var(--accent);
}
.nav-links a { color: var(--ink); font-size: 13px; margin-left: 18px; }

.builds-section {
  max-width: 1000px;
  margin: 26px auto 0;
  padding: 24px 16px 4px;
  border-top: 1px solid var(--line);
}
.builds-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.builds-heading h2 { margin: 4px 0 6px; color: #e7ebf4; font-size: 22px; letter-spacing: 1px; }
.builds-heading p { max-width: 620px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 2px; }
.builds-cta { white-space: nowrap; }
.builds-tools { display: flex; align-items: center; gap: 14px; margin: 16px 0 12px; }
.builds-search { flex: 1; }
.builds-search input { width: 100%; padding: 10px 12px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.builds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.build-card { display: flex; min-height: 176px; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.build-card-art { display: grid; place-items: center; min-height: 72px; font-size: 34px; background: radial-gradient(circle at 50% 20%, #24344a, #101722 70%); }
.build-card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 11px 13px 13px; }
.build-card h3 { margin: 0; color: #e7ebf4; font-size: 15px; }
.build-card p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.build-card small { color: #8b94a4; font-size: 10px; }
.build-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.build-tags span { color: var(--accent); font-size: 10px; }
.build-card .play-btn { align-self: start; margin-top: 4px; }
.builds-empty { grid-column: 1 / -1; padding: 30px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 8px; }
.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; }
@media (max-width: 640px) { .builds-heading { align-items: start; flex-direction: column; } .builds-tools { align-items: stretch; flex-direction: column; } }
@media (max-width: 640px) { .builder-feature { grid-template-columns: 1fr; } .builder-feature-art { min-height: 170px; border-right: 1px solid #31425a; border-bottom: 0; border-radius: 11px 11px 0 0; } .builder-feature-body { border-radius: 0 0 11px 11px; } .section-heading { align-items: start; flex-direction: column; gap: 8px; } }
@media (max-width: 640px) { .builder-pillars { grid-template-columns: 1fr; } }

/* ---- Portal: hub hero ---- */
.hub-hero { text-align: center; padding: 22px 16px 8px; }
.hub-hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 2px 0 #1c5a2e, 0 0 22px rgba(123, 224, 138, 0.25);
}
.hub-hero p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.builder-hero { padding-top: 46px; padding-bottom: 34px; }
.builder-hero h1 { font-size: clamp(34px, 7vw, 62px); }
.hero-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
.hero-primary, .hero-secondary { display: inline-block; padding: 12px 18px; border-radius: 6px; font-size: 12px; letter-spacing: 1px; }
.hero-primary { color: #08110b; background: var(--accent); font-weight: bold; box-shadow: 0 8px 22px rgba(123,224,138,.2); }
.hero-secondary { color: var(--ink); border: 1px solid var(--line); }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 11px; }

.builder-feature { max-width: 1000px; margin: 20px auto 0; padding: 0 16px; display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); gap: 0; }
.builder-feature-art { min-height: 265px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #31425a; border-right: 0; border-radius: 11px 0 0 11px; background: radial-gradient(circle at 50% 25%, #284c4b, #121c29 68%, #0d1119); font-size: 52px; box-shadow: inset 0 0 70px rgba(123, 224, 138, .08); }
.builder-feature-art span:nth-child(2) { transform: translateY(24px); font-size: 66px; }
.builder-feature-art span:nth-child(3) { transform: translateY(-30px); font-size: 28px; }
.builder-feature-body { display: flex; flex-direction: column; justify-content: center; padding: 28px 30px; border: 1px solid #31425a; border-radius: 0 11px 11px 0; background: linear-gradient(135deg, #151e2c, #10141d 70%); }
.builder-feature-body h2 { margin: 5px 0 8px; color: #eff4ff; font-size: 25px; letter-spacing: 1px; }
.builder-feature-body p { max-width: 560px; margin: 0 0 18px; color: var(--ink); line-height: 1.7; font-size: 14px; }
.builder-feature-body small { margin-top: 14px; color: var(--muted); font-size: 11px; }
.builder-feature-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.builder-secondary-link { color: var(--accent); font-size: 11px; letter-spacing: 1px; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-pills span { padding: 5px 9px; color: var(--accent); border: 1px solid #2b4b3a; border-radius: 20px; font-size: 11px; }
.builder-pillars { max-width: 1000px; margin: 18px auto 0; padding: 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.builder-pillars article { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.builder-pillars article > span { color: var(--accent); font-size: 11px; }
.builder-pillars h3 { margin: 10px 0 6px; color: #e7ebf4; font-size: 15px; }
.builder-pillars p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.builder-vision { max-width: 1000px; margin: 24px auto 0; }
.builder-vision h2 { margin-top: 6px; }
.section-heading { grid-column: 1 / -1; display: flex; align-items: end; justify-content: space-between; margin-bottom: -2px; }
.section-heading h2 { margin: 5px 0 0; color: #e7ebf4; font-size: 20px; }

/* ---- Portal: games grid ---- */
.games-grid {
  max-width: 1000px;
  margin: 16px auto 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
a.game-card:hover {
  transform: translateY(-3px);
  border-color: #3a4a66;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.game-card .cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  background: #0a0d16;
  image-rendering: pixelated;
}
.game-card.soon .cover {
  display: flex;
  align-items: center;
  justify-content: center;
}
.badge-soon {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 4px 10px;
  border-radius: 20px;
}
.game-card .body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.game-card h3 { margin: 0; font-size: 15px; color: #e7ebf4; letter-spacing: 1px; }
.game-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; flex: 1; }
.game-card.soon { opacity: 0.55; }
.play-btn {
  margin-top: 8px;
  align-self: flex-start;
  background: var(--accent);
  color: #06210f;
  font-weight: bold;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ---- Touch controls (only shown on touch devices via JS .touch class) ---- */
#touch-controls { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
body:not(.touch) #touch-controls { display: none; }

.tc-pad {
  position: absolute; left: 18px; bottom: 20px;
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(18, 22, 32, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.16);
  pointer-events: auto; touch-action: none;
}
.tc-nub {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: rgba(123, 224, 138, 0.32);
  border: 2px solid rgba(123, 224, 138, 0.65);
}

.tc-btn {
  position: absolute; pointer-events: auto; touch-action: none;
  border: none; border-radius: 50%;
  font-family: inherit; font-weight: bold; letter-spacing: 1px;
  color: #06210f; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.tc-btn.on { filter: brightness(1.25); transform: scale(0.94); }
.tc-a { right: 24px;  bottom: 30px;  width: 86px; height: 86px; background: #7be08a; font-size: 12px; }
.tc-b { right: 120px; bottom: 74px;  width: 70px; height: 70px; background: #7ec8ff; font-size: 12px; }
.tc-talk    { right: 30px;  bottom: 132px; width: 64px; height: 40px; border-radius: 20px; background: #ffd76a; font-size: 11px; }
.tc-journal { right: 108px; bottom: 156px; width: 48px; height: 40px; border-radius: 20px; background: #c0a0ff; font-size: 16px; }

/* ---- Glitched Garden light portal theme ---- */
:root {
  --bg: #e8f4ef;
  --panel: rgba(255, 253, 247, 0.92);
  --ink: #2f4c43;
  --muted: #667d75;
  --accent: #2e9b68;
  --line: #c7ded2;
}

html, body {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% -4%, rgba(255, 238, 178, .85) 0 14%, transparent 34%),
    radial-gradient(circle at 88% 4%, rgba(148, 213, 191, .62) 0 12%, transparent 32%),
    linear-gradient(180deg, #d9f0ee 0, #edf6ed 43%, #f8f1e5 100%);
  color: var(--ink);
}

a { color: #247c55; }
.site-nav { border-bottom: 1px solid rgba(85, 142, 111, .18); }
.brand { color: #23744f; }
.nav-links a { color: #42665a; }
.hub-hero h1, .logo { color: #286f50; text-shadow: 0 2px 0 #f7fff8, 0 12px 28px rgba(46, 155, 104, .16); }
.hero-primary { color: #fffdf7; background: linear-gradient(135deg, #36a76f, #287c57); box-shadow: 0 10px 22px rgba(46, 155, 104, .24); }
.hero-secondary { color: #386359; border-color: #b9d9c7; background: rgba(255,255,255,.55); }
.hero-secondary:hover { background: #fffdf7; text-decoration: none; }
.builder-feature-art { border-color: #b9d9c7; background: radial-gradient(circle at 50% 25%, #d8f1da, #b7dfd1 68%, #9ac8bb); box-shadow: inset 0 0 70px rgba(255, 255, 255, .5); }
.builder-feature-body { border-color: #b9d9c7; background: linear-gradient(135deg, #fffdf8, #eef7ef 70%); }
.builder-feature-body h2, .builds-heading h2, .builder-pillars h3, .builder-vision h2, .card h2, .section-heading h2 { color: #294b40; }
.builder-feature-body p { color: #49695f; }
.feature-pills span { color: #277b55; border-color: #b5d9c2; background: #eff9ef; }
.builder-pillars article, .card, .build-card { background: var(--panel); border-color: var(--line); box-shadow: 0 10px 26px rgba(76, 112, 94, .08); }
.builder-pillars article { background: linear-gradient(145deg, rgba(255,253,247,.98), rgba(238,248,239,.88)); }
.builder-pillars p, .builds-heading p, .build-card p { color: #60786f; }
.builds-section { border-color: #c7ded2; }
.builds-search input { color: var(--ink); background: #fffdf9; border-color: #c7ded2; }
.builds-search input:focus { outline: 2px solid rgba(46,155,104,.25); border-color: #5fb887; }
.build-card-art { background: radial-gradient(circle at 50% 10%, #fff1c9, #d5ecdc 62%, #bedccf); }
.build-card h3 { color: #294b40; }
.build-card small { color: #758b82; }
.builds-empty { color: #667d75; border-color: #bad8c6; background: rgba(255,253,247,.52); }
.play-btn { color: #fffdf7; background: linear-gradient(135deg, #36a76f, #287c57); box-shadow: 0 6px 14px rgba(46,155,104,.16); }
.site-footer { color: #667d75; border-color: #c7ded2; }
.page h1 { color: #286f50; }
.page h2, .how b { color: #294b40; }

/* ---- Beta waitlist ---- */
.waitlist-section { text-align: center; }
.waitlist-play { margin: 0 0 20px; }
.waitlist-section > p { max-width: 560px; margin: 10px auto 18px; color: #49695f; }
.waitlist-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}
.waitlist-form input[type="email"] {
  flex: 1 1 240px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid #c7ded2;
  border-radius: 10px;
}
.waitlist-form input[type="email"]:focus { outline: 2px solid rgba(46, 155, 104, .25); border-color: #5fb887; }
.waitlist-submit { border: 0; cursor: pointer; font: inherit; letter-spacing: 1px; }
.waitlist-submit:disabled { opacity: .6; cursor: wait; }
.waitlist-status { min-height: 1.4em; margin: 12px auto 0; max-width: 520px; color: #49695f; }
.waitlist-status.is-success { color: #247c55; font-weight: bold; }
.waitlist-status.is-error { color: #a8563e; }
.waitlist-fineprint { margin-top: 6px; font-size: 12px; color: #758b82; }
