/* Sumo Akimbo Engine Hub — tool board for index.html only.
   Tokens stay on the game palette (gold / ember / sand on near-black).
   Loaded from the engine entry, not from play.html. */

#engineHub {
  --eh-bg: #100e0c;
  --eh-bar: #181512;
  --eh-line: rgba(232, 213, 181, 0.16);
  --eh-text: #f4ecdf;
  --eh-dim: #b7a48a;
  --eh-faint: rgba(232, 213, 181, 0.45);
  --eh-accent: var(--gold);
  --eh-play: var(--ember);
  --eh-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--eh-text);
  color-scheme: dark;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 193, 75, 0.08), transparent 46%),
    var(--eh-bg);
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: 0.01em;
  pointer-events: auto;
}

#engineHub.hidden {
  display: none !important;
}

body.engine-hub-open #menuOverlay,
body.engine-hub-open #loadoutOverlay {
  visibility: hidden;
}

#engineHub button {
  font-family: inherit;
  color: inherit;
}

#engineHub button:focus-visible,
#engineHub input:focus-visible,
.engine-session-back:focus-visible {
  outline: 2px solid var(--eh-accent, var(--gold));
  outline-offset: 2px;
}

.eh-top {
  display: flex;
  align-items: center;
  height: 56px;
  flex: 0 0 56px;
  padding: 0 22px;
  background: var(--eh-bar);
  border-bottom: 1px solid var(--eh-line);
}

.eh-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.eh-mark {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  background:
    linear-gradient(var(--eh-accent), var(--eh-accent)) 0 0 / 6px 2px no-repeat,
    linear-gradient(var(--eh-accent), var(--eh-accent)) 0 0 / 2px 6px no-repeat,
    var(--eh-play);
}

.eh-brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.eh-brand-meta {
  font-size: 12px;
  line-height: 1.2;
  color: var(--eh-dim);
}

.eh-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.eh-stage {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 22px 36px;
}

.eh-lead {
  margin: 0 0 18px;
  max-width: 36ch;
  font-size: 15px;
  line-height: 1.45;
  color: var(--eh-dim);
}

.eh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.eh-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 112px;
  padding: 16px 16px 14px;
  border: 1px solid var(--eh-line);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 80ms ease;
}

.eh-card:hover {
  border-color: rgba(240, 193, 75, 0.55);
  background: rgba(240, 193, 75, 0.08);
}

.eh-card:active {
  transform: translateY(1px);
}

.eh-card-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.eh-card-hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--eh-dim);
}

.eh-card-quiet {
  background: transparent;
}

.eh-card-quiet .eh-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--eh-dim);
}

.eh-banner {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(240, 193, 75, 0.4);
  background: rgba(240, 193, 75, 0.08);
  color: var(--eh-text);
  font-size: 14px;
}

.eh-fold {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--eh-line);
  background: rgba(0, 0, 0, 0.22);
}

.eh-copy {
  margin: 0 0 12px;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.45;
  color: var(--eh-dim);
}

.eh-cmd-line {
  margin: 0 0 12px;
  font-family: var(--eh-mono);
  font-size: 13px;
  color: var(--eh-text);
}

.eh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eh-btn {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--eh-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--eh-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.eh-btn:hover {
  border-color: rgba(240, 193, 75, 0.5);
}

.eh-btn-primary {
  border-color: transparent;
  background: var(--eh-accent);
  color: #1a1408;
}

.eh-kicker {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--eh-faint);
}

.eh-map-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eh-map-picks .eh-kicker {
  flex: 1 0 100%;
}

.eh-text-btn {
  appearance: none;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--eh-line);
  background: transparent;
  color: var(--eh-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.eh-text-btn:hover {
  border-color: rgba(240, 193, 75, 0.5);
}

.eh-result {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px 8px;
  font-size: 14px;
  color: var(--eh-text);
  white-space: pre-wrap;
}

.eh-result.hidden {
  display: none !important;
}

.eh-fold .eh-result {
  max-width: none;
  margin: 12px 0 0;
  padding: 0;
}

.eh-status {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0 16px;
  background: var(--eh-bar);
  border-top: 1px solid var(--eh-line);
  font-size: 13px;
  font-weight: 600;
}

.eh-status-spacer {
  flex: 1 1 auto;
}

.eh-status-quiet {
  font-size: 11px;
  font-weight: 500;
  color: var(--eh-faint);
}

.eh-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6a5c48;
  flex: 0 0 8px;
}

.eh-pip.is-live {
  background: var(--eh-accent);
  animation: eh-pip-pulse 1.8s ease-in-out infinite;
}

.eh-palette {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(8, 6, 5, 0.62);
}

.eh-palette.hidden {
  display: none !important;
}

.eh-palette-panel {
  width: min(560px, 100%);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: #161310;
  border: 1px solid var(--eh-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.eh-palette:not(.hidden) .eh-palette-panel {
  animation: eh-palette-in 160ms ease;
}

#engineHubPaletteInput {
  appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--eh-line);
  background: transparent;
  color: var(--eh-text);
  font: inherit;
  font-size: 15px;
}

.eh-palette-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  overflow: auto;
  flex: 1 1 auto;
}

.eh-cmd {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--eh-text);
  text-align: left;
  cursor: pointer;
}

.eh-palette .eh-cmd {
  font-family: inherit;
  margin: 0;
}

.eh-cmd.is-active,
.eh-cmd:hover {
  background: rgba(240, 193, 75, 0.12);
}

.eh-cmd-id {
  font-size: 14px;
  font-weight: 600;
}

.eh-cmd-sum {
  grid-column: 1;
  font-size: 12px;
  color: var(--eh-dim);
}

.eh-cmd-kind {
  grid-row: 1;
  grid-column: 2;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--eh-faint);
}

.eh-palette-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--eh-line);
  font-size: 12px;
  color: var(--eh-dim);
}

.eh-empty {
  padding: 12px;
  color: var(--eh-dim);
  font-size: 13px;
}

.engine-session-bar {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 14px;
  background: rgba(16, 14, 12, 0.92);
  border: 1px solid rgba(232, 213, 181, 0.28);
  color: #f4ecdf;
  font-family: var(--font-ui);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.engine-session-bar.hidden {
  display: none !important;
}

.engine-session-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.engine-session-back {
  appearance: none;
  border: 0;
  background: var(--ember);
  color: #fff8f4;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.engine-session-back:hover {
  filter: brightness(1.08);
}

@keyframes eh-pip-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(240, 193, 75, 0.55);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(240, 193, 75, 0);
  }
}

@keyframes eh-palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .eh-pip.is-live,
  .eh-card,
  .eh-btn,
  .eh-palette:not(.hidden) .eh-palette-panel {
    animation: none;
    transition: none;
  }
}

@media (max-width: 640px) {
  .eh-top {
    padding: 0 14px;
  }

  .eh-stage {
    padding: 18px 14px 28px;
  }

  .eh-grid {
    grid-template-columns: 1fr;
  }

  .eh-card {
    min-height: 0;
  }

  .eh-card-title {
    font-size: 20px;
  }

  .eh-status-quiet {
    display: none;
  }

  .engine-session-bar {
    gap: 8px;
    padding-left: 10px;
  }
}
