/* Shared styles for every game. Change something here and it changes in all games. */
:root {
  --bg: #fbf7ef;
  --card: #ffffff;
  --ink: #2b2b3a;
  --muted: #5d5d70;
  --line: #d9d2c3;
  --accent: #C2410C;      /* interface colour (buttons, headings, highlights): the website's orange */
  --accent-soft: #FFF4E6; /* pale orange behind highlighted spaces */
  --accent-ink: #ffffff;
  --double: #8fc3f0;
  --double-strong: #2f6fb0;
  --near: #ffc27a;
  --near-strong: #c06a10;
  --c1: #2f6fb0;          /* counter colour 1 (blue) */
  --c1-soft: #8fc3f0;
  --c2: #e07b1a;          /* counter colour 2 (orange) */
  --c2-soft: #ffc27a;
  --good: #2f8a57;
  --soft-good: #e3f4ea;
  --soft-warn: #fff2df;
  --pip: #2b2b3a;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Lexend", Verdana, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}
button { font-family: inherit; font-size: inherit; touch-action: manipulation; }  /* no double-tap zoom on tablets */
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
header.top h1 { font-size: 1.4rem; margin: 0; display: flex; align-items: center; gap: 10px; }
header.top h1 .num {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 1rem;
}
.menu-link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: .95rem; }
.menu-link:hover { text-decoration: underline; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Computer player picture ---------- */
.cpu-icon { width: 2em; height: 2em; object-fit: contain; vertical-align: middle; }
.cpu-icon.big { width: 72px; height: 72px; display: block; margin: 0 auto 2px; }

/* ---------- Buttons & cards ---------- */
.btn {
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: 10px 20px; cursor: pointer; font-weight: 600; min-height: 48px;
}
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible, .domino:focus-visible, .numbtn:focus-visible, .tap:focus-visible { outline: 4px solid #f2b705; outline-offset: 2px; }
.btn.ghost { background: var(--card); color: var(--accent); }
.btn.big { font-size: 1.25rem; padding: 14px 30px; min-height: 60px; }
.btn[disabled] { opacity: .45; cursor: default; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* ---------- Setup screen ---------- */
.setup h2 { margin-top: 0; }
.setup-grid { display: grid; gap: 16px; }
@media (min-width: 820px) { .setup-grid { grid-template-columns: 1fr 1fr; } }
.field { margin: 14px 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type=text] {
  font: inherit; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line);
  width: 100%; max-width: 320px;
}
.field input.missing { border-color: var(--near-strong); background: var(--soft-warn); }
.name-msg { color: var(--near-strong); font-weight: 600; margin: 6px 0 0; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice label {
  display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 14px; cursor: pointer; font-weight: 400; margin: 0;
}
.choice input { width: 22px; height: 22px; }
.voice-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.voice-row select {
  font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); min-height: 48px; flex: 1 1 200px; max-width: 100%;
}
.hint { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
.steps { padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding-left: 48px; margin: 12px 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
details.teacher { margin-top: 18px; border-top: 2px dashed var(--line); padding-top: 12px; }
details.teacher summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.teacher li { margin: 6px 0; font-size: .95rem; }

/* ---------- Action panel ---------- */
.panel { text-align: center; margin-bottom: 16px; min-height: 230px; }
.panel .who { font-weight: 700; font-size: 1.2rem; margin: 0 0 4px; }
.panel .msg { margin: 6px 0 12px; font-size: 1.15rem; }
.feedback { min-height: 1.6em; margin: 8px 0; font-weight: 600; }
.feedback.good { color: var(--good); }
.feedback.try { color: var(--near-strong); }
/* The line that always says, in writing, what to do next (so games work with the voice off). */
.next-step { font-weight: 600; margin: 10px 0 2px; min-height: 1.5em; }

/* ---------- Dice ---------- */
.dice-row { display: flex; justify-content: center; align-items: flex-start; gap: 22px; margin: 10px 0; flex-wrap: wrap; }
.die-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.die-label { min-height: 1.5em; font-weight: 700; font-size: 1.1rem; }
.die {
  width: 96px; height: 96px; border-radius: 18px; background: #fff; border: 3px solid var(--ink);
  padding: 12px; position: relative; box-shadow: 0 4px 0 rgba(0,0,0,.12);
}
.die.c1 { border-color: var(--c1); border-width: 5px; }
.die.c2 { border-color: var(--c2); border-width: 5px; }
.die.active { outline: 5px solid #f2b705; outline-offset: 3px; }
.die .cover {
  position: absolute; inset: -3px; border-radius: 18px; background: #e9e4f5;
  border: 3px solid #8a7fb8; display: grid; place-items: center; font-size: 2.2rem; color: #6b5fa0; font-weight: 700;
}
.rolling { animation: shake .12s linear infinite; }
@keyframes shake { 0% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } 100% { transform: rotate(-6deg); } }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; }
.pips span { display: grid; place-items: center; }
.pips span.on::after { content: ""; width: 70%; height: 70%; border-radius: 50%; background: var(--pip); }

/* ---------- Number buttons ---------- */
.numrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0; }
.numbtn {
  width: 64px; height: 64px; border-radius: 16px; border: 3px solid var(--accent); background: #fff;
  color: var(--ink); font-size: 1.6rem; font-weight: 700; cursor: pointer;
}
.numbtn:hover { background: var(--accent-soft); }
.numbtn.show-me { background: #fff6cc; border-color: #f2b705; animation: pulse 1s ease-in-out infinite; }
.numbtn.wrong { opacity: .35; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.factcard {
  display: inline-block; background: var(--soft-good); border: 2px solid var(--good); border-radius: 16px;
  padding: 14px 20px; font-size: 1.3rem; font-weight: 600; margin: 8px 0;
}
.factcard.double { background: #e6f2fc; border-color: var(--double-strong); }
.factcard.near { background: #fff1de; border-color: var(--near-strong); }

/* ---------- Boards ---------- */
.boards { display: grid; gap: 16px; }
@media (min-width: 760px) { .boards.two { grid-template-columns: 1fr 1fr; } }
.board { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
.board.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,.18); }
.board h3 { margin: 0 0 4px; font-size: 1.1rem; display: flex; justify-content: space-between; gap: 8px; }
.board h3 small { font-weight: 400; color: var(--muted); font-size: .9rem; }

/* ---------- Dominoes ---------- */
.grid9 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.domino {
  display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; width: 100%;
  background: #fff; border: 3px solid #9b9384; border-radius: 14px; padding: 0; cursor: default;
  overflow: hidden; position: relative;
}
.domino .half { padding: 10%; display: flex; }
.domino .half + .half { border-left: 3px solid #9b9384; }
.domino.empty { border-style: dashed; background: #faf8f3; }
.domino.target { cursor: pointer; border-color: var(--accent); border-style: solid; background: var(--accent-soft); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px rgba(194,65,12,.25); } }
.domino.filled { border-color: var(--ink); }
.domino.filled .half + .half { border-left-color: var(--ink); }
.domino.pickable { cursor: pointer; }
.domino.pickable:hover { transform: translateY(-2px); }
.domino.col-double { background: var(--double); }
.domino.col-near { background: var(--near); }
.domino.nope { animation: nope .35s; }
@keyframes nope { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.domino.new { box-shadow: 0 0 0 4px #f2b705; }

.crayon { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; }
.crayon .swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(0,0,0,.3); }

/* ---------- Results ---------- */
.results table { margin: 10px auto; border-collapse: collapse; }
.results td, .results th { padding: 6px 14px; border-bottom: 1px solid var(--line); }
.results .winner { font-size: 1.5rem; font-weight: 700; margin: 6px 0 10px; }
.facts-list { list-style: none; padding: 0; margin: 8px auto; display: inline-block; text-align: left; }
.facts-list li { margin: 4px 0; }
.key { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: .95rem; color: var(--muted); margin-top: 10px; }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 18px; height: 18px; border-radius: 4px; display: inline-block; border: 2px solid rgba(0,0,0,.25); }

@media (prefers-reduced-motion: reduce) {
  .rolling, .numbtn.show-me, .domino.target { animation: none; }
}
@media (max-width: 480px) {
  body { font-size: 17px; }
  .die { width: 80px; height: 80px; padding: 10px; }
  .numbtn { width: 54px; height: 54px; font-size: 1.4rem; }
  .grid9 { gap: 8px; }
  .domino { border-width: 2px; border-radius: 10px; }
}
