/* Outpost Command.
 *
 * arcade.css does the frame: bars, buttons, dialogs, the stage. This is what
 * a strategy game adds: the view with its toasts, and the panel along the
 * bottom (map, what is selected, what it can do).
 */

.rts-page {
  --rts-hud-h: 196px;
  --rts-good: #2f8f46;
  --rts-bad: #c0392b;
  --rts-ore: #17a2b8;
}

.rts-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rts-screen[hidden] { display: none; }

.rts-shell .ar-bar select,
.rts-shell .ar-field select,
.rts-shell .ar-field input { font-family: inherit; }

.rts-sep {
  align-self: stretch;
  margin: 0 2px;
  border: 0;
  border-left: 1px solid var(--rule);
}

#ed-stage { min-height: 22rem; }


/* ------------------------------------------------------------ the stage */

.rts-stage {
  display: flex;
  flex-direction: column;
  background: #10131a;
}

.rts-view {
  position: relative;
  flex: 1;
  min-height: 0;
}

.rts-view canvas { cursor: default; }
.rts-view.is-aim canvas { cursor: crosshair; }

.rts-toasts {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.rts-toast {
  max-width: min(32rem, 90%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 34, 0.88);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: rts-toast 4s forwards;
}

.rts-toast.is-bad { background: rgba(176, 48, 36, 0.92); }
.rts-toast.is-good { background: rgba(38, 124, 66, 0.92); }

@keyframes rts-toast {
  0%   { opacity: 0; transform: translateY(-6px); }
  8%   { opacity: 1; transform: none; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.rts-mode {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(20, 24, 34, 0.88);
  color: #fff;
  font-size: 0.92rem;
  pointer-events: none;
}


/* ------------------------------------------------------------- the panel */

.rts-hud {
  flex: 0 0 var(--rts-hud-h);
  display: grid;
  grid-template-columns: 196px minmax(12rem, 1fr) minmax(15rem, 22rem);
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border-top: 2px solid var(--rule-strong);
  color: var(--ink);
}

.ar-stage .rts-hud canvas {
  position: static;
  width: 180px;
  height: 180px;
  border: 2px solid var(--rule-strong);
  border-radius: 6px;
  cursor: pointer;
}

.rts-info {
  min-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
}

.rts-info h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.rts-info p { margin: 2px 0; color: var(--ink-muted); }

.rts-bar {
  height: 8px;
  margin: 4px 0 6px;
  border-radius: 4px;
  background: var(--rule);
  overflow: hidden;
}

.rts-bar > i {
  display: block;
  height: 100%;
  background: var(--rts-good);
}

.rts-bar.is-work > i { background: var(--accent); }

.rts-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 150px;
  overflow: hidden;
}

.rts-chip {
  position: relative;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.78rem;
  cursor: pointer;
}

.rts-chip i {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 4px;
  background: var(--rts-good);
  transform-origin: left;
}

.rts-queue {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}

.rts-queue button {
  position: relative;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.78rem;
  cursor: pointer;
}

.rts-queue button i {
  position: absolute;
  left: 3px;
  bottom: 3px;
  height: 4px;
  background: var(--accent);
}

.rts-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 58px;
  align-content: start;
  gap: 6px;
}

.rts-card button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 2px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.15;
  cursor: pointer;
}

.rts-card button:hover { background: var(--accent-soft); }
.rts-card button b { font-size: 0.95rem; }
.rts-card button small { color: var(--ink-faint); font-size: 0.78rem; }
.rts-card button .key {
  display: inline-block;
  min-width: 1.15em;
  margin-left: 4px;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--rule);
  font-size: 0.72rem;
  font-weight: 700;
}

.rts-card button.is-poor { opacity: 0.55; }
.rts-card button.is-locked { opacity: 0.35; cursor: not-allowed; }
.rts-card button.is-on { outline: 2px solid var(--accent); }


/* ------------------------------------------------------- dialogs, editor */

.rts-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 8px 0;
}

.rts-choice label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

.rts-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 8px 0;
}

.rts-fields[hidden] { display: none; }

.rts-fields button {
  min-height: 2.4rem;
  padding: 0 0.9rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.rts-text {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.rts-stats {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 4px 18px;
  margin: 10px 0;
  font-variant-numeric: tabular-nums;
}

.rts-stats b { text-align: right; }

.rts-phone {
  margin: 20px;
  padding: 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
}

.rts-page.is-phone .rts-screen { display: none; }

/* A short window: keep the picture, shrink the panel. */
@media (max-height: 700px) {
  .rts-page { --rts-hud-h: 150px; }
  .ar-stage .rts-hud canvas { width: 134px; height: 134px; }
  .rts-hud { grid-template-columns: 150px minmax(10rem, 1fr) minmax(14rem, 20rem); }
}
