/* Stage 89: shared form skin and identical CT/T scoreboard columns.
   No event handlers, DOM replacement, or changes to form values. */
:root {
  --s89-field: #0c1e30;
  --s89-field-top: #142a40;
  --s89-border: #42617a;
  --s89-text: #e8f3fc;
  --s89-muted: #93abc1;
  --s89-accent: #65d8c6;
  --s89-focus: #7cd9ed;
  --s89-radius: 8px;
  color-scheme: dark;
}
/* The two tables share width, minimum width and fixed column allocation.
   Horizontal scrolling occurs at the common scoreboard, not per team. */
#viewerSection #viewerTabScoreboard .viewer-scoreboard-team {
  width: 100%; min-width: 930px; box-sizing: border-box;
}
#viewerSection #viewerTabScoreboard table {
  table-layout: fixed; width: 100%; min-width: 0; border-collapse: collapse;
}
#viewerSection #viewerTabScoreboard th:nth-child(1) { width: 22%; }
#viewerSection #viewerTabScoreboard th:nth-child(2) { width: 8%; }
#viewerSection #viewerTabScoreboard th:nth-child(3) { width: 7%; }
#viewerSection #viewerTabScoreboard th:nth-child(4),
#viewerSection #viewerTabScoreboard th:nth-child(5),
#viewerSection #viewerTabScoreboard th:nth-child(6) { width: 5%; }
#viewerSection #viewerTabScoreboard th:nth-child(7),
#viewerSection #viewerTabScoreboard th:nth-child(8) { width: 6%; }
#viewerSection #viewerTabScoreboard th:nth-child(9) { width: 8%; }
#viewerSection #viewerTabScoreboard th:nth-child(10) { width: 12%; }
#viewerSection #viewerTabScoreboard th:nth-child(11) { width: 16%; }
#viewerSection #viewerTabScoreboard :is(th,td) {
  box-sizing: border-box; overflow-wrap: anywhere; white-space: normal;
  font-variant-numeric: tabular-nums;
}
/* All text-like controls, including dynamically-created dialogs and ticket forms.
   The important declarations deliberately override older per-window skins only
   for appearance. Their geometry (width, height, layout, display) stays intact. */
body :is(input:not([type]),input:is([type=text],[type=search],[type=email],[type=password],[type=url],[type=tel],[type=number],[type=date],[type=time],[type=datetime-local],[type=month],[type=week]),select,textarea) {
  box-sizing: border-box;
  color: var(--s89-text) !important;
  background-color: var(--s89-field) !important;
  background-image: linear-gradient(160deg, #19354b55, transparent 75%) !important;
  border: 1px solid var(--s89-border) !important;
  border-radius: var(--s89-radius) !important;
  box-shadow: inset 0 1px 2px #020b1640;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 10px;
  color-scheme: dark;
  transition: border-color .14s, box-shadow .14s, background-color .14s;
}
body :is(input,textarea)::placeholder { color: var(--s89-muted) !important; opacity: 1; }
body :is(input:not([type]),input:is([type=text],[type=search],[type=email],[type=password],[type=url],[type=tel],[type=number],[type=date],[type=time],[type=datetime-local],[type=month],[type=week]),select,textarea):not(:disabled):hover {
  border-color: #6991ac !important;
}
body :is(input:not([type]),input:is([type=text],[type=search],[type=email],[type=password],[type=url],[type=tel],[type=number],[type=date],[type=time],[type=datetime-local],[type=month],[type=week]),select,textarea):focus {
  border-color: var(--s89-focus) !important;
  outline: 2px solid #7cd9ed44 !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px #7cd9ed16;
}
body :is(input,textarea)[readonly] { color: #b6cadd !important; }
body :is(input,select,textarea):disabled { opacity: .55; cursor: not-allowed; }
body :is(input,select,textarea)[aria-invalid=true] { border-color: #f28d91 !important; }
/* Single-select only. Keep listboxes and multiple selections native. */
body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 30px !important;
  background-image: linear-gradient(45deg, transparent 50%, #a9cce0 50%), linear-gradient(135deg, #a9cce0 50%, transparent 50%), linear-gradient(160deg,#19354b55,transparent 75%) !important;
  background-position: right 15px center, right 10px center, center !important;
  background-size: 5px 5px, 5px 5px, 100% 100% !important;
  background-repeat: no-repeat !important;
  cursor: pointer;
}
body select:is([multiple],[size]):not([size="0"]):not([size="1"]) { padding: 5px; }
body select :is(option,optgroup) { background: #10243a; color: var(--s89-text); }
body select option:checked { background: #24566a; color: #fff; }
/* Customizable native picker where supported; other engines retain the normal
   keyboard/touch-accessible OS picker with the styled closed control above. */
@supports (appearance: base-select) and selector(::picker(select)) {
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]),
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"])::picker(select) {
    appearance: base-select;
  }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) {
    background-image: linear-gradient(160deg,#19354b55,transparent 75%) !important;
    padding-inline-end: 10px !important;
    background-position: center !important; background-size: 100% 100% !important;
  }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"])::picker-icon { color: #a9cce0; }
  body select::picker(select) {
    background: #10243a; color: var(--s89-text); border: 1px solid #52758d;
    border-radius: 10px; padding: 5px; box-shadow: 0 10px 32px #0009;
    max-height: min(320px, 55dvh); overflow: auto;
  }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) option {
    padding: 8px 10px; border-radius: 5px; background: transparent;
    font: inherit; white-space: normal;
  }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) option:is(:hover,:focus-visible) { background: #25465e; }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) option:checked { background: #24566a; }
  body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) option::checkmark { color: var(--s89-accent); }
}
/* Native checkbox/radio semantics with drawn, CSS-only indicators. */
body input:is([type=checkbox],[type=radio]) {
  appearance: none !important; -webkit-appearance: none !important;
  display: inline-grid; place-content: center; vertical-align: middle;
  box-sizing: border-box; width: 17px; height: 17px; flex: 0 0 auto;
  padding: 0 !important; margin: 0 4px 0 0;
  border: 1px solid #67839b !important; background: #0b1c2c !important;
  border-radius: 5px !important; cursor: pointer; color: #08232c;
  transition: background-color .12s, border-color .12s;
}
body input[type=radio] { border-radius: 50% !important; }
body input:is([type=checkbox],[type=radio]):checked,
body input[type=checkbox]:indeterminate {
  border-color: var(--s89-accent) !important; background: var(--s89-accent) !important;
}
/* absolute positioning makes the checkmark independent of older display:block
   rules on the voice roster (those intentionally use !important). */
