/* Operands: Operators' sister, so the same pocket-calculator keys, on the
   site's paper. Light and dark follow the device through theme.css, which
   this only adds to. */

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

/* The page itself, or dark mode puts light ink on the browser's white. */
body {
  margin: 0;
  background: var(--bg, #f6f3ec);
  color: var(--ink, #2b2a33);
  font: 17px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.operands {
  --key: #f2efe8;
  --key-edge: #bdb8ac;
  --key-ink: #24211c;
  --slot: #ffffff;
  --pick: #c07a2c;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 16px 3rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .operands {
    --key: #35322d;
    --key-edge: #141312;
    --key-ink: #ece7dc;
    --slot: #1f1e24;
    --pick: #ffb53d;
  }
}

:root[data-theme="dark"] .operands {
  --key: #35322d;
  --key-edge: #141312;
  --key-ink: #ece7dc;
  --slot: #1f1e24;
  --pick: #ffb53d;
}

.masthead { text-align: center; margin: 1.5rem 0 1rem; }
.masthead h1 { margin: 0; letter-spacing: 0.04em; }
.tagline { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.95rem; }
h2 { text-align: center; font-size: 1.05rem; font-weight: 600; }
.fine { color: var(--muted); font-size: 0.9rem; text-align: center; }

button {
  font: inherit;
  min-height: 44px;
  padding: 0.4rem 1rem;
  background: var(--key);
  color: var(--key-ink);
  border: 1px solid var(--key-edge);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--key-edge);
  cursor: pointer;
}
button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
button:disabled { opacity: 0.35; cursor: default; }
button.quiet { background: transparent; box-shadow: none; }
button.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- picking a difficulty ---------- */

.bands { display: grid; gap: 0.6rem; margin: 1rem 0; }
@media (min-width: 24rem) { .bands { grid-template-columns: repeat(3, 1fr); } }
.band { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 0.6rem; }
.band-name { font-weight: 700; font-size: 1.1rem; }
.band-note { font-size: 0.85rem; opacity: 0.75; }

.my-times { margin-top: 1.5rem; text-align: center; }
.my-times table { margin: 0 auto 0.8rem; border-collapse: collapse; }
.my-times th, .my-times td { padding: 0.25rem 0.7rem; text-align: right; }
.my-times thead th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.my-times tbody th { text-align: left; text-transform: capitalize; }

/* ---------- play ---------- */

.status { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; font-weight: 600; margin: 0.5rem 0 1.5rem; }
.elapsed { font-variant-numeric: tabular-nums; }
.elapsed.low { color: var(--pick); font-weight: 700; }

.sum {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.15rem;
  font-size: 1.5rem;
  font-weight: 700;
}
.sum .op { padding: 0 0.15rem; }
.sum .eq { margin-left: 0.3rem; white-space: nowrap; }
.sum .paren { font-weight: 400; font-size: 1.9rem; color: var(--muted); }

.box {
  width: 2.6rem;
  height: 3.2rem;
  padding: 0;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--slot);
  box-shadow: none;
  border: 2px solid var(--key-edge);
}
.box.empty { border-style: dashed; }
.box.selected { border: 3px solid var(--pick); }

.result { text-align: center; font-size: 1.15rem; font-weight: 600; min-height: 1.8rem; margin: 0.8rem 0 1rem; }
.result.good { color: var(--good); }
.result.off { color: var(--short); }

.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 0.5rem 0 1.5rem; }
.digit { width: 3.4rem; height: 3.4rem; font-size: 1.6rem; font-weight: 700; padding: 0; }

.controls, .again { display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; }

/* ---------- the run is over ---------- */

.over-score { text-align: center; font-size: 1.2rem; font-weight: 700; }
.review { padding-left: 1.6rem; }
.review li { margin: 0.3rem 0; }
.review .worked { font-weight: 600; }
.review .how { color: var(--muted); font-size: 0.9rem; }
.review li.shown .worked { color: var(--short); }

/* ---------- a saved run, and your list of them ---------- */

.who { text-align: center; margin: 0 0 0.4rem; }
.again a.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  background: var(--key);
  color: var(--key-ink);
  border: 1px solid var(--key-edge);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--key-edge);
  text-decoration: none;
}
.again a.button.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.saved-results { list-style: none; padding: 0; }
.saved-results li { padding: 0.6rem 0; border-bottom: 1px solid var(--key-edge); }
.saved-results a { color: var(--accent); font-weight: 600; }
.saved-results .actions { display: inline-flex; gap: 0.4rem; margin-left: 0.4rem; }
.saved-results .actions button { min-height: 36px; padding: 0.2rem 0.7rem; font-size: 0.9rem; }
#saved a, #unanswered a { color: var(--accent); overflow-wrap: anywhere; }

/* ---------- Operands Online (mg #722): as Operators Online's, in this file's tokens ---------- */

/* Online seats: six inks, readable on the page in light and dark, as Operators'. */
.operands {
  --seat0: #c0621f;
  --seat1: #2a6fb0;
  --seat2: #3c8a3a;
  --seat3: #a23f8f;
  --seat4: #1f8a8a;
  --seat5: #8a6d1c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .operands {
    --seat0: #ffb53d;
    --seat1: #7fb6ff;
    --seat2: #8fd67f;
    --seat3: #f08fd9;
    --seat4: #5fd6d2;
    --seat5: #e8d36a;
  }
}
:root[data-theme="dark"] .operands {
  --seat0: #ffb53d;
  --seat1: #7fb6ff;
  --seat2: #8fd67f;
  --seat3: #f08fd9;
  --seat4: #5fd6d2;
  --seat5: #e8d36a;
}


