/* ==========================================================================
   Kings in the Corner - "Odds: What a Seven-Card Hand Usually Contains"
   Loaded only by /odds/, after styles.css, pages.css and rules.css.

   A restrained card-room statistics sheet: numbers on pale cream with thin
   charcoal rules, and the card figures on flat felt. No gradients, no chart
   colours, no tiles - a figure is either a table or real cards.

   1. Tokens
   2. Probability sheet (tables)
   3. Figure shell
   4. King distribution - stacked card edges
   5. Connected runs
   6. Colour balance strip
   7. Opening layout
   8. Draw calculation
   9. Responsive
  10. Print
   ========================================================================== */

/* ------------------------------ 1. Tokens ------------------------------- */
.oddspage {
  --o-sheet:   #F7F3E9;   /* the statistics sheet */
  --o-rule:    #C6BCA4;   /* thin charcoal-warm rules */
  --o-rule-2:  #4A4534;
  --o-ink:     #26251E;
  --o-ink-2:   #56503F;
  --o-gold:    #7A6021;   /* the one highlighted value */
  --o-felt:    #0C2E1E;
  --o-felt-2:  #123D28;
}

/* -------------------------- 2. Probability sheet ------------------------ */
.osheet { overflow-x: auto; margin: 20px 0 24px; }
.otab {
  width: 100%;
  border-collapse: collapse;
  background: var(--o-sheet);
  font-size: 15px;
}
.otab caption {
  padding: 12px 16px 10px;
  background: var(--o-sheet);
  border-bottom: 2px solid var(--o-rule-2);
  text-align: left;
  font-family: var(--serif); font-size: 17px; color: var(--o-ink);
}
.otab thead th {
  padding: 8px 16px;
  border-bottom: 1px solid var(--o-rule-2);
  text-align: left;
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--o-ink-2);
}
.otab thead th.num, .otab td.num, .otab tbody th.num { text-align: right; }
.otab th, .otab td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--o-rule);
  text-align: left; vertical-align: baseline;
}
.otab tbody th { font-weight: 400; color: var(--o-ink); }
.otab tbody tr:last-child th,
.otab tbody tr:last-child td { border-bottom: 0; }
/* the numbers are the point of the page, so they are set large and lined up */
.otab td.num {
  font-family: var(--serif);
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--o-ink);
  white-space: nowrap;
}
.otab td.num--sm { font-size: 17px; }

/* --------------------------- 3. Figure shell ---------------------------- */
.ofig {
  --cw: 44px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  margin: 20px 0 24px;
  padding: 16px 18px 14px;
  background: var(--o-felt);
  border: 1px solid var(--o-felt-2);
  border-radius: 10px;
}
.ofig__h {
  margin: 0 0 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--gold-light);
}
.ofig__cap { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: #D7E7DE; }
.ofig .card { box-shadow: 0 6px 14px rgba(0, 0, 0, .38); }

/* ------------------- 4. King distribution: card edges ------------------- */
.kdist {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.kdist__col { display: grid; justify-items: center; gap: 8px; }
/* a stack of card edges, seen side on: one edge for each whole per cent */
.kdist__stack {
  display: flex; flex-direction: column-reverse; gap: 1px;
  width: 100%; max-width: 74px;
}
.kdist__stack i {
  display: block; height: 3px;
  background: #EDE7D8;
  box-shadow: 0 0 0 .5px rgba(12, 46, 30, .55);
}
.kdist__pct {
  margin: 0;
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: #FFFFFF;
}
.kdist__label { margin: 0; font-size: 12px; color: #C9DFD4; text-align: center; }

/* ------------------------- 5. Connected runs ---------------------------- */
.runs { display: grid; gap: 12px; }
.runrow {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(214, 236, 224, .18);
}
.runrow:last-child { border-bottom: 0; padding-bottom: 0; }
.runrow__len {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gold-light);
}
.runrow__cards { display: flex; gap: 5px; flex-wrap: wrap; }
.runrow__pct {
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: #FFFFFF; white-space: nowrap;
}

/* -------------------------- 6. Colour balance --------------------------- */
.splits { display: grid; gap: 12px; }
.splitrow {
  display: grid; grid-template-columns: 96px minmax(0, 1fr);
  align-items: center; gap: 14px;
}
.splitrow__label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gold-light);
}
.splitrow__strip { display: flex; gap: 5px; flex-wrap: wrap; }

