/* ==========================================================================
   Wordbox — quiet pixel calm
   Direction: soft mint field, monospace throughout, deep forest-green ink,
   coral pill actions, a rounded card floating on near-white, pixel scenery.
   ========================================================================== */

:root {
  --page:      #f7f9f8;   /* what the card floats on */
  --field:     #cfe1d8;   /* the mint card */
  --field-2:   #bcd6cb;
  --sky:       #d9e8e0;
  --cream:     #f2efe4;
  --ink:       #1d3b30;
  --ink-soft:  #33564a;
  --muted:     #5c7a6d;
  --faint:     #85a196;
  --line:      #a9c6b8;
  --coral:     #e4695e;
  --coral-dk:  #cf574c;
  --bark:      #9c6b5e;

  /* Tile states, tuned to sit inside the mint field rather than fight it */
  --ok:        #4e8c6a;
  --near:      #d9a441;
  --miss:      #8fa79b;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono", Consolas, monospace;
  --r-card: 22px;
  --r-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; }
/* No `height: 100%` here — it pins body to the viewport, so taller content
   overflows without growing the document and the page cannot scroll.
   `min-height: 100vh` on body below gives the same full-bleed effect safely. */

body {
  margin: 0;
  padding: 26px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; line-height: 1.22; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1.05em; }

/* The mint card everything lives inside */
.shell {
  /* `flex: 1` would resolve flex-basis to 0 and, combined with the
     overflow:hidden needed for the rounded corners, clip everything below the
     fold instead of letting the page scroll. `1 0 auto` sizes to content and
     only grows when the content is shorter than the viewport. */
  flex: 1 0 auto;
  display: flex; flex-direction: column;
  max-width: 1240px; width: 100%; margin: 0 auto;
  background: linear-gradient(180deg, var(--sky) 0%, var(--field) 46%, var(--field-2) 100%);
  border-radius: var(--r-card);
  overflow: hidden;
  position: relative;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 28px; width: 100%; }
.narrow { max-width: 720px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; background: var(--coral); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); z-index: 99; }

/* Header ---------------------------------------------------------------- */
.site-header { border: 0; background: transparent; }
.header-inner {
  display: flex; align-items: center; gap: 16px;
  height: 68px; max-width: 1060px; margin: 0 auto; padding: 0 28px;
}
.logo { font-size: .98rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.logo svg { width: 13px; height: 13px; margin-right: 7px; vertical-align: -1px; }
.logo b { font-weight: 700; }

.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a { font-size: .82rem; color: var(--ink-soft); padding: 7px 12px; border-radius: var(--r-pill); }
.nav a:hover, .nav a.is-active { color: var(--ink); background: rgba(255,255,255,.5); text-decoration: none; }

.cta-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--coral); color: #fff;
  padding: 9px 18px; border-radius: var(--r-pill);
  font-family: inherit; font-size: .8rem; font-weight: 700;
  border: 0; cursor: pointer;
}
.cta-pill:hover { background: var(--coral-dk); text-decoration: none; }

/* Hero ------------------------------------------------------------------ */
.hero { text-align: center; padding: 34px 0 6px; }
.hero h1 { max-width: 18ch; margin: 0 auto .4em; }
.hero p { color: var(--muted); max-width: 62ch; margin: 0 auto; font-size: .92rem; }

/* Three-column feature row, as in the reference */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin: 34px 0 0; text-align: center; }
.feature .ico { font-size: 1.6rem; margin-bottom: 10px; display: block; }
.feature h3 { font-size: .88rem; margin-bottom: 6px; }
.feature p { font-size: .82rem; color: var(--muted); margin: 0; }

/* Game layout ----------------------------------------------------------- */
.game-wrap { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 34px; align-items: start; padding: 14px 0 26px; }
.game { display: flex; flex-direction: column; align-items: center; }

.puzzle-meta {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .16em;
  color: var(--faint); font-weight: 700; margin-bottom: 14px; text-align: center;
}

