/* Yahtzee — Dev host + invite-only join table (dice visuals from farkle.css) */
/* Author: Dave Greenlaw */

.yz-app.fk-app > .crib-status {
  display: none !important;
}

.yz-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  flex: 1 1 auto;
  min-height: 0;
}

.yz-table {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.yz-table .fk-felt {
  z-index: 2;
  min-height: 7.5rem;
}

.yz-table .fk-actions {
  z-index: 3;
  position: relative;
  flex-shrink: 0;
}

.yz-board-card {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
  overflow: auto;
  max-height: 42vh;
  padding-top: 6px;
  z-index: 0;
}

.yz-app .crib-lens--board {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.yz-sb-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fk-felt, var(--surface, #f5f6f8)) 78%, transparent);
  border: 1px solid var(--border, rgba(128, 128, 128, 0.28));
}

.yz-sb-play .fk-felt,
.yz-sb-play .fk-live,
.yz-sb-play .fk-aside,
.yz-sb-play .fk-first {
  min-height: 0;
}

.yz-sb-play .fk-actions {
  justify-content: flex-start;
}

.yz-sb-play .fk-die.is-legal,
.yz-table .fk-die.is-legal,
.yz-sb-play [data-yz-act],
.yz-table .fk-actions .pill-btn {
  touch-action: manipulation;
}

.yz-card {
  border: 1px solid var(--border, rgba(128, 128, 128, 0.28));
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  overflow: auto;
}

.yz-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.yz-grid th,
.yz-grid td {
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.22));
  padding: 4px 6px;
  text-align: center;
  white-space: nowrap;
}

.yz-grid th[scope="row"] {
  text-align: left;
  font-weight: 600;
  color: var(--text, #1a1a1a);
  position: sticky;
  left: 0;
  background: var(--surface, #fff);
  z-index: 1;
}

.yz-grid thead th {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted, #5c6470);
}

.yz-grid thead th.is-turn {
  color: var(--accent, #0078d4);
}

.yz-cell.is-open {
  color: var(--text-muted, #5c6470);
}

.yz-cell.is-filled {
  font-variant-numeric: tabular-nums;
}

.yz-cell-btn {
  appearance: none;
  font: inherit;
  min-width: 2.4rem;
  min-height: 32px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--accent, #0078d4);
  background: color-mix(in srgb, var(--accent, #0078d4) 16%, var(--surface, #fff));
  color: var(--text, #1a1a1a);
  cursor: pointer;
  color-scheme: inherit;
}

.yz-cell-btn:hover,
.yz-cell-btn:focus-visible {
  outline: 2px solid var(--accent, #0078d4);
  outline-offset: 1px;
  background: color-mix(in srgb, var(--accent, #0078d4) 28%, var(--surface, #fff));
}

.yz-sub td,
.yz-sub th {
  color: var(--text-muted, #5c6470);
  font-size: 12px;
}

.yz-total th,
.yz-total td {
  border-bottom: none;
  padding-top: 8px;
}

.composer-yahtzee-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.yz-app.is-game-focus [data-yz-dev-tools],
.yz-app.is-game-focus .crib-chat {
  display: none !important;
}

/* Phones / short landscape: dice first, then the full scorecard below — scroll the board, do not hide it. */
@media (max-width: 820px), (max-height: 560px) {
  .yz-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .yz-stage {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  .yz-table {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    height: auto;
    min-height: min-content;
    overflow: visible;
  }

  .yz-table .fk-score-strip {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    flex-wrap: wrap;
    max-width: none;
  }

  .yz-table .fk-felt {
    grid-column: 1;
    grid-row: 2;
    min-height: 7.5rem;
  }

  .yz-table .fk-actions {
    grid-column: 1;
    grid-row: 3;
  }

  .yz-board-card {
    display: block;
    grid-column: 1;
    grid-row: 4;
    max-height: none;
    overflow: visible;
    padding-bottom: 12px;
  }
}

html[data-a11y-view="comfort"] .yz-cell-btn {
  min-height: 44px;
  min-width: 44px;
}

html[data-a11y-view="comfort"] .yz-table .fk-felt,
html[data-a11y-view="comfort"] .yz-sb-play .fk-live {
  min-height: 8.5rem;
}

html[data-a11y-view="contrast"] .yz-card,
html[data-a11y-view="contrast"] .yz-grid th,
html[data-a11y-view="contrast"] .yz-grid td,
html[data-a11y-view="contrast"] .yz-cell-btn {
  border-width: 2px;
}

html[data-theme="dark"] .yz-card,
html[data-theme="soft"] .yz-card,
html[data-theme="glass"] .yz-card,
html[data-theme="dark"] .yz-grid th[scope="row"],
html[data-theme="soft"] .yz-grid th[scope="row"],
html[data-theme="glass"] .yz-grid th[scope="row"] {
  background: var(--surface, #1c1f28);
  color: var(--text, #f8fafc);
}

html[data-theme="dark"] .yz-cell-btn,
html[data-theme="soft"] .yz-cell-btn,
html[data-theme="glass"] .yz-cell-btn {
  color-scheme: dark;
  color: var(--text, #f8fafc);
}

html[data-theme="glass"] .yz-card {
  background: color-mix(in srgb, var(--surface, #fff) 82%, transparent);
  backdrop-filter: blur(8px);
}

html[data-theme="glass"] .yz-sb-play {
  background: color-mix(in srgb, var(--fk-felt, var(--surface)) 72%, transparent);
  border-color: var(--glass-edge, var(--border));
}

html[data-theme="glass"] .yz-grid th[scope="row"] {
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
}
