/* Times Table Archery: a village archery field. Grass-green page, a wooden
   chalkboard holding the sum, and Andika (made for early readers) for words. */

:root {
  --field: #20462f;
  --field-deep: #173523;
  --board: #22332b;
  --frame: #b07a3e;
  --chalk: #f7f4e8;
  --chalk-soft: #c9d6c8;
  --gold: #f5c242;
  --red: #ff7a64;
  --text: #f2f6ee;
  --text-soft: #bcd0bf;

  --display: "Fredoka", "Arial Rounded MT Bold", sans-serif;
  --body: "Andika", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--field);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--body);
}

.range {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(0.75rem, 2.5vw, 1.75rem) clamp(1rem, 3vw, 2rem) 2.5rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1rem;
}
.back { color: var(--text-soft); font-weight: 700; text-underline-offset: 3px; }
.back:hover { color: var(--text); }
h1 {
  margin: 0;
  flex: 1;
  font: 700 clamp(1.6rem, 3.6vw, 2.4rem)/1.1 var(--display);
  color: var(--gold);
}

.tables { display: flex; gap: 0.35rem; padding: 0.3rem; border-radius: 999px; background: var(--field-deep); }
.tables button {
  font: 600 0.95rem/1 var(--display);
  padding: 0.55rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.tables button[aria-pressed="true"] { background: var(--gold); color: #2a2208; }
.tables button:hover:not([aria-pressed="true"]) { color: var(--text); }

/* the chalkboard sits on top of the range like a sign above the shooting line */
.stage { border-radius: 1rem; overflow: hidden; box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35); }

.chalkboard {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: 0.8rem 1.4rem 0.9rem;
  background: var(--board);
  border-bottom: 0.45rem solid var(--frame);
  font-family: var(--display);
}
.goal { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; color: var(--chalk-soft); }
.goal span { color: var(--chalk); font-size: 1.35em; font-weight: 700; }
.sum { margin: 0; font-size: clamp(1.8rem, 4.2vw, 2.8rem); font-weight: 700; color: var(--chalk); letter-spacing: 0.02em; }
.sum.right { color: var(--gold); }
.sum.wrong { color: var(--red); }

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  touch-action: none;
  cursor: crosshair;
  background: #a6d2e4;
}
canvas:focus-visible { outline: 4px solid var(--gold); outline-offset: -4px; }

.below {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 1.1rem;
}
.hint { flex: 1 1 22rem; min-height: 3.1em; margin: 0; font-size: 1.15rem; font-weight: 700; }

.round { display: flex; align-items: center; gap: 1rem; }
.progress {
  display: grid;
  grid-template-columns: repeat(10, 2.1rem);
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.progress li {
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 0.5rem;
  background: var(--field-deep);
  color: var(--gold);
  font-size: 0.55rem;
  letter-spacing: -0.05em;
}
.progress li.now { box-shadow: inset 0 0 0 2px var(--gold); }
.progress li.done { background: #2d5a3c; }

.again {
  font: 600 1rem/1 var(--display);
  padding: 0.75rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: #2a2208;
  cursor: pointer;
}
.again:hover { background: #ffd15e; }
.again:focus-visible,
.tables button:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; }

.keys { max-width: 46rem; margin: 1.5rem 0 0; font-size: 0.95rem; color: var(--text-soft); }

@media (max-width: 760px) {
  canvas { aspect-ratio: 1 / 1; }
  .round { width: 100%; flex-wrap: wrap; }
  .progress { grid-template-columns: repeat(10, 1fr); width: 100%; }
}
