/* Sprout — page chrome only.
 *
 * Everything inside the pot is drawn on a canvas by game.js; this file styles
 * the frame around it. The palette is the one the old placeholder page used,
 * so the site still looks like itself.
 */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --fg: #1a1a18;
  --muted: #6b6b66;
  --rule: #e2e2dd;
  --panel: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 30px rgba(0, 0, 0, .10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --fg: #f0efe9;
    --muted: #8f8f86;
    --rule: #2c2c26;
    --panel: #1d1d17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 30px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* svh, not vh: on mobile Safari `vh` is the *largest* viewport height, so a
     100vh layout sits partly underneath the address bar until you scroll. */
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* The board handles its own pointer gestures; this stops a stray drag on the
     chrome from rubber-banding the page on iOS. */
  overscroll-behavior: none;
}

/* ----------------------------------------------------------------- bars --- */

.bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem clamp(.75rem, 3vw, 1.5rem);
  padding-top: max(.75rem, env(safe-area-inset-top));
}

.bar-foot {
  padding-top: .5rem;
  padding-bottom: max(.75rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
}

.brand { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }

.brand-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.brand-host {
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: lowercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------------------------------------- readouts --- */

.readouts { display: flex; align-items: center; gap: clamp(.75rem, 3vw, 1.5rem); }

.readout { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }

.readout-label {
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout-value {
  font-size: 1.1rem;
  font-weight: 600;
  /* Tabular figures stop the score jittering sideways as digits change. */
  font-variant-numeric: tabular-nums;
}

.readout-next { align-items: center; gap: .15rem; }
#next { display: block; width: 22px; height: 22px; }

/* ---------------------------------------------------------------- board --- */

.stage {
  flex: 1;
  /* Without min-height:0 a flex child refuses to shrink below its content, and
     the board pushes the footer off the bottom of short screens. */
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 clamp(.5rem, 2vw, 1rem) .5rem;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  /* The canvas fills whatever box it gets and letterboxes the world itself, so
     an odd aspect ratio never stretches the pot. */
  touch-action: none;
  cursor: pointer;
}

/* -------------------------------------------------------------- overlay --- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(3px);
  animation: fade .25s ease both;
}

.overlay[hidden] { display: none; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.panel {
  text-align: center;
  padding: 1.75rem 2.25rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-kicker {
  margin: 0;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-score {
  margin: .35rem 0 0;
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.panel-note { margin: 0 0 1.25rem; font-size: .8rem; color: var(--muted); }

.button {
  font: inherit;
  font-weight: 500;
  padding: .55rem 1.4rem;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}

.button:hover { opacity: .85; }
.button:active { transform: translateY(1px); }

.panel-hint { margin: .75rem 0 0; font-size: .7rem; color: var(--muted); }

/* ----------------------------------------------------------------- foot --- */

.hint { margin: 0; font-size: .75rem; color: var(--muted); }
.hint-touch { display: none; }

/* Coarse pointer means a finger: the keyboard hint is noise there. */
@media (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}

kbd {
  font: inherit;
  font-size: .95em;
  padding: 0 .3em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--fg);
}

.sound {
  flex: none;
  font: inherit;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sound[aria-pressed="true"] { color: var(--fg); border-color: currentColor; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.noscript {
  position: absolute;
  inset: auto 0 4rem;
  text-align: center;
  padding: 0 1rem;
  color: var(--muted);
  font-size: .85rem;
}

/* Small screens: the board is the point, so the chrome gives up space first. */
@media (max-height: 620px) {
  .bar { padding-top: .5rem; padding-bottom: .5rem; }
  .hint { font-size: .7rem; }
}