/* --------------------------- 7. Opening layout -------------------------- */
.openpair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.opencell {
  display: grid; gap: 10px; justify-items: center; align-content: start;
  padding: 12px;
  border: 1px solid rgba(214, 236, 224, .22);
  border-radius: 8px;
}
.opencell__h {
  margin: 0;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.opencross {
  --cw: 38px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  display: grid; grid-template-columns: repeat(3, auto); gap: 5px;
  justify-items: center; align-items: center;
}
.opencross__gap { width: var(--cw); height: var(--ch); }
.opencross__corner {
  display: grid; place-items: center;
  width: var(--cw); height: var(--ch);
  border: 1.5px dashed rgba(214, 236, 224, .45);
  border-radius: var(--cr);
  color: #BFD9CC; font-size: 10px;
}
.opencross__stock { position: relative; width: var(--cw); height: var(--ch); }
.opencross__stock i {
  position: absolute; inset: 0; border-radius: var(--cr);
  background: #24407F; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .45);
}
.opencross__stock i:first-child { transform: translate(-3px, -3px); }
.opencell__note { margin: 0; font-size: 12.5px; line-height: 1.45; color: #D7E7DE; text-align: center; }

.openfigs { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.openfigs li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(214, 236, 224, .18);
  font-size: 13.5px; color: #D7E7DE;
}
.openfigs li:last-child { border-bottom: 0; }
.openfigs b {
  font-family: var(--serif); font-size: 19px;
  font-variant-numeric: tabular-nums lining-nums;
  color: #FFFFFF;
}

/* -------------------------- 8. Draw calculation ------------------------- */
.unseen {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.unseen i {
  display: block; width: 22px; height: 32px;
  border-radius: 3px;
  background: #24407F;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .4);
}
/* the one card that would still help, marked in muted gold */
.unseen i.is-live {
  background: #16351F;
  box-shadow: inset 0 0 0 2px var(--gold-light);
}
.sum {
  margin: 0;
  text-align: center;
  font-family: var(--serif); font-size: clamp(24px, 4vw, 32px); font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: #FFFFFF;
}

/* --------------------------- 9. Responsive ------------------------------ */
@media (max-width: 760px) {
  /* the sheet keeps its two columns: event on the left, percentage on the
     right, exactly as it reads on a wide screen */
  .osheet { overflow-x: visible; }
  .otab { font-size: 14px; }
  .otab caption { padding: 10px 12px 8px; font-size: 16px; }
  .otab th, .otab td { padding: 8px 12px; }
  .otab td.num { font-size: 17px; }
  .otab td.num--sm { font-size: 15px; }

  .ofig { --cw: 36px; --ch: calc(var(--cw) * 1.44); --cr: calc(var(--cw) * .1); padding: 14px 12px 12px; }
  .kdist { gap: 7px; }
  .kdist__stack i { height: 2px; }
  .kdist__pct { font-size: 14px; }
  .kdist__label { font-size: 11px; }

  .runrow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .runrow__len { grid-column: 1 / -1; }
  .splitrow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .openpair { grid-template-columns: minmax(0, 1fr); }
  .opencross { --cw: 34px; --ch: calc(var(--cw) * 1.44); --cr: calc(var(--cw) * .1); }
  .unseen i { width: 18px; height: 26px; }
}

/* ------------------------------ 10. Print ------------------------------- */
@media print {
  /* a probability table that runs over a page break repeats its headings */
  .otab thead { display: table-header-group; }
  .otab tbody tr { break-inside: avoid; page-break-inside: avoid; }
  .otab, .otab caption { background: #FBF8F0; }
  .otab caption, .otab thead th { border-bottom-color: #3A362B; }
  .otab th, .otab td { border-bottom-color: #8C846E; }
  .otab caption, .otab tbody th, .otab td.num { color: #1A1A1A; }
  .otab thead th { color: #4A4534; }

  .ofig { background: #FBF8F0; border-color: #8C846E; break-inside: avoid; page-break-inside: avoid; }
  .ofig__h, .runrow__len, .splitrow__label, .opencell__h { color: #6B5A2E; }
  .ofig__cap, .opencell__note, .kdist__label, .openfigs li { color: #1A1A1A; }
  .kdist__pct, .runrow__pct, .openfigs b, .sum { color: #1A1A1A; }
  .kdist__stack i { background: #FFF; box-shadow: 0 0 0 .5px #555; }
  .runrow, .openfigs li { border-bottom-color: #8C846E; }
  .opencell, .opencross__corner { border-color: #8C846E; }
  .opencross__stock i, .unseen i { background: #FFF; box-shadow: inset 0 0 0 1.5px #555; }
  .unseen i.is-live { background: #FFF; box-shadow: inset 0 0 0 2px #6B5A2E; }
}