body input:is([type=checkbox],[type=radio]) { position: relative; }
body input:is([type=checkbox],[type=radio])::before {
  content: ""; position: absolute; display: block; opacity: 0;
  left: 50%; top: 50%; pointer-events: none;
}
body input[type=checkbox]::before {
  width: 5px; height: 9px; border: solid #08232c; border-width: 0 2px 2px 0;
  transform: translate(-50%,-62%) rotate(45deg); box-sizing: border-box;
}
body input[type=checkbox]:indeterminate::before {
  width: 9px; height: 2px; background: #08232c; border: 0; transform: translate(-50%,-50%);
}
body input[type=radio]::before {
  width: 7px; height: 7px; border-radius: 50%; background: #08232c; transform: translate(-50%,-50%);
}
body input:is([type=checkbox],[type=radio]):checked::before,
body input[type=checkbox]:indeterminate::before { opacity: 1; }
body input:is([type=checkbox],[type=radio]):not(:disabled):hover { border-color: var(--s89-focus) !important; }
body input:is([type=checkbox],[type=radio]):focus-visible { outline: 2px solid var(--s89-focus); outline-offset: 3px; }
/* Voice roster has an older position:static!important declaration. Preserve
   its sizes and layout; only restore a local positioning context for the mark. */
#viewerSection .viewer-voice-speaker-row input[type=checkbox] { position: relative !important; }
/* Range, color, file inputs: preserve sizing and native interaction. */
body input[type=range] { accent-color: var(--s89-accent); cursor: pointer; }
body input[type=range]:focus-visible, body input[type=color]:focus-visible, body input[type=file]:focus-visible {
  outline: 2px solid var(--s89-focus); outline-offset: 2px; border-radius: 5px;
}
body input[type=color] { background: var(--s89-field); border: 1px solid var(--s89-border); border-radius: 7px; padding: 3px; cursor: pointer; }
body input[type=file] { color: var(--s89-muted); font-family: inherit; max-width: 100%; }
body input[type=file]::file-selector-button {
  background: #1c3b53; color: var(--s89-text); border: 1px solid var(--s89-border);
  border-radius: 7px; padding: 7px 10px; margin-inline-end: 8px; font: inherit; cursor: pointer;
}
body input[type=file]:not(:disabled)::file-selector-button:hover { background: #2a4d65; border-color: #80a9c1; }
/* Ordinary dialog buttons: retain state-specific classes and compact icon controls. */
body :is(dialog,.viewer-settings-panel,.viewer-map-zone-panel,.viewer-pattern-panel,.viewer-chat-panel,.tk-modal) :is(button,input[type=button],input[type=submit],input[type=reset]) {
  font-family: inherit; border-radius: 8px; transition: background-color .14s,border-color .14s,box-shadow .14s;
}
body :is(dialog,.viewer-settings-panel,.viewer-map-zone-panel,.viewer-pattern-panel,.viewer-chat-panel,.tk-modal) button:not([class]):not([aria-pressed]):not([aria-selected]) {
  border: 1px solid var(--s89-border); background: linear-gradient(180deg,#244259,#182e44);
  color: var(--s89-text); padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
body :is(dialog,.viewer-settings-panel,.viewer-map-zone-panel,.viewer-pattern-panel,.viewer-chat-panel,.tk-modal) button:not([class]):not(:disabled):not([aria-pressed]):not([aria-selected]):hover {
  background: #2c5069; border-color: #81a9c1;
}
body :is(button,input[type=button],input[type=submit],input[type=reset]):focus-visible {
  outline: 2px solid var(--s89-focus); outline-offset: 2px;
}
body :is(dialog,.viewer-settings-panel,.viewer-map-zone-panel,.viewer-pattern-panel,.viewer-chat-panel,.tk-modal) button.subtle:not([aria-pressed]):not([aria-selected]) {
  border-color: var(--s89-border); background-image: linear-gradient(160deg,#34566c44,transparent); box-shadow: inset 0 1px 0 #ffffff09;
}
body :is(button,input[type=button],input[type=submit],input[type=reset],input,select,textarea):disabled { cursor: not-allowed !important; }
@media (prefers-reduced-motion: reduce) { body :is(input,select,textarea,button) { transition: none !important; } }
@media (forced-colors: active) {
  body input:is([type=checkbox],[type=radio]), body select:not([multiple]):is(:not([size]),[size="0"],[size="1"]) { appearance: auto !important; -webkit-appearance: auto !important; }
  body input:is([type=checkbox],[type=radio])::before { display: none; }
  body select { background-image: none !important; }
}
