.topbar {
  padding: 1rem 1.2rem 0.4rem;
  border-bottom: 2px solid var(--border-topbar);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.topbar h1 {
  margin: 0;
  letter-spacing: 0.04em;
  font-size: 1.1rem;
}

.subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.2fr 2.1fr 1.2fr;
  grid-template-rows: 1fr;
  gap: 0.8rem;
  padding: 0.8rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #ccb88a;
  border-radius: 10px;
  padding: 0.7rem;
  backdrop-filter: blur(2px);
  overflow-y: auto;
  min-height: 0;
}

.sidebar-panel-summary {
  display: list-item;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tone-warm);
  padding: 0.1rem 0;
  margin-bottom: 0.2rem;
  list-style-position: inside;
  user-select: none;
}

#sidebarPanel:not([open]) {
  padding-bottom: 0.3rem;
}

.controls .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.phase-group {
  border-top: 1px solid #d8c7a0;
  padding-top: 0.4rem;
  margin-top: 0.35rem;
}

.phase-label {
  display: block;
  font-size: var(--font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--tone-muted);
  margin-bottom: 0.3rem;
}

.move-status-msg {
  font-size: 0.78rem;
  color: #7a3a00;
  background: #fff4e0;
  border: 1px solid #e0a84a;
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.setup-label {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 5rem;
}

.setup-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tone-muted);
  margin-top: 0.35rem;
  margin-bottom: 0.1rem;
}

.setup-collection-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.25rem 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.setup-collection-grid--2col {
  grid-template-columns: auto 1fr;
}

.deck-preview-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tone-muted);
  margin-bottom: 0.4rem;
}

.setup-variant-rules {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.4rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-cell);
  border-radius: var(--radius-sm, 4px);
  background: rgba(0,0,0,0.03);
}

.setup-variant-header {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.7;
}

.setup-variant-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.35;
}

.setup-variant-label input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.setup-col-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  opacity: 0.7;
}

.setup-col-header:first-child {
  text-align: left;
}

.setup-coll-name {
  font-size: 0.8rem;
  font-weight: 600;
  position: relative;
  cursor: default;
}

.setup-coll-name[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: var(--font-sm);
  font-weight: 400;
  line-height: 1.5;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--tooltip-border);
  white-space: pre;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  min-width: 190px;
}

.setup-collection-grid input[type="checkbox"] {
  justify-self: center;
}

.board-wrap {
  overflow: visible;
  cursor: grab;
  user-select: none;
  position: relative;
  display: flex;
  flex-direction: column;
}

.spin-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
  overflow: visible;
}

.spin-indicator line {
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.spin-indicator #spinCenterMark {
  fill: rgba(255, 255, 255, 0.95);
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 1.5;
}

.spin-indicator #spinCursorDot {
  fill: rgba(255, 220, 80, 0.95);
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 1.5;
}

.board-wrap.panning {
  cursor: grabbing;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

.player-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.25rem 0.4rem;
}

.player-pip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #f0e8d8;
  border: 1px solid #d8c7a0;
  font-size: 0.78rem;
  color: var(--tone-muted);
  white-space: nowrap;
}

