/* TableMate Board Resource Rooms */
.tm-board-overlay {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #0f172a 0%, #1e293b 55%, #0c4a6e 100%);
  color: #e2e8f0;
  overflow: hidden;
}

.tm-board-overlay[hidden] { display: none !important; }

.tm-board-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #334155;
  background: #0b1220;
  flex-shrink: 0;
}

.tm-board-header h2 { margin: 0; font-size: 1rem; font-weight: 800; }

.tm-board-code {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #7dd3fc;
  font-size: 14px;
}

.tm-board-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}

.tm-board-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.tm-board-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: #94a3b8;
}

.tm-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.tm-board-btn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
}

.tm-board-btn:active { opacity: 0.85; }
.tm-board-btn--primary { background: #0c4a6e; border-color: #38bdf8; color: #e0f2fe; }
.tm-board-btn--warn { background: #450a0a; border-color: #f87171; color: #fecaca; }
.tm-board-btn--taken { opacity: 0.35; pointer-events: none; }
.tm-board-btn--pick { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35); }

.tm-board-res-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.tm-board-res-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #020617;
  border: 1px solid #334155;
}

.tm-board-res-chip button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 800;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
}

.tm-board-res-chip button.tm-board-res-n {
  width: auto;
  min-width: 32px;
  padding: 0 8px;
  border-color: #38bdf8;
  background: #0c4a6e;
  color: #e0f2fe;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.tm-board-res-chip button.tm-board-res-n:active {
  opacity: 0.85;
}

.tm-board-res-chip--comm {
  border-color: #7c3aed;
}

.tm-board-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.tm-board-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 2px;
}

.tm-board-turn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tm-board-turn-name {
  font-size: 18px;
  font-weight: 900;
  color: #e0f2fe;
}

.tm-board-last-roll {
  font-size: 28px;
  font-weight: 900;
  color: #fef08a;
  margin-bottom: 12px;
  line-height: 1.2;
}

.tm-board-last-roll--empty {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
}

.tm-board-roll-total {
  color: #86efac;
  font-size: 36px;
}

.tm-board-roll-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.tm-board-roll-tag--warn {
  background: #450a0a;
  border-color: #f87171;
  color: #fecaca;
}

.tm-board-dice-chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.tm-board-dice-chips--hex {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 4px;
}

.tm-board-dice-chip {
  min-height: 48px;
  padding: 10px 0;
  border-radius: 12px;
  border: 2px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.tm-board-dice-chip:active {
  opacity: 0.85;
}

.tm-board-dice-chip.is-on,
.tm-board-dice-chip.is-last {
  border-color: #38bdf8;
  background: #0c4a6e;
  color: #e0f2fe;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.tm-board-dice-chip--robber {
  border-color: #7f1d1d;
  color: #fca5a5;
}

.tm-board-ratio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tm-board-ratio-chip {
  flex: 1 1 auto;
  min-width: 72px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.tm-board-ratio-chip.is-on {
  border-color: #86efac;
  background: #14532d;
  color: #dcfce7;
}

.tm-board-trade-qty {
  font-weight: 900;
  color: #86efac;
  min-width: 2ch;
}

.tm-board-player-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1e293b;
}

.tm-board-player-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tm-board-player-head {
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tm-board-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #7dd3fc;
  background: #0c4a6e;
  border: 1px solid #38bdf8;
}

.tm-board-badge--test {
  color: #fde68a;
  background: #422006;
  border-color: #f59e0b;
}

.tm-board-details {
  padding-top: 10px;
  padding-bottom: 10px;
}

.tm-board-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.tm-board-details > summary::-webkit-details-marker {
  display: none;
}

.tm-board-details > summary h3 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tm-board-details > summary h3::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #64748b;
  transition: transform 0.15s ease;
}

.tm-board-details[open] > summary h3::before {
  transform: rotate(90deg);
}

.tm-board-count {
  font-weight: 700;
  color: #64748b;
}

.tm-board-check {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 32px;
}

.tm-board-hex.is-match {
  box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.55);
  border-color: #86efac !important;
}

.tm-board-hex-num {
  font-size: 18px;
  font-weight: 900;
  color: #fef08a;
}

.tm-board-hex-id {
  font-size: 10px;
  color: #64748b;
}

.tm-board-bld-row {
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #1e293b;
}

.tm-board-barb-row {
  margin-top: 10px;
  font-size: 12px;
  color: #94a3b8;
}

.tm-board-card--play {
  border-color: #1e3a5f;
}

/* Number picker sheet */
.tm-board-num-picker {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tm-board-num-picker[hidden] {
  display: none !important;
}

.tm-board-num-picker__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(2, 6, 23, 0.55);
  cursor: pointer;
}

.tm-board-num-picker__sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(72vh, 520px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-bottom: 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}

.tm-board-num-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tm-board-num-picker__title {
  font-size: 14px;
  font-weight: 800;
  color: #e2e8f0;
}

.tm-board-num-picker__step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.tm-board-num-picker__step-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.tm-board-num-picker__val {
  min-width: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
}

.tm-board-num-picker__chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.tm-board-num-picker__chip {
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.tm-board-num-picker__chip.is-on {
  border-color: #38bdf8;
  background: #0c4a6e;
  color: #e0f2fe;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.tm-board-num-picker__chip--more {
  border-style: dashed;
}

.tm-board-hex-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tm-board-hex {
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid #334155;
  font-size: 12px;
  font-weight: 800;
  min-width: 56px;
  text-align: center;
}

.tm-board-dice-log {
  max-height: 120px;
  overflow-y: auto;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.tm-board-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #1e293b;
  font-size: 13px;
}

.tm-board-member:last-child { border-bottom: none; }

.tm-board-hub-games {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.tm-board-hub-game {
  padding: 16px 12px;
  border-radius: 14px;
  border: 2px solid #334155;
  background: #0f172a;
  cursor: pointer;
  text-align: center;
}

.tm-board-hub-game.is-pick {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.tm-board-hub-game h4 { margin: 0 0 4px; font-size: 15px; }
.tm-board-hub-game p { margin: 0; font-size: 11px; color: #64748b; }

.tm-board-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  font-size: 14px;
  box-sizing: border-box;
}

.tm-board-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  font-size: 13px;
}

.tm-board-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }

.tm-board-space-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  margin-bottom: 8px;
}

.tm-board-space-btn .tm-board-space-name { font-weight: 800; font-size: 14px; }
.tm-board-space-btn .tm-board-space-res { font-size: 12px; color: #86efac; margin-top: 4px; }
.tm-board-space-btn .tm-board-space-taken { font-size: 11px; color: #64748b; margin-top: 4px; }
