/* Monke — staymonke.com
   Palette and grammar mirror the app: beige surface, house green #9DD587,
   coral #EB7D73, black strokes, 12/16 radii, spacing in multiples of 4. */

@font-face {
  font-family: "Schoolbell";
  src: url("assets/Schoolbell-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #f5f0eb;
  --card: #fffcf7;
  --ink: #1c1917;
  --ink-70: rgba(28, 25, 23, 0.7);
  --ink-50: rgba(28, 25, 23, 0.5);
  --ink-20: rgba(28, 25, 23, 0.2);
  --green: #9dd587;
  --coral: #eb7d73;
  --radius-btn: 12px;
  --radius-lg: 16px;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Nunito, "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Our components set display explicitly, which would otherwise beat the
   default [hidden] rule and leave hidden elements on screen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--rounded);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px calc(24px + env(safe-area-inset-bottom));
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  text-align: center;
}

/* ---- Hero ---- */

.hero { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.app-icon {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  border: 2px solid var(--ink);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.wordmark {
  font-family: "Schoolbell", var(--rounded);
  font-size: 64px;
  font-weight: 400;
  line-height: 1;
  margin: 4px 0 0;
  letter-spacing: 0.02em;
}

.tagline {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-70);
  margin: 0;
}

/* ---- Game page ---- */

.play {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px calc(24px + env(safe-area-inset-bottom));
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

/* The back link is left-aligned inside the centred column. */
.play .doc-back { align-self: flex-start; margin-bottom: 0; }

.play-title {
  font-family: "Schoolbell", var(--rounded);
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  margin: 0;
}

.play-sub { margin: -16px 0 0; font-size: 15px; font-weight: 500; color: var(--ink-50); }

.play-cta { margin: 0; }

/* Push the footer down when the page is taller than its content. */
.play .footer { margin-top: auto; padding-top: 16px; }

/* ---- Game ---- */

.game { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }

#runner {
  width: 100%;
  height: 220px;
  display: block;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
}

#runner:focus-visible { box-shadow: 0 0 0 3px var(--green), 0 4px 8px rgba(0, 0, 0, 0.15); }

.hint {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-50);
  min-height: 21px;
}

.game-panel { position: relative; width: 100%; }

/* ---- Leaderboard name prompt (over the canvas) ---- */

.name-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 252, 247, 0.94);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.name-note { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }

.name-form { display: flex; gap: 8px; }

.name-form input,
.waitlist-form input {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  min-width: 0;
  outline: none;
}

.name-form input { width: 180px; text-align: center; }

.name-form input:focus,
.waitlist-form input:focus { box-shadow: 0 0 0 3px var(--green); }

.link-btn {
  background: none;
  border: none;
  padding: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-50);
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover { color: var(--ink); }

/* ---- Leaderboard ---- */

.board { width: 100%; }

.board-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 20px;
  text-align: left;
}

.board-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 0;
  border-bottom: 1px solid var(--ink-20);
}

.board-rank { width: 20px; color: var(--ink-50); font-variant-numeric: tabular-nums; }
.board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-variant-numeric: tabular-nums; color: var(--ink-70); }

/* ---- Buttons ---- */

.cta { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: var(--radius-btn);
  border: 2px solid var(--ink);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s ease;
}

/* The primary CTA is a <button> on the landing page and an <a> elsewhere. */
button.btn { cursor: pointer; }

.btn-primary {
  background: var(--green);
  box-shadow: 0 4px 0 var(--ink);
}

.btn-primary:active { transform: scale(0.95); }

.btn-secondary {
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 24px;
  cursor: pointer;
  font-family: inherit;
}

.btn-secondary:hover { background: #fff; }
.btn-secondary:active { transform: scale(0.95); }

.btn-small { font-size: 16px; padding: 10px 20px; }

/* ---- Android waitlist ---- */

.waitlist { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.waitlist-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.waitlist-form input[type="email"] { flex: 1; }
.waitlist-form button { flex: 0 0 auto; }

.waitlist-count {
  margin: -4px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-70);
}

.waitlist-count::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--green);
  vertical-align: middle;
  animation: dot-pulse 2s ease-out infinite;
}

/* A ring pushed outwards from the dot — box-shadow rather than transform, so
   the dot itself never moves and the text baseline stays put. */
@keyframes dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(157, 213, 135, 0.9); }
  70% { box-shadow: 0 0 0 7px rgba(157, 213, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(157, 213, 135, 0); }
}

.waitlist-note {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-50);
  max-width: 400px;
}

.waitlist-note a { color: var(--ink-50); }
.waitlist-note.is-success { color: var(--ink); font-weight: 700; font-size: 15px; }

/* Bot bait: off-screen rather than display:none, which some bots skip. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Footer ---- */

.footer { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
}

.footer-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-50);
  text-decoration: none;
}

.footer-links a:hover { color: var(--ink); text-decoration: underline; }

.copyright { margin: 0; font-size: 13px; color: var(--ink-50); }

/* ---- Content pages (privacy / support) ---- */

.doc {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px calc(48px + env(safe-area-inset-bottom));
  text-align: left;
}

.doc-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-70);
  text-decoration: none;
  margin-bottom: 24px;
}

.doc-back:hover { color: var(--ink); }

.doc h1 { font-size: 32px; font-weight: 700; margin: 0 0 4px; }
.doc h2 { font-size: 20px; font-weight: 700; margin: 32px 0 8px; }
.doc p, .doc li { color: var(--ink-70); }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--ink); font-weight: 600; }
.doc .updated { font-size: 14px; color: var(--ink-50); margin-bottom: 24px; }

.doc-card {
  background: var(--card);
  border: 2px solid var(--ink-20);
  border-radius: var(--radius-btn);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.doc-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--ink); }
.doc-card p { margin: 0; font-size: 15px; }

a.doc-card {
  display: block;
  text-decoration: none;
  font-weight: 400;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

a.doc-card:hover { border-color: var(--ink); }
a.doc-card:active { transform: scale(0.99); }

/* ---- Mobile ---- */

@media (max-width: 640px) {
  .page { padding-top: 32px; gap: 24px; }
  .play { padding-top: 24px; gap: 20px; }
  .play-title { font-size: 36px; }
  .app-icon { width: 88px; height: 88px; border-radius: 20px; }
  .wordmark { font-size: 48px; }
  .tagline { font-size: 16px; }
  #runner { height: 150px; }
  .btn-primary { width: 100%; }
  .btn-secondary { width: 100%; font-size: 14px; padding: 10px 16px; }
  .waitlist-form button { width: auto; }
  .name-form input { width: 150px; }
  .board-list { gap: 0 16px; font-size: 13px; }
  .doc h1 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .waitlist-count::before { animation: none; }
}
