/* The counter stays in place when its physical pack is picked up. */
html { scrollbar-gutter: stable; }
html:has(#opening-focus[open]),
body:has(#opening-focus[open]) {
  overflow: hidden;
  overscroll-behavior: none;
}

.main-table .focus-placeholder.playmat {
  pointer-events: none;
}
.main-table .focus-placeholder .mat-footer > :last-child {
  color: #eef0e1;
  font: 700 .73rem/1.2 var(--mono);
  letter-spacing: .035em;
}

#opening-focus {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
           env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  border: 0;
  border-radius: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: transparent;
  box-shadow: none;
}
#opening-focus[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
#opening-focus:not([open]), #opening-focus [hidden] { display: none; }
#opening-focus::backdrop {
  background: rgb(12 23 35 / 39%);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

#opening-focus #focus-stage {
  grid-row: 2;
  position: relative;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
#opening-focus #focus-stage::before,
#opening-focus #focus-stage :is(.counter-title, .counter-series, .mat-edge, .mat-footer) {
  display: none;
}
#opening-focus #focus-stage :is(#tabletop-scene, .center) {
  inset: 0;
  width: 100%;
  height: 100%;
}

#focus-close, #focus-controls button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid #c6d0cc;
  border-radius: 3px;
  background: #192f49;
  color: #fff9e7;
  box-shadow: 0 2px 6px #11223438;
  font: 750 .94rem/1.1 var(--sans);
  cursor: pointer;
  touch-action: manipulation;
}
#focus-title {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: start;
  max-width: calc(100% - 86px);
  overflow: hidden;
  margin: clamp(6px, 1.7vh, 18px) 0 0 clamp(9px, 2vw, 26px);
  padding: 6px 9px;
  border-inline-start: 3px solid #f7cb33;
  background: #14283fea;
  color: #fff9e7;
  font: 700 clamp(.78rem, 2.7vw, .9rem)/1.1 var(--sans);
  white-space: nowrap;
  text-overflow: ellipsis;
}
#focus-close {
  grid-area: 1 / 1;
  justify-self: end;
  width: 44px;
  margin: clamp(6px, 1.7vh, 18px) clamp(9px, 2vw, 26px) 0;
  padding: 10px;
}
#focus-close svg { width: 22px; height: 22px; }
#focus-controls {
  grid-row: 3;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 8px clamp(9px, 2.3vh, 24px);
  text-align: center;
}
#focus-hint {
  margin: 0;
  padding: 4px 10px;
  border-radius: 2px;
  background: #11243aea;
  color: #fff8e6;
  font: 650 clamp(.75rem, 2.8vw, .91rem)/1.3 var(--sans);
  text-wrap: balance;
}
#focus-hint:empty { display: none; }
#opening-focus .focus-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
#focus-controls button { padding: 8px clamp(9px, 2.7vw, 19px); }
#focus-controls button svg { flex: none; width: 17px; height: 17px; }
#focus-controls #focus-action {
  border-color: #162e48;
  background: #f7cb33;
  color: #122942;
}
@media (hover: hover) {
  #focus-close:hover, #focus-controls button:hover { background: #2e4860; }
  #focus-controls #focus-action:hover { background: #ffdc58; }
}
#opening-focus :is(#focus-close, #focus-controls button):focus-visible {
  outline: 3px solid #fff5ce;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #162b45;
}
@media (max-width: 735px) {
  .main-table .focus-placeholder .mat-footer > :last-child { font-size: .65rem; }
}
@media (max-width: 735px) and (orientation: portrait) {
  #opening-focus #focus-stage {
    width: calc(100% - 2 * clamp(10px, 3.6vw, 15px));
    justify-self: center;
  }
}
@media (max-width: 350px) {
  #opening-focus .focus-buttons { gap: 4px; }
  #focus-controls button { padding-inline: 7px; font-size: .84rem; }
}
@media (min-width: 500px) and (max-height: 500px) {
  #opening-focus[open] { grid-template-rows: 0 minmax(0, 1fr) auto; }
  #focus-close { position: relative; z-index: 5; align-self: start; }
  #focus-title { z-index: 5; align-self: start; max-width: min(26%, 180px); pointer-events: none; }
  #focus-controls { display: flex; align-items: center; justify-content: center; padding-block: 2px 4px; }
}
@media (prefers-reduced-motion: no-preference) {
  #opening-focus[open]::backdrop, #opening-focus[open] #focus-controls {
    animation: opening-fade-in 160ms ease-out both;
  }
  @keyframes opening-fade-in { from { opacity: 0; } to { opacity: 1; } }
}