/* Board ----------------------------------------------------------------- */
.board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 7px; margin-bottom: 20px; }
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }

.cell {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 1.6rem; font-weight: 700; text-transform: uppercase;
  border: 2px solid var(--line); border-radius: 8px;
  background: rgba(255,255,255,.35); color: var(--ink);
}
.cell.filled { border-color: var(--muted); background: rgba(255,255,255,.6); animation: pop .1s; }
.cell.ok   { background: var(--ok);        border-color: var(--ok);        color: #fff; }
.cell.near { background: var(--near); border-color: var(--near); color: #fff; }
.cell.miss { background: var(--miss);      border-color: var(--miss);      color: #fff; }

@keyframes pop { 0% { transform: scale(.92); } 100% { transform: scale(1); } }
.row.shake { animation: shake .38s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

/* Keyboard -------------------------------------------------------------- */
.keyboard { display: grid; gap: 7px; width: 100%; max-width: 470px; }
.krow { display: flex; gap: 6px; justify-content: center; }
.key {
  flex: 1; min-width: 0; height: 48px;
  border: 0; border-radius: 8px;
  background: rgba(255,255,255,.62); color: var(--ink);
  font-family: var(--mono); font-size: .86rem; font-weight: 700; text-transform: uppercase;
  cursor: pointer; display: grid; place-items: center;
}
.key:hover { background: rgba(255,255,255,.9); }
.key.wide { flex: 1.7; font-size: .68rem; }
.key.ok   { background: var(--ok);        color: #fff; }
.key.near { background: var(--near); color: #fff; }
.key.miss { background: var(--miss);      color: #fff; }

/* Panels ---------------------------------------------------------------- */
.panel {
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 16px; padding: 18px;
}
.panel + .panel { margin-top: 14px; }
.panel h2 { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.35rem; font-weight: 700; }
.stat span { font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }

.dist { display: grid; gap: 5px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.dist-row i {
  display: block; height: 18px; background: var(--miss); border-radius: 4px;
  min-width: 22px; text-align: right; padding: 0 6px; color: #fff;
  font-style: normal; font-size: .7rem; line-height: 18px;
}
.dist-row i.best { background: var(--ok); }

/* Buttons --------------------------------------------------------------- */
.btn {
  display: inline-block; padding: 12px 24px; border: 0; border-radius: var(--r-pill);
  background: var(--coral); color: #fff;
  font-family: inherit; font-weight: 700; font-size: .84rem; cursor: pointer;
}
.btn:hover { background: var(--coral-dk); text-decoration: none; }
.btn-ghost { background: rgba(255,255,255,.7); color: var(--ink); }
.btn-ghost:hover { background: #fff; }
.actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* Modal ----------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(29,59,48,.5); padding: 20px; overflow: auto; }
.modal.is-open { display: grid; place-items: center; }
.modal-card {
  background: var(--cream); border: 0; border-radius: var(--r-card);
  padding: 28px; width: min(460px, 100%); text-align: center;
}
.modal-card h2 { font-size: 1.4rem; text-transform: none; letter-spacing: -.02em; color: var(--ink); margin-bottom: .2em; }
.answer-reveal { font-size: 1.5rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--coral); margin: 6px 0 2px; }
.share-grid { font-size: 1rem; line-height: 1.15; letter-spacing: 2px; margin: 14px 0; }

/* Toast ----------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%);
  background: var(--ink); color: var(--cream);
  padding: 10px 18px; border-radius: var(--r-pill);
  font-size: .82rem; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .18s; z-index: 95;
}
.toast.show { opacity: 1; }

/* Prose ----------------------------------------------------------------- */
.prose { padding: 20px 0 34px; }
.prose h2 { margin-top: 1.7em; font-size: 1.1rem; text-transform: none; letter-spacing: -.01em; color: var(--ink); }
.prose p, .prose li { color: var(--ink-soft); font-size: .88rem; }
.prose strong { color: var(--ink); }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose code { background: rgba(255,255,255,.6); padding: 2px 6px; border-radius: 5px; font-size: .88em; }
.callout {
  background: rgba(255,255,255,.55); border: 0; border-left: 3px solid var(--coral);
  border-radius: 14px; padding: 15px 17px; margin: 1.4em 0;
}
.callout strong { display: block; margin-bottom: 4px; color: var(--ink); }
.callout p { margin: 0; font-size: .85rem; }

.example-row { display: flex; gap: 6px; margin: 10px 0; }
.example-row .cell { width: 38px; height: 38px; font-size: 1.1rem; }

/* Pixel scenery --------------------------------------------------------- */
.scene { display: block; width: 100%; margin-top: auto; }
.scene svg { display: block; width: 100%; height: auto; }

/* Ad slots -------------------------------------------------------------- */
.ad-slot { display: flex; flex-direction: column; align-items: center; margin: 0 auto; overflow: hidden; }
.ad-slot iframe { border: 0; display: block; }
.ad-slot::before {
  content: attr(data-ad-label); display: block; margin-bottom: 6px;
  font-size: .6rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--faint);
}
.ad-leaderboard { min-height: 106px; padding: 16px 0; }
.ad-rectangle   { min-height: 266px; }
.ad-native      { min-height: 200px; margin: 26px 0; }
.ad-endgame     { min-height: 266px; margin: 18px 0 4px; }

.ad-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; gap: 3px; padding: 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: 14px;
  background: rgba(255,255,255,.4);
  color: var(--faint); font-family: var(--mono); font-size: .7rem;
}
.ad-placeholder b { color: var(--muted); font-size: .78rem; }

/* Footer ---------------------------------------------------------------- */
.site-footer { border: 0; background: transparent; padding: 0 0 8px; margin-top: 0; }
.footer-inner {
  max-width: 1060px; margin: 0 auto; padding: 14px 28px 0;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: .76rem; color: var(--muted);
}
.footer-links { display: flex; gap: 15px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); }
.ad-disclosure { text-align: center; font-size: .74rem; color: var(--faint); padding: 0 28px 8px; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .game-wrap { grid-template-columns: 1fr; gap: 22px; }
  .sidebar { max-width: 470px; margin: 0 auto; width: 100%; }
  .features { grid-template-columns: 1fr; gap: 22px; }
}
/* Four nav links plus the coral CTA need ~780px. Below that the header wraps;
   the shell clips overflow for its rounded corners, so anything that does not
   fit would vanish silently rather than scroll. */
@media (max-width: 780px) {
  .header-inner { height: auto; flex-wrap: wrap; gap: 8px; padding-top: 14px; padding-bottom: 14px; }
  .nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .cta-pill { margin-left: auto; }
}
@media (max-width: 520px) {
  /* On the game page itself the CTA is redundant — the board is right there. */
  .cta-pill { display: none; }
}

@media (max-width: 460px) {
  body { padding: 10px; }
  .cell { width: 50px; height: 50px; font-size: 1.4rem; }
  .key { height: 44px; font-size: .8rem; }
  .ad-leaderboard { min-height: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Icons ------------------------------------------------------------------
   Pixel-grid icons rather than line work, to match the scenery. */
.icon-px { display: block; width: 28px; height: 28px; margin: 0 auto; color: var(--ink-soft); }
.feature .ico { display: flex; justify-content: center; }

/* Sister-site strip ------------------------------------------------------- */
.network { max-width: 1060px; margin: 0 auto; padding: 16px 28px 6px; }
.network-label {
  display: block; margin-bottom: 12px;
  font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .15em; color: var(--faint);
}
.network-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.network-links a {
  background: rgba(255,255,255,.5); border-radius: 12px; padding: 12px 14px;
  font-size: .82rem; font-weight: 700; color: var(--ink);
}
.network-links a span { display: block; font-weight: 400; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.network-links a:hover { text-decoration: none; background: rgba(255,255,255,.85); }
@media (max-width: 700px) { .network-links { grid-template-columns: 1fr 1fr; } }
