/* Dice Poker layout; dice artwork lives in the shared assets/css/dice.css */

.game-root { min-height: 30rem; }

.dice-layout {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.dice-play {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dice-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: min(100%, 15rem);
  margin-inline: auto;
}

/* Gold button so it stands out on the green felt */
.game-root .roll-btn {
  min-width: 15rem;
  min-height: 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(180deg, #e8c45a, #c9a02e);
  border-color: #9c7a1c;
  color: #2a2208;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.game-root .roll-btn:disabled { background: rgba(255, 255, 255, 0.18); border-color: transparent; color: rgba(255, 255, 255, 0.6); box-shadow: none; }

.dice-tip {
  margin: 0;
  width: 100%;
  text-align: center;
  color: #e5e9e2;
  font-size: 0.95rem;
  line-height: 1.35;
  height: 2.7em; /* always two lines, whatever the text */
  overflow: hidden;
}

.dice-sheet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  align-items: start;
}

/* Score card: looks like a printed pad */
.scorecard {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf7;
  color: #1d2433;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}

.scorecard th,
.scorecard td {
  padding: 0.3rem 0.8rem;
  border-bottom: 1px solid #e6dfcd;
  text-align: left;
  height: 2.25rem;
  line-height: 1.2; /* content stays shorter than the row, so empty and filled rows match */
  box-sizing: border-box;
}

.scorecard th { font-weight: 500; font-size: 0.98rem; }

.scorecard th small {
  display: inline;
  margin-left: 0.45em;
  font-weight: 400;
  font-size: 0.74rem;
  color: #6b7280;
}

.scorecard .section-head th {
  height: auto;
  background: #2f5a47;
  color: #f4f0e8;
  font-family: Georgia, serif;
  font-weight: normal;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.8rem;
}

.scorecard .val { width: 4rem; text-align: right; font-weight: 600; font-size: 1.1rem; }
.scorecard .val:empty::before { content: "\00a0"; }
.scorecard .val--empty { color: transparent; }

/* A score that is locked in: flat, bold, dark, on a shaded row */
.scorecard tr.is-used th,
.scorecard tr.is-used td { background: #f1ecdc; }
.scorecard tr.is-used th { color: #7a7569; }
.scorecard .val--set .chip { font-size: 1.15rem; font-weight: 700; color: #1d2433; }

/* A row you can still choose: accent bar, green dashed "+n" chip */
.scorecard tr.is-open th:first-child { box-shadow: inset 4px 0 0 #2e6b4a; }

.scorecard .chip { display: inline-block; line-height: 1.2; }

.scorecard .val--potential .chip,
.scorecard .val--zero .chip {
  min-width: 3rem;
  padding: 0.08rem 0.55rem;
  border-radius: 999px;
  text-align: center;
  font-size: 1.02rem;
  font-weight: 700;
  border: 1.5px dashed currentColor;
}

.scorecard .val--potential .chip { color: #1f6a43; background: #e4f3ea; }

/* Choosing this row would score nothing: visible, but clearly the weak choice */
.scorecard .val--zero .chip { color: #8a8478; background: transparent; font-weight: 600; }

.scorecard tr.is-open { cursor: pointer; }

.scorecard tr.is-open:hover,
.scorecard tr.is-open:focus-visible { background: #f6edcf; outline: none; }

.scorecard tr.is-open:hover .val--potential .chip,
.scorecard tr.is-open:focus-visible .val--potential .chip {
  background: #1f6a43;
  color: #fff;
  border-style: solid;
}

.scorecard tr.sum th { color: #4b5563; background: #f6f1e2; }
.scorecard tr.sum .val { background: #f6f1e2; }
.scorecard tr.earned .val { color: #2e6b4a; }
.scorecard tr.grand th,
.scorecard tr.grand .val { background: #ece2c4; color: #1d2433; font-size: 1.1rem; font-weight: 700; }
.scorecard tr:last-child th,
.scorecard tr:last-child td { border-bottom: 0; }

/* Wide: dice and roll button side by side, upper and lower card side by side */
@container (min-width: 640px) {
  .dice-play { flex-direction: row; align-items: center; gap: 1.25rem; }
  .dice-play .dice-tray { flex: 1 1 auto; }
  .dice-actions { flex: 0 0 15rem; margin-inline: 0; }
  .dice-play .dice-tray { flex-wrap: nowrap; gap: clamp(0.4rem, 1.6cqw, 1.1rem); }
  .dice-play .die { width: clamp(2.6rem, 8cqw, 4.7rem); }
  .dice-sheet-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* Narrow: keep the dice in view while choosing a row, and shorten the rows */
@container (max-width: 639px) {
  .dice-play {
    position: sticky;
    top: 0.4rem;
    z-index: 6;
    padding: 0.5rem;
    border-radius: 14px;
    background: var(--felt-dark);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  }
  .dice-tip { display: none; }
  .game-root .roll-btn { min-height: 2.8rem; min-width: 13rem; }
  .scorecard th small { display: none; }
  .scorecard th,
  .scorecard td { height: 2.4rem; }
}
