/* Ecru mini-game page shell — shared by every game the kit stamps out.
   Per-game colour lives in :root overrides inside each game's index.html. */
:root {
  --ink: #242219; --ink-deep: #191812;
  --cream: #fffdf4; --soy: #e6ddb4; --soy-dim: #c5be9a;
  --accent: #5fae63;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--soy);
  font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  display: flex; justify-content: center; align-items: flex-start;
  gap: 18px; padding: 12px 14px;
  -webkit-user-select: none; user-select: none;
}

/* --- ad rails --------------------------------------------------------- */
.rail { flex: 0 0 180px; display: flex; justify-content: center; padding-top: 56px; position: sticky; top: 12px; }
.rail .ad-unit { width: 160px; height: 600px; }
#banner { margin-top: 10px; }
#banner .ad-unit { width: min(728px, 92vw); height: 90px; }
.ad-unit--empty {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(230, 221, 180, .25); border-radius: 10px;
  color: rgba(230, 221, 180, .35); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase;
}

/* --- stage ------------------------------------------------------------ */
#stage { display: flex; flex-direction: column; align-items: center; min-width: 0; }
#top {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px 10px; gap: 10px;
}
#top a.brand { color: var(--soy-dim); text-decoration: none; font-size: 13px; letter-spacing: .14em; }
#top a.brand b { color: var(--soy); }
#top .name { font-weight: 800; font-size: 15px; letter-spacing: .06em; }
#btn-mute {
  border: 1px solid rgba(230, 221, 180, .25); background: transparent; color: var(--soy);
  border-radius: 10px; font-size: 16px; padding: 4px 10px; cursor: pointer;
}
.top-right { display: flex; gap: 8px; align-items: center; }
.xchip {
  display: flex; gap: 6px; align-items: center; text-decoration: none;
  border: 1px solid rgba(230, 221, 180, .25); border-radius: 10px;
  padding: 6px 10px; font-size: 12px; color: var(--soy-dim);
}
.xchip b { font-weight: 700; color: var(--soy); }
.xchip:hover { border-color: rgba(230, 221, 180, .5); }
#frame { position: relative; }
canvas {
  display: block; border-radius: 18px;
  height: min(80vh, 720px); aspect-ratio: var(--game-aspect, 540 / 760); width: auto;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
  touch-action: none; cursor: crosshair;
}

/* --- overlay cards ---------------------------------------------------- */
#veil {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(25, 24, 18, .25); border-radius: 18px;
}
.card {
  background: var(--cream); color: var(--ink);
  border-radius: 18px; padding: 26px 30px; width: min(360px, 86%);
  text-align: center; box-shadow: 0 14px 44px rgba(0, 0, 0, .35);
  max-height: 94%; overflow-y: auto;
}
.card .kicker { font-size: 11px; letter-spacing: .22em; color: #8b8468; font-weight: 700; }
.card h1 { margin: 6px 0 10px; font-size: 34px; letter-spacing: .02em; }
.card p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: #4d4a3c; }
.card .legend { font-size: 12.5px; color: #6b664f; margin-bottom: 16px; }
.big {
  display: block; width: 100%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 18px;
  padding: 13px 0; border-radius: 12px; letter-spacing: .04em;
}
.big:hover { filter: brightness(1.07); }
.best { margin-top: 10px; font-size: 13px; color: #6b664f; }
.hint { margin-top: 12px; font-size: 11.5px; color: #9a947a; }
.dev-follow { display: block; margin-top: 10px; font-size: 11.5px; color: #8b8468; text-decoration: none; }
.dev-follow:hover { color: #4d7a48; text-decoration: underline; }
.score { font-size: 56px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
#over-best { font-size: 14px; color: #6b664f; margin-bottom: 16px; }
.share {
  display: block; margin-top: 10px; padding: 10px 0; border-radius: 12px;
  background: #1a1a1a; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px;
}

/* --- leaderboard ------------------------------------------------------ */
#board { margin-top: 14px; text-align: left; }
#board .bd-title {
  font-size: 11px; letter-spacing: .18em; color: #8b8468; font-weight: 700;
  margin-bottom: 6px; text-align: center;
}
.bd-row { display: flex; gap: 8px; font-size: 13px; padding: 4px 8px; border-radius: 8px; color: #4d4a3c; }
.bd-row .rank { width: 24px; color: #9a947a; font-weight: 700; }
.bd-row b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bd-row .pts { font-variant-numeric: tabular-nums; font-weight: 700; }
.bd-row.me { background: #e9f3e4; color: #2f5c33; }
.bd-login {
  display: block; margin-top: 6px; font-size: 12.5px; color: #4d7a48;
  text-decoration: underline; text-align: center;
}

/* --- cross-promo ------------------------------------------------------ */
.promo {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding: 10px; border-radius: 14px; text-align: left;
  background: linear-gradient(105deg, #223a1e, #2f5c33);
  text-decoration: none; color: #fff;
  box-shadow: 0 6px 18px rgba(47, 92, 51, .35);
}
.promo img { width: 104px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; flex: 0 0 auto; }
.promo b { display: block; font-size: 14.5px; }
.promo span { display: block; font-size: 12px; color: #cfe3c8; margin-top: 2px; }
.promo em {
  font-style: normal; display: inline-block; margin-top: 7px;
  background: #ffd76a; color: #38341f; font-weight: 800; font-size: 11.5px;
  padding: 4px 10px; border-radius: 999px; letter-spacing: .04em;
}
.promo:hover { filter: brightness(1.09); }

#house {
  margin-top: 12px; width: min(728px, 92vw);
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(105deg, #2b2517, #3a3322);
  border: 1px solid rgba(230, 221, 180, .22); border-radius: 14px;
  padding: 10px 16px 10px 10px; text-decoration: none; color: var(--soy);
}
#house img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; flex: 0 0 auto; }
#house .h-txt { flex: 1; min-width: 0; }
#house b { font-size: 15px; color: #fffdf4; }
#house span { display: block; font-size: 12.5px; color: var(--soy-dim); margin-top: 3px; }
#house em {
  font-style: normal; background: var(--accent); color: #fff; font-weight: 800;
  font-size: 13px; padding: 8px 16px; border-radius: 10px; white-space: nowrap;
}
#house:hover { border-color: rgba(230, 221, 180, .45); }

/* --- interstitial ----------------------------------------------------- */
#adshade {
  position: fixed; inset: 0; z-index: 40; display: none;
  align-items: center; justify-content: center; background: rgba(10, 10, 8, .82);
}
#adshade.show { display: flex; }
#adbox {
  width: min(460px, 90vw); background: var(--cream); color: var(--ink);
  border-radius: 16px; padding: 22px; text-align: center;
}
#adbox .tag { font-size: 10px; letter-spacing: .3em; color: #8b8468; font-weight: 700; }
#adbox .art { font-size: 52px; margin: 18px 0; }
#adbox p { font-size: 13px; color: #6b664f; margin: 0 0 16px; }
#ad-skip {
  border: 0; background: var(--ink); color: var(--cream); border-radius: 10px;
  padding: 9px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
}
#ad-skip:disabled { opacity: .5; cursor: default; }

@media (max-width: 980px) { .rail { display: none; } }
@media (max-width: 620px) {
  body { padding: 8px; }
  canvas { width: min(96vw, 460px); height: auto; }
  .xchip b { display: none; }
  #banner { order: 2; margin-top: 12px; }   /* paying unit above the house promo */
  #house { order: 3; }
  #house span { display: none; }
}
