/* Shared between the table screen and the phones: the palette, and the board. */

:root {
  --ink: #14161b;
  --panel: #1c2027;
  --panel-2: #232830;
  --line: #333a45;
  --paper: #efe7d7;
  --paper-sq: #e7dfcb;
  --paper-line: #cdc3ab;
  --slate: #2c323d;
  --slate-2: #394252;
  --text: #f2ede2;
  --text-dim: #a9a294;
  --rose: #e3aca8;
  --amber: #f3d6ac;
  --sage: #bcd6ba;
  --purple: #cec2e6;
  --villain: #d8503f;
  --sleuth: #37a39d;
  --gold: #e3b341;
  --sq: 44px;
  --gap: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .serif { font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif; font-weight: 600; }

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

.board {
  display: grid;
  grid-template-columns: repeat(11, var(--sq));
  grid-auto-rows: var(--sq);
  gap: var(--gap);
  padding: calc(var(--sq) * 0.22);
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.sq {
  position: relative;
  background: var(--paper-sq);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: calc(var(--sq) * 0.42);
  color: #2a2620;
  overflow: hidden;
  transition: background 120ms ease, transform 120ms ease;
}

.sq.district { border: 2px dashed rgba(60, 50, 40, 0.55); }
.sq.district.rose { background: var(--rose); }
.sq.district.amber { background: var(--amber); }
.sq.district.sage { background: var(--sage); }
.sq.start { background: var(--purple); border: 2px solid rgba(60, 50, 40, 0.6); }

.sq .dname {
  font-family: Georgia, serif;
  font-size: calc(var(--sq) * 0.19);
  line-height: 1.05;
  text-align: center;
  padding: 1px;
  color: #3a332a;
  opacity: 0.95;
}

/* A tile nobody has read yet: dark slate, and it stays dark. A district square
   or the middle square is a more specific selector, so name those too — a tile
   covering Greenlawn must look like a tile, not like Greenlawn. */
.sq.facedown, .sq.district.facedown, .sq.start.facedown {
  background: linear-gradient(160deg, var(--slate-2), var(--slate));
  border: none;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.sq.facedown .back {
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 3px, transparent 3px 6px);
}

/* A tile the detectives have earned. */
.sq.faceup, .sq.district.faceup, .sq.start.faceup {
  background: linear-gradient(170deg, #fbf5e7, #efe4cb);
  box-shadow: inset 0 -2px 0 rgba(120, 100, 70, 0.35), 0 1px 3px rgba(0, 0, 0, 0.35);
  border: none;
}

.sq.pending, .sq.district.pending, .sq.start.pending {
  background: linear-gradient(170deg, #fff6d8, #f2e3ae);
  box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0, 0, 0, 0.4);
  border: none;
}

.sq .letter {
  font-family: Georgia, serif;
  font-weight: 700;
  color: #241f18;
  line-height: 1;
}
.sq.facedown .letter { color: #e8e2d4; }

.sq .icon {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: calc(var(--sq) * 0.24);
  line-height: 1;
  opacity: 0.9;
}

.sq .blankmark {
  position: absolute;
  bottom: 1px;
  left: 2px;
  font-size: calc(var(--sq) * 0.17);
  color: #7a6a4a;
}

/* The round token: a number and an arrow, sitting on the first letter. */
.sq .token {
  position: absolute;
  top: 1px;
  left: 1px;
  min-width: calc(var(--sq) * 0.34);
  padding: 0 2px;
  border-radius: 4px;
  background: var(--villain);
  color: #fff;
  font-size: calc(var(--sq) * 0.24);
  font-weight: 700;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.sq .token i { font-style: normal; opacity: 0.85; }

/* The clue sheet the detectives are working on, lit up on the board. */
.sq.focus { outline: 3px solid var(--sleuth); outline-offset: -1px; z-index: 2; }
.sq.focus::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(55, 163, 157, 0.18);
}

.board.tappable .sq.open:active { transform: scale(0.94); }

/* ---------- small shared pieces ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-dim);
}

.mark { display: inline-grid; place-items: center; width: 1.6em; height: 1.9em; font-family: Georgia, serif; font-weight: 700; }
.mark.exact { border: 2px solid var(--sleuth); border-radius: 4px; color: var(--text); }
.mark.present { border-bottom: 3px solid var(--gold); color: var(--text); }
.mark.miss { color: var(--text-dim); opacity: 0.6; }

.compass { width: 100%; height: 100%; color: var(--text-dim); }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--sleuth); border-color: transparent; color: #04201f; font-weight: 700; }
button.villain { background: var(--villain); border-color: transparent; color: #240705; font-weight: 700; }
