/* The play surface. Three regions: the pool at the top where balls surface, the
   board, and the ofuda tray. */

.stage {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 4rem;
}

/* --- header ------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  border-bottom: var(--rule);
  padding-bottom: 0.7rem;
}

.masthead h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.masthead .mark {
  font-size: 1.5rem;
  color: var(--vermilion);
}

.masthead .spacer {
  flex: 1;
}

.seed-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.seed-field input {
  width: 8.5rem;
  padding: 0.22rem 0.4rem;
  border: var(--rule);
  background: var(--paper-warm);
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--ink);
}

.seed-field button {
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--ink-soft);
  background: transparent;
  font-size: 0.78rem;
}

/* --- the ledger --------------------------------------------------------- */

.ledger {
  display: flex;
  gap: 1.6rem;
  padding: 0.9rem 0;
  font-size: 0.82rem;
}

.ledger div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ledger dt {
  color: var(--ink-faint);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ledger dd {
  margin: 0;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.ledger .ante dd {
  color: var(--vermilion);
}

/* --- the black pool ----------------------------------------------------- */

.pool {
  position: relative;
  min-height: 72px;
  margin: 0.4rem 0 1.2rem;
  padding: 0.7rem 0.8rem;
  background: var(--pool);
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 0.42rem;
}

.pool.idle {
  /* Still water: no balls yet, so the surface just sits there. */
  background-image: linear-gradient(180deg, rgba(242, 235, 221, 0.05), transparent 60%);
}

.pool .hint {
  color: rgba(242, 235, 221, 0.4);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

/* A drawn ball. Surfaces from below, so the eye catches the order. */
.ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  background: rgba(242, 235, 221, 0.14);
  color: rgba(242, 235, 221, 0.68);
  animation: surface 320ms ease-out both;
}

.ball.hit {
  background: var(--vermilion);
  color: var(--paper);
}

@keyframes surface {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.86);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}

.cell {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--serif);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 0;
}

/* A face with no copies left. Blank paper, which is why the full 80 cell grid
   survives a 30 face bag: most of the board is simply unwritten. */
.cell.dead {
  color: rgba(26, 22, 19, 0.13);
  cursor: default;
}

.cell.live {
  background: var(--paper-warm);
  border-color: rgba(26, 22, 19, 0.16);
  box-shadow: var(--shadow-paper);
}

/* Copies read as ink density, so a cultivated face is visibly heavier. */
.cell.c2 {
  background: var(--paper-deep);
}
.cell.c3 {
  background: #cfc2a6;
}
.cell.c4 {
  background: #bdae8e;
}

.cell .copies {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 0.56rem;
  color: var(--ink-soft);
}

.cell.spotted {
  border-color: var(--vermilion);
  box-shadow: inset 0 0 0 1px var(--vermilion);
}

/* A hit blooms: wet ink spreading into the fibre. */
.cell.hit {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: var(--paper);
  animation: bloom 260ms ease-out both;
}

/* A miss dries to grey. A spotted face that no ball reached. */
.cell.dry {
  background: transparent;
  border-color: rgba(26, 22, 19, 0.2);
  color: var(--ink-faint);
}

/* Returned by the tide between rounds. */
.cell.tided {
  animation: wash 520ms ease-out both;
}

.cell.targetable {
  border-color: var(--ink);
  border-style: dashed;
}

.cell.targeted {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

@keyframes bloom {
  from {
    transform: scale(0.8);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes wash {
  from {
    background: rgba(184, 55, 43, 0.22);
  }
}

/* --- the tray ----------------------------------------------------------- */

.tray {
  margin-top: 1.3rem;
  min-height: 150px;
}

.prompt {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.prompt .spacer {
  flex: 1;
}

.act {
  padding: 0.44rem 1.3rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
}

.act:disabled {
  background: transparent;
  border-color: rgba(26, 22, 19, 0.2);
  color: var(--ink-faint);
}

.act.ghost {
  background: transparent;
  color: var(--ink);
}

.ofuda-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

/* A talisman: a tall slip of paper with a vermilion band at the head. */
.ofuda {
  position: relative;
  text-align: left;
  padding: 0.75rem 0.8rem 0.9rem;
  border: 1px solid rgba(26, 22, 19, 0.22);
  border-top: 3px solid var(--vermilion);
  background: var(--paper-warm);
  box-shadow: var(--shadow-paper);
}

.ofuda:hover:not(:disabled) {
  background: var(--paper-deep);
}

.ofuda.chosen {
  border-color: var(--ink);
  background: var(--paper-deep);
}

.ofuda h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.ofuda .flavor {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-faint);
}

.ofuda .effect {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.ofuda .need {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--vermilion);
}

/* --- notes and the end of a run ---------------------------------------- */

.note {
  margin-top: 0.7rem;
  min-height: 1.2rem;
  font-size: 0.8rem;
  color: var(--vermilion);
}

.verdict {
  margin-top: 1.1rem;
  padding: 1.1rem 1.2rem;
  border: var(--rule);
  border-left: 3px solid var(--ink);
  background: var(--paper-warm);
}

.verdict h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.verdict p {
  margin: 0.25rem 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.verdict .depth {
  font-size: 2.4rem;
  font-variant-numeric: tabular-nums;
  color: var(--vermilion);
}

.verdict .actions {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.6rem;
}

/* --- the record --------------------------------------------------------- */

.record {
  margin-top: 1.6rem;
  border-top: var(--rule);
  padding-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.record h2 {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.record ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.record li {
  display: flex;
  gap: 0.8rem;
  padding: 0.22rem 0;
  border-bottom: 1px dotted rgba(26, 22, 19, 0.12);
  font-variant-numeric: tabular-nums;
}

.record li .round {
  width: 2.4rem;
  color: var(--ink-faint);
}

.record li .tally {
  width: 5rem;
}

.record li.failed .tally {
  color: var(--vermilion);
}

.record li .took {
  color: var(--ink-faint);
}
