/* GRAYLINE v0.5.3: Commander Clarity and portable-wrapper coherence. */

html,
body,
#graylineApp,
#gameShell {
  max-width: 100%;
  overflow-x: clip;
}

.title-screen {
  overflow-x: clip !important;
  overscroll-behavior-x: none;
}

.title-screen .title-content {
  width: min(1500px, calc(100% - 28px)) !important;
  max-width: calc(100% - 28px);
}

html.grayline-embedded #titleFullscreenButton {
  display: none !important;
}

.command-panel {
  grid-template-rows: 43px 44px auto minmax(0, 1fr) !important;
}

.command-context-copy small {
  overflow: hidden !important;
  line-height: 1.24 !important;
  text-overflow: ellipsis;
  white-space: normal !important;
}

.commander-ribbon[hidden] {
  display: none !important;
}

.commander-ribbon {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 35px;
  padding: 5px 7px 5px 9px;
  border-bottom: 1px solid #4b4b4b;
  background: linear-gradient(90deg, #111, #040404 52%, #0a0a0a);
  box-shadow: inset 3px 0 0 #cfcfcf;
}

.commander-ribbon.invalid {
  border-bottom-color: #777;
  background: repeating-linear-gradient(135deg, #0d0d0d 0 8px, #060606 8px 16px);
  box-shadow: inset 3px 0 0 #fff;
}

.commander-ribbon-state {
  min-width: 48px;
  padding: 3px 5px;
  border: 1px solid #555;
  color: #e6e6e6;
  font: 750 calc(9px * var(--ui-text-scale, 1))/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-align: center;
}

.commander-ribbon.invalid .commander-ribbon-state {
  border-style: dashed;
  border-color: #d5d5d5;
  color: #fff;
}

.commander-ribbon-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.commander-ribbon-copy strong,
.commander-ribbon-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commander-ribbon-copy strong {
  color: #f1f1f1;
  font: 750 calc(10px * var(--ui-text-scale, 1))/1.15 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .11em;
}

.commander-ribbon-copy small {
  color: #aaa;
  font-size: calc(9px * var(--ui-text-scale, 1));
  line-height: 1.18;
}

#commanderRibbonCancel {
  min-width: 58px;
  min-height: 25px;
  padding: 3px 7px;
  border-color: #606060;
  color: #ddd;
  font-size: calc(9px * var(--ui-text-scale, 1));
}

html.command-mode-active:not(.research-deck-expanded) {
  --deck-height: 278px;
}

html.command-mode-active.research-deck-expanded {
  --deck-height: clamp(338px, 39vh, 364px);
}

.command-context-actions button:not([hidden]) {
  opacity: 1;
}

.command-context-actions button:disabled {
  opacity: .36;
}

#commandPageIndicator:not([hidden]) {
  color: #aaa;
}

.selection-stats .stat-row strong {
  overflow-wrap: anywhere;
}

@media (max-width: 1100px), (max-height: 680px) {
  .commander-ribbon {
    gap: 6px;
    min-height: 32px;
    padding-block: 4px;
  }
  .commander-ribbon-copy small {
    max-width: 44vw;
  }
  html.command-mode-active:not(.research-deck-expanded) {
    --deck-height: 256px;
  }
}