/* Inactive — light tint per player */
.player-pip[data-pid="1"] { background: #ddeaf7; border-color: #2d6a9f; color: #1a3f5e; }
.player-pip[data-pid="2"] { background: #fadadd; border-color: #c0392b; color: #7a1a12; }
.player-pip[data-pid="3"] { background: #d5f5e3; border-color: #27ae60; color: #145a32; }
.player-pip[data-pid="4"] { background: #fde8d0; border-color: #e67e22; color: #7e4400; }
.player-pip[data-pid="5"] { background: #ead9f5; border-color: #8e44ad; color: #4a1a6e; }
.player-pip[data-pid="6"] { background: #d0eeea; border-color: #16a085; color: #0a4a3a; }

/* Active — full player color, white text */
.player-pip--active[data-pid="1"] { background: #2d6a9f; border-color: #2d6a9f; color: #fff; }
.player-pip--active[data-pid="2"] { background: #c0392b; border-color: #c0392b; color: #fff; }
.player-pip--active[data-pid="3"] { background: #27ae60; border-color: #27ae60; color: #fff; }
.player-pip--active[data-pid="4"] { background: #e67e22; border-color: #e67e22; color: #fff; }
.player-pip--active[data-pid="5"] { background: #8e44ad; border-color: #8e44ad; color: #fff; }
.player-pip--active[data-pid="6"] { background: #16a085; border-color: #16a085; color: #fff; }

.player-pip--active {
  font-weight: 700;
}

.pip-name {
  font-weight: 600;
}

.pip-stat {
  opacity: 0.85;
  font-size: 0.74rem;
}

.pip-stat--bullets {
  color: inherit;
}

.pip-stat--guts {
  color: #c8860a;
}

.pip-stat--kills {
  font-weight: 700;
}

.pip-stat--sewer-tokens {
  color: var(--text, #222);
  font-weight: 600;
}

.pip-stat--in-sewer {
  color: #00bcd4;
  font-weight: 700;
  font-size: 0.68rem;
}

.player-pip--active .pip-stat {
  opacity: 0.9;
}

.kb-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.22rem 0.6rem;
  font-size: 0.7rem;
  color: #c8b090;
  background: #0d0d14;
  border-bottom: 1px solid #3a2e1a;
  flex-wrap: wrap;
}

.kb-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.kb-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a6a4a;
  margin-right: 0.15rem;
}

.kb-sep {
  width: 1px;
  height: 0.9em;
  background: #3a2e1a;
  flex-shrink: 0;
}

kbd {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  background: #1e1e2e;
  border: 1px solid #4a3e28;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.68rem;
  color: #e0c890;
  margin: 0 0.05rem;
}

.board-header-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin-left: auto;
}

#board {
  display: grid;
  gap: 6px;
  margin-top: 0.5rem;
  position: relative;
}

.map-deck-debug-wrap {
  margin-top: 0.8rem;
  border-top: 2px solid #8d9aa6;
  padding-top: 0.6rem;
  background: #eef3f7;
  border-radius: 8px;
  padding: 0.6rem;
}

.map-deck-debug-header {
  margin-bottom: 0.4rem;
}

.deck-debug-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.deck-debug-filters label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.map-deck-debug-header h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #1c2a38;
}

#mapDeckDebugCount {
  color: #27445d;
  font-weight: 700;
}

#mapDeckDebug {
  display: grid;
  gap: 0.4rem;
}

.map-deck-group {
  border: 1px solid #9eb0c0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.56);
  padding: 0.35rem;
}

.map-deck-group-title {
  display: block;
  width: 100%;
  margin: 0 0 0.32rem;
  padding: 0.2rem 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1c2a38;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.map-deck-group-title:hover {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.deck-expand-btn {
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid #b0bcc8;
  border-radius: 4px;
  cursor: pointer;
  color: #2a3a4a;
}

.deck-expand-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

.deck-expand-btn--open {
  background: rgba(0, 0, 0, 0.13);
  border-color: #8a9aaa;
  color: #1a2a3a;
}

.map-deck-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 0.4rem;
  align-items: start;
}

.deck-tile-edit-line {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.deck-tile-collections {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
}

.deck-tile-collections-grid {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.deck-tile-collections-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.72rem;
}

.deck-tile-count-input {
  width: 3.2rem;
  font-size: 0.72rem;
  padding: 0.08rem 0.16rem;
}

.deck-tile {
  border: 1px solid #7f8f9f;
  border-radius: 6px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: #102030;
  box-shadow: 0 1px 2px rgba(9, 24, 40, 0.12);
}

#mapDeckDebug .deck-tile,
#mapDeckDebug .deck-tile strong,
#mapDeckDebug .deck-tile .small,
#mapDeckDebug .deck-subtile-row,
#mapDeckDebug .deck-subtile-row strong,
#mapDeckDebug .deck-subtile-row code,
#mapDeckDebug .deck-subtile-row span,
#mapDeckDebug .deck-subtile-row div {
  color: #102030;
}

.deck-tile .micro-grid {
  width: min(100%, 180px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto;
  flex: 0 0 auto;
}

.deck-subtiles {
  margin-top: 0.2rem;
  border-top: 1px dashed #8fa1b3;
  padding-top: 0.2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.2rem;
}

.deck-subtile-row {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.4;
  background: #ffffff;
  border: 1px solid #9aa9b7;
  border-radius: 4px;
  padding: 0.3rem;
}

.deck-subtile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #c2cdda;
  padding-bottom: 0.16rem;
}

.deck-subtile-coord {
  font-weight: 700;
}

.deck-subtile-type {
  border: 1px solid #8ca1b5;
  border-radius: 999px;
  padding: 0.02rem 0.38rem;
  font-size: 0.68rem;
  background: #edf4fb;
  color: #18334a;
}

.deck-subtile-flow {
  font-size: 0.7rem;
  opacity: 1;
  color: #2b4358;
}

.deck-subtile-edit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.deck-subtile-edit-line select {
  min-width: 84px;
  font-size: 0.72rem;
  padding: 0.08rem 0.16rem;
}

.deck-subtile-edit-dirs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.15rem;
  font-size: 0.68rem;
}

.deck-subtile-edit-dirs strong {
  grid-column: 1 / -1;
}

.deck-subtile-edit-dirs label {
  display: flex;
  align-items: center;
  gap: 0.12rem;
}

.deck-code-wrap {
  margin-top: 0.25rem;
  border: 1px solid #9aa9b7;
  border-radius: 4px;
  background: #f8fbff;
}

.deck-code-wrap summary {
  cursor: pointer;
  padding: 0.22rem 0.28rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.deck-code-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.28rem 0;
}

.deck-copy-btn {
  font-size: 0.68rem;
  padding: 0.14rem 0.42rem;
}

.deck-copy-status {
  font-size: 0.68rem;
  color: #2b4358;
}

.deck-code {
  margin: 0;
  border-top: 1px solid #d3dde7;
  padding: 0.3rem;
  font-size: 0.7rem;
  line-height: 1.35;
  overflow: auto;
  max-height: 220px;
  white-space: pre;
}

.deck-debug .micro-grid {
  border-color: rgba(8, 27, 48, 0.45);
}

.deck-debug .micro-cell {
  border-right-color: rgba(8, 27, 48, 0.4);
  border-bottom-color: rgba(8, 27, 48, 0.4);
}

.deck-debug .micro-cell:not([class*="-subtile"]) {
  background: rgba(255, 255, 255, 0.72);
}

.deck-info-details {
  margin-top: 0.35rem;
}

.deck-info-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.7;
  user-select: none;
}

.deck-info-breakdown {
  margin-top: 0.4rem;
  border-top: 1px solid #d8c7a0;
  padding-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.deck-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.deck-info-name {
  flex: 1;
  min-width: 0;
}

.deck-info-type {
  font-style: normal;
  opacity: 0.6;
  font-size: 0.75rem;
}

.deck-info-collection {
  font-size: 0.72rem;
  opacity: 0.55;
  font-style: italic;
}

.deck-info-copy {
  font-size: 0.72rem;
  opacity: 0.7;
}

.deck-info-pos {
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.55;
  font-size: 0.72rem;
}

.deck-info-row--played {
  opacity: 0.5;
}

.deck-info-row[draggable="true"] {
  cursor: grab;
  user-select: none;
}
.deck-info-row.dragging {
  opacity: 0.35;
}
.deck-info-row.drag-over {
  background: rgba(100, 160, 220, 0.22);
  border-radius: 3px;
  outline: 1px dashed #6098d4;
}

.deck-info-divider {
  border-top: 1px dashed #c0a87a;
  margin: 0.25rem 0;
}

.deck-info-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #7a5c2a;
  padding: 0.1rem 0 0.1rem 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.deck-empty-badge {
  display: inline-block;
  margin-left: 0.4rem;
  background: #c24a3e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
}

#log {
  max-height: 250px;
  overflow: auto;
  background: #fffdf8;
  border: 1px solid #d8c7a0;
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.82rem;
}

.log-line {
  margin-bottom: 0.3rem;
}

.log-line--kill {
  font-weight: 700;
  color: #c24a00;
}

.log-line--knockout {
  font-weight: 700;
  color: #8b0000;
}

.knockout-banner {
  position: fixed;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #3a0a0a;
  color: #f5e0e0;
  border: 2px solid #8b0000;
  border-radius: var(--radius-lg);
  padding: 0.7rem 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
  min-width: 280px;
  max-width: 480px;
  animation: knockout-slide-in 0.25s ease-out;
}

.knockout-banner.hidden {
  display: none;
}

@keyframes knockout-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.knockout-banner-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.knockout-banner-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: var(--font-ui);
  flex: 1;
}

.knockout-banner-body span {
  font-size: var(--font-sm);
  opacity: 0.85;
}

.knockout-banner-dismiss {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f5e0e0;
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.4rem;
  font-size: var(--font-sm);
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
}

.knockout-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-tabs {
  display: none;
}

.panel-sentinel {
  display: none;
}

.porthole {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #0d0d14;
  border: 2px solid #a07840;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #6b4e25;
  overflow: auto;
}

.turn-strip {
  display: none;
}

@media (max-width: 1080px) {
  html, body {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    flex-shrink: 0;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    padding-left: max(1.2rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.2rem, env(safe-area-inset-right, 0px));
  }

  .site-footer {
    display: none;
  }

  .mobile-tabs {
    display: flex;
    flex-shrink: 0;
    order: 99;
    border-top: 2px solid var(--border-topbar);
    border-bottom: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-tab-btn {
    flex: 1;
    padding: 0.55rem 0.25rem;
    font-size: 0.88rem;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    cursor: pointer;
    color: var(--tone-muted);
    letter-spacing: 0.03em;
  }

  .mobile-tab-btn--active {
    color: var(--tone-warm);
    border-bottom-color: var(--tone-warm);
    background: transparent;
  }

  .mobile-tab-btn:hover {
    background: rgba(0, 0, 0, 0.04);
  }

  @keyframes mp-tab-flash {
    0%, 100% { background: transparent; color: var(--tone-muted); border-bottom-color: transparent; }
    50%       { background: var(--tone-warm); color: #fff; border-bottom-color: var(--tone-warm); }
  }

  .mobile-tab-btn--your-turn {
    animation: mp-tab-flash 0.55s ease-in-out 5;
  }

  @keyframes mp-dot-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%       { transform: scale(0.75); opacity: 0.5; }
  }

  /* Persistent green dot shown on the Map tab while it is the local player's turn */
  .mobile-tab-btn--mp-active {
    position: relative;
  }

  .mobile-tab-btn--mp-active::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: #4caf50;
    border-radius: 50%;
    animation: mp-dot-pulse 1.4s ease-in-out infinite;
  }

  main.layout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    grid-template-columns: 1fr;
    padding: 0;
  }

  main.layout > .panel {
    display: none;
  }

  main.layout > .panel.mobile-tab-active {
    display: block;
    flex: 1;
    min-height: 0;
    padding: 0.6rem;
  }

  .controls.mobile-tab-active,
  .sidebar.mobile-tab-active {
    overflow-y: auto;
  }

  .controls.mobile-tab-active .phase-group {
    display: none;
  }

  .kb-hint { display: none; }

  .board-wrap.mobile-tab-active {
    overflow: hidden;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .turn-strip {
    display: none;
  }

  .turn-strip--visible {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-top: 1px solid #d8c7a0;
    border-bottom: 1px solid #d8c7a0;
    background: rgba(255, 255, 255, 0.97);
  }

  /* 2×3 pill grid */
  .turn-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #d8c7a0;
  }

  .turn-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.38rem 0.25rem;
    background: transparent;
    border: none;
    border-right: 1px solid #ede0c8;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--tone-muted);
  }

  .turn-pill:nth-child(3n) {
    border-right: none;
  }

  .turn-pill:nth-child(n+4) {
    border-top: 1px solid #ede0c8;
  }

  .turn-pill:hover {
    background: rgba(0, 0, 0, 0.03);
  }

  /* Active step — orange border + number badge */
  .turn-pill.turn-step--active {
    color: var(--tone-warm);
    border-bottom-color: var(--tone-warm);
  }

  .turn-pill.turn-step--active .ts-step-num,
  .turn-pill.turn-step--open .ts-step-num {
    background: var(--tone-warm);
    color: #fff;
  }

  /* Open/selected pill */
  .turn-pill.turn-step--open {
    color: var(--tone-warm);
    background: rgba(255, 248, 235, 0.85);
  }

  .ts-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: #e0d5be;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--tone-muted);
    flex-shrink: 0;
  }

  /* Action bar — only the open step body is shown */
  .turn-body {
    display: none;
    padding: 0.4rem 0.6rem 0.5rem;
    background: rgba(255, 252, 245, 0.95);
    max-height: 30vh;
    overflow-y: auto;
  }

  .turn-body.turn-step--open {
    display: block;
  }

  .ts-discard-hint {
    background: #fff8e1;
    border: 1px solid #f5c518;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: #5a4200;
  }

  .ts-discard-hint-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline;
  }

  .ts-info-span {
    font-size: 0.8rem;
    color: var(--tone-muted);
  }

  .ts-moveDirBtn {
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
  }

  /* In Play row — pinned at bottom of turn strip */
  .ts-inplay-row {
    border-top: 1px solid #d8c7a0;
    padding: 0.35rem 0.6rem 0.4rem;
    background: rgba(255, 252, 245, 0.97);
  }

  .ts-inplay-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tone-muted);
    margin-bottom: 0.25rem;
  }

  .ts-inplay-player {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.2rem;
  }

  .ts-inplay-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--tone-muted);
    min-width: 3.5rem;
    flex-shrink: 0;
  }

  .ts-inplay-chip {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    background: #e8d9b0;
    border: 1px solid #c4a96e;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #5c3a0a;
    white-space: nowrap;
  }

  .ts-inplay-chip--botd {
    background: #d0e8d0;
    border-color: #6ea06e;
    color: #1a4a1a;
  }

  /* Hand tab — others' in-play section */
  .hand-inplay-label {
    margin-top: 1rem;
  }

  .porthole {
    width: calc(100vw - 1.5rem);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    flex-shrink: 1;
    margin: auto;
    background: #0d0d14;
    border: 2px solid #a07840;
    border-radius: 6px;
    box-shadow: 0 0 0 1px #6b4e25;
  }

  .cell {
    width: 74px;
    height: 96px;
  }

  /* Mobile Hand panel — hidden by default; shown via body.hand-tab-active */
  #mobileHandPanel {
    display: none;
  }

  /* Hand tab: compact porthole above, hand panel scrollable below */
  body.hand-tab-active main.layout {
    flex: 0 0 auto;
  }

  body.hand-tab-active .board-wrap.mobile-tab-active {
    height: 38vh;
    flex: none;
    padding: 0.3rem;
  }

  body.hand-tab-active .porthole {
    height: 100%;
    flex: none;
  }

  body.hand-tab-active #mobileHandPanel {
    display: block;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.6rem;
    order: 2;
  }

  .mobile-discard-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.6rem;
    background: #fff5e6;
    border: 1px solid #e0a050;
    border-radius: 6px;
    font-size: 0.82rem;
  }

  .mobile-discard-hint {
    color: #7a4a10;
  }

  .mobile-discard-confirm {
    white-space: nowrap;
    flex-shrink: 0;
    background: #e07820;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-discard-confirm:disabled {
    background: #c8b090;
    cursor: default;
  }

  /* Mobile toast — shows latest log line briefly after any action */
  .mobile-toast {
    display: none;
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
    background: rgba(20, 12, 4, 0.82);
    color: #f0e0b0;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    max-width: calc(100% - 1.5rem);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .mobile-toast--visible {
    display: block;
    opacity: 1;
  }

  /* Lock screen overlay */
  .lock-screen {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(10, 10, 18, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .lock-screen-inner {
    text-align: center;
    color: #e8d9b0;
    padding: 2rem;
  }

  .lock-screen-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
  }

  .lock-screen-msg {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
  }

  .lock-screen-hint {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-top: 0.75rem;
  }
}

/* Item chips — global (visible in sidebar on desktop too) */
.player-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.player-item-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: #e8d9b0;
  border: 1px solid #c4a96e;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #5c3a0a;
  white-space: nowrap;
}

.player-item-chip--botd {
  background: #d0e8d0;
  border-color: #6ea06e;
  color: #1a4a1a;
}

