:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #121812;
  color: #f4f3e8;
}

* { box-sizing: border-box; }

html, body, #app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body { background: #172016; }

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#game.dragging { cursor: grabbing; }

.topbar {
  position: fixed;
  inset: 16px 16px auto 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  text-shadow: 0 2px 5px #000;
}

h1 { margin: 0; font-size: clamp(1.25rem, 3vw, 2rem); letter-spacing: .05em; }
.topbar p { margin: 2px 0 0; color: #d7ddcc; font-size: .8rem; }
.clock { padding: 8px 12px; font-weight: 800; background: rgba(14, 19, 14, .8); border: 1px solid #66705e; border-radius: 7px; }

.panel {
  position: fixed;
  background: rgba(14, 19, 14, .89);
  border: 1px solid rgba(180, 192, 164, .38);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  backdrop-filter: blur(7px);
}

.scoreboard {
  top: 74px;
  right: 16px;
  width: min(270px, calc(100vw - 32px));
  padding: 10px;
}

.faction-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 2px;
  font-size: .82rem;
}

.faction-swatch { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.faction-name { font-weight: 700; }
.faction-stat { color: #d7ddcc; font-variant-numeric: tabular-nums; }
.faction-stance { grid-column: 2 / 4; color: #9aa38f; font-size: .68rem; }

.control-bar { grid-column: 2 / 4; height: 3px; background: #394034; border-radius: 2px; overflow: hidden; }
.control-bar > i { display: block; height: 100%; transition: width .2s linear; }

.controls {
  left: 16px;
  bottom: 34px;
  width: 270px;
  padding: 12px;
  display: grid;
  gap: 9px;
}

#game.placing { cursor: crosshair; }

.button-row { display: flex; gap: 6px; }
button, select, input {
  min-height: 34px;
  border: 1px solid #6f7967;
  border-radius: 5px;
  background: #283025;
  color: inherit;
  font: inherit;
}

button { padding: 0 11px; cursor: pointer; font-weight: 700; }
button:hover:not(:disabled) { background: #394534; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #789d36; border-color: #a7c65f; color: #10150d; }

label { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 8px; font-size: .78rem; color: #cbd2c1; }
select, input { width: 100%; padding: 0 8px; }
.hint { margin: 0; color: #98a18e; font-size: .68rem; line-height: 1.35; }

.status {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(10, 14, 10, .88);
  border: 1px solid #7e8974;
}

.status.hidden, .hidden { display: none; }

.winner {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 7, .65);
  display: grid;
  place-items: center;
}

.winner.hidden { display: none; }
.winner-card { padding: 24px; min-width: 260px; text-align: center; background: #1b2319; border: 1px solid #87937d; border-radius: 10px; }
.winner-card p { font-size: 1.2rem; font-weight: 800; }

footer {
  position: fixed;
  right: 12px;
  bottom: 8px;
  color: rgba(245, 245, 231, .72);
  font-size: .62rem;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}

@media (max-width: 620px) {
  .scoreboard { top: 68px; right: 8px; width: 185px; padding: 7px; }
  .controls { left: 8px; bottom: 25px; width: 210px; padding: 9px; }
  .topbar { inset: 10px 10px auto; }
  .clock { font-size: .75rem; }
  footer { right: 6px; bottom: 5px; }
}
