/*
 * Interface standard, applied.
 *
 * 1px borders, 2px margins, 14-16px base font, no neon, no decorative glow.
 * The scale control is anchored top-right and the `+` is the topmost-right
 * element on the screen, so a user scaling up never has to chase it.
 */

:root {
  --ui: 1;
  --bg: #0e1013;
  --panel: #16191e;
  --line: #2a2f36;
  --text: #c8ccd2;
  --dim: #7d848e;
  --atk: #6f9fd8;
  --def: #d88f6f;
  --warn: #c9a227;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: calc(15px * var(--ui)) / 1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* The fix for drag-select in a browser game: kill it on the root, not the
     canvas, or a drag that starts on a sibling element still highlights. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

#bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.brand {
  color: var(--dim);
  padding: 0 6px 0 4px;
  letter-spacing: 0.08em;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--dim);
  padding: 0 4px;
}

input[type="number"] {
  width: 4.5em;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 2px 4px;
  font: inherit;
}

button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 2px 8px;
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: var(--dim);
}

button:active {
  background: var(--panel);
}

/*
 * The scale control does not scale. Its top-right corner is pinned, so the `+`
 * is always in the same place no matter how large the interface gets.
 */
#controls {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  border-right: 0;
}

#controls button {
  min-width: 2em;
  padding: 2px 6px;
}

#scale-label {
  color: var(--dim);
  min-width: 3.5em;
  text-align: center;
}

main {
  display: grid;
  grid-template-columns: 1fr 15em;
  min-height: 0;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#hud {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 2px;
  overflow-y: auto;
  font-size: calc(13px * var(--ui));
}

.unit {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px;
  border-bottom: 1px solid var(--line);
}

.unit.dead {
  color: var(--dim);
  text-decoration: line-through;
}

.unit .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit .hp {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.unit.atk .name {
  color: var(--atk);
}

.unit.def .name {
  color: var(--def);
}

#status {
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  padding: 2px 6px;
  font-size: calc(13px * var(--ui));
}