.online-pick { margin-top: 2rem; padding-top: 0.6rem; border-top: 1px solid var(--key-edge); }
.online-pick h3 { font-size: 0.95rem; text-align: center; margin: 1.2rem 0 0.4rem; }
p.online-pick { text-align: center; }
.online-pick a { color: var(--accent); }
.online-chat { display: block; text-align: center; margin: 0.6rem 0; font-size: 0.92rem; }
.again button:disabled { opacity: 0.5; cursor: default; }

.waiting-tables { list-style: none; padding: 0; margin: 0; }
.waiting-tables li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.8rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--key-edge);
}
.waiting-who { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.waiting-band, .waiting-count { font-size: 0.88rem; opacity: 0.8; }
.waiting-tables a.button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
  background: var(--key); color: var(--key-ink); border: 1px solid var(--key-edge);
  border-radius: 8px; text-decoration: none;
}

.online-share { text-align: center; font-size: 0.92rem; }
.online-share a { color: var(--accent); overflow-wrap: anywhere; margin-right: 0.4rem; }
.online-share button {
  min-height: 44px; padding: 0 1rem; font: inherit;
  background: var(--key); color: var(--key-ink); border: 1px solid var(--key-edge); border-radius: 8px; cursor: pointer;
}

/* The seats while waiting, and everyone's progress (the strip, above the
   board and on the online screen). Each row carries its seat's ink in
   --seat-ink. */
.online-seats, .strip { list-style: none; padding: 0; margin: 0.8rem 0; }
.waiting-seat {
  padding: 0.35rem 0.6rem;
  border-left: 4px solid var(--seat-ink);
  margin: 0.3rem 0;
}
.waiting-seat .PlayerName { color: var(--seat-ink); font-weight: 600; }
.waiting-seat.mine, .strip li.mine, .online-seats li.mine { background: color-mix(in srgb, var(--seat-ink) 10%, transparent); }

.strip li, .online-seats li:not(.waiting-seat) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 3.5rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.88rem;
}
.strip-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--seat-ink); font-weight: 600; }
.cells { display: inline-flex; gap: 2px; }
.cell {
  width: 0.8rem;
  height: 0.8rem;
  border: 1.5px solid var(--seat-ink);
  border-radius: 2px;
  box-sizing: border-box;
  position: relative;
}
.cell.solved { background: var(--seat-ink); }
.cell.missed { opacity: 0.8; }
.cell.missed::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(45deg, transparent 44%, var(--seat-ink) 44% 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--seat-ink) 44% 56%, transparent 56%);
}
.cell.open { animation: open-cell 1.2s ease-in-out infinite; }
.cell.todo { opacity: 0.25; }
@keyframes open-cell { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .cell.open { animation: none; border-style: dashed; } }
.strip-points { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 26rem) {
  .cell { width: 0.6rem; height: 0.6rem; }
  .strip li, .online-seats li:not(.waiting-seat) { grid-template-columns: minmax(0, 1fr) auto 3rem; gap: 0.3rem; }
}

.countdown {
  text-align: center;
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 1rem 0;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.results-wrap { overflow-x: auto; }
.online-results { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.online-results th, .online-results td { padding: 0.4rem 0.4rem; border-bottom: 1px solid var(--key-edge); text-align: left; }
.online-results th { font-size: 0.8rem; font-weight: 600; opacity: 0.75; }
.online-results .num { text-align: right; }
.online-results .total { font-weight: 700; }
.online-results .who { color: var(--seat-ink); font-weight: 600; }
.online-results .place small { opacity: 0.7; }
.online-results tr.mine { background: color-mix(in srgb, var(--seat-ink) 10%, transparent); }
.online-results a { color: var(--accent); }

/* ---------- chat (mg #528), drawn by /js/chat.js; as Operators', in this file's tokens ---------- */

.chat-box { margin-top: 1.5rem; padding: 0.75rem 0 1rem; border-top: 1px solid var(--key-edge); }
.chat-line { margin: 0; color: var(--muted); }
.chat-head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.5rem; }
.chat-head button {
  min-height: 36px; padding: 0 0.8rem; font: inherit;
  background: var(--key); color: var(--key-ink); border: 1px solid var(--key-edge); border-radius: 8px; cursor: pointer;
}
.chat-badge { color: var(--accent); }
.chat-people { margin: 0 0 0.5rem; color: var(--muted); }
.chat-log {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.6rem;
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
}
.chat-log li { margin: 0.15rem 0; overflow-wrap: anywhere; }
.chat-log time { color: var(--muted); font-size: 0.85rem; }
.chat-chip, .chat-more {
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.3rem;
}
.chat-chip { text-decoration: underline dotted; }
.chat-more { color: var(--muted); }
.chat-more:hover, .chat-more:focus { color: inherit; }
.chat-act, .chat-notice {
  margin: 0.6rem 0 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
}
.chat-act { border-color: var(--accent); }
.chat-act p, .chat-notice p { margin: 0 0 0.4rem; overflow-wrap: anywhere; }
.chat-act input[type="text"] { width: calc(100% - 0.4rem); margin: 0; font-family: inherit; font-size: 1rem; }
.chat-act .again, .chat-notice .again { justify-content: flex-start; margin-top: 0.5rem; }
.chat-say { display: flex; gap: 0.5rem; margin-top: 0.6rem; align-items: stretch; }
.chat-say input { flex: 1; min-width: 0; width: auto; margin: 0; font-family: inherit; font-size: 1rem; padding: 0 0.5rem; }
.chat-say button {
  min-height: 44px; padding: 0 1rem; font: inherit; font-weight: 600;
  background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 8px; cursor: pointer;
}
.chat-box .msg { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--muted); }
