:root {
  --bg: #0b0b12;
  --panel: #15151f;
  --panel-2: #1c1c29;
  --ink: #f4f1ea;
  --muted: #9a97a8;
  --border: #2b2b3a;

  --Seagrim: #4fb0a5;
  --Brannigan: #e0a640;
  --Moreau: #9b6bd1;
  --Whitewood: #cfd8e3;
  --Falk: #d1495b;
  --Vane: #4c9a4c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, sans-serif;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem;
}

h1.title {
  font-size: clamp(1.2rem, 5vw, 2rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  margin: 0.3rem 0 0.6rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.6rem;
}

.topbar .stat { font-size: 0.8rem; color: var(--muted); }
.topbar .stat b { color: var(--ink); font-size: 0.95rem; }

.initiative-dial {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.chip .dot {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  flex: none;
}

.chip.active {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.districts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.district {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  min-width: 0;
}

.district-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  gap: 0.3rem;
}

.district-header h3 {
  margin: 0;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.district-header .chip { font-size: 0.62rem; padding: 0.1rem 0.35rem; flex: none; }

.establishment {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem;
  margin-bottom: 0.25rem;
}

.establishment:last-child { margin-bottom: 0; }

.establishment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  margin-bottom: 0.2rem;
  gap: 0.2rem;
}

.establishment-header span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.establishment.selectable {
  cursor: pointer;
  border-color: #6a6a8a;
}

.establishment.selectable:hover {
  border-color: var(--ink);
}

.establishment.used {
  opacity: 0.55;
}

.slots {
  display: flex;
  gap: 0.2rem;
}

.slot {
  flex: 1;
  height: 1.15rem;
  border-radius: 4px;
  border: 1px dashed var(--border);
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-width: 0;
}

.slot.filled {
  border-style: solid;
  border-color: transparent;
}

.slot-name {
  display: block;
  width: 100%;
  padding: 0 0.15rem;
  font-size: 0.5rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--card-color, var(--border));
  border-radius: 7px;
  padding: 0.4rem 0.6rem 0.4rem 0.5rem;
  background: var(--panel-2);
  cursor: pointer;
  min-width: 100px;
}

.card .family {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card .name {
  font-size: 0.78rem;
  color: var(--muted);
}

.card .role {
  margin-top: 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card.role-seat { outline: 2px solid var(--ink); }
.card.role-staff { outline: 2px dashed var(--ink); }
.card.role-discard { outline: 2px solid var(--Falk); opacity: 0.6; }

button {
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.seat-summary {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.card-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  border-left: 3px solid var(--card-color, var(--border));
  background: var(--panel-2);
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}

.log {
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column-reverse;
}

.log div { padding: 0.1rem 0; border-bottom: 1px dotted var(--border); }

.replace-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.opponents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.your-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem;
  align-items: start;
  margin-bottom: 0.6rem;
}

.your-area .panel { margin-bottom: 0; }

.opponent {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.72rem;
}

.opponent .name { font-weight: 700; margin-bottom: 0.25rem; font-size: 0.75rem; }

.end-screen h2 { color: var(--ink); font-size: 1.3rem; }
