:root {
  color-scheme: dark;
  --bg: #0e1013;
  --panel: #171a20;
  --panel-2: #20252d;
  --table: #11161b;
  --line: #313946;
  --line-soft: #242b35;
  --text: #f5f7fa;
  --muted: #a2adba;
  --accent: #34d6b4;
  --accent-2: #f3c65f;
  --danger: #f06f7d;
  --future: #8bb7ff;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

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

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0d10;
  color: var(--text);
  padding: 0 9px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.1rem;
  letter-spacing: 0;
}

h2 {
  font-size: 0.92rem;
  letter-spacing: 0;
}

.game-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(760px, 1fr);
  gap: 10px;
  padding: 10px;
}

.lobby-rail,
.tabletop {
  min-height: 0;
  min-width: 0;
}

.lobby-rail {
  display: grid;
  align-content: start;
  gap: 10px;
}

.tabletop {
  display: grid;
  grid-template-rows: 188px 48px minmax(150px, 0.8fr) 144px 224px;
  gap: 10px;
}

.brand-block,
.rail-panel,
.players-band,
.zone,
.datajack-card,
.control-panel,
.choice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px var(--shadow);
}

.brand-block {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 12px;
}

.brand-block > .brand-logo {
  width: 52px;
  height: 52px;
  max-width: 52px;
  max-height: 52px;
  object-fit: contain;
  display: block;
}

.brand-block p,
.panel-title span,
.zone-title span {
  color: var(--muted);
}

.rail-panel,
.control-panel,
.choice-panel {
  display: grid;
  gap: 10px;
  padding: 11px;
}

.control-panel {
  align-content: start;
}

.connection-row,
.button-grid,
.lay-low-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-online {
  color: var(--accent);
  border-color: rgba(52, 214, 180, 0.7);
}

.status-waiting {
  color: var(--accent-2);
  border-color: rgba(243, 198, 95, 0.7);
}

.status-offline {
  color: var(--danger);
}

.panel-title,
.zone-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ghost-button {
  min-height: 28px;
  padding: 0 9px;
  background: transparent;
  color: var(--muted);
}

.event-log {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 410px);
  overflow: auto;
}

.event {
  border-left: 3px solid var(--line);
  padding-left: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.event.error {
  border-color: var(--danger);
  color: #ffd0d5;
}

.players-band {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.player-seats {
  display: grid;
  grid-template-columns: repeat(6, minmax(108px, 1fr));
  gap: 8px;
  min-height: 0;
  align-items: stretch;
}

.player-seat {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(54px, 1fr);
  gap: 6px;
  align-content: start;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #10141a;
  padding: 10px 8px 8px;
  overflow: visible;
  min-height: 0;
}

.player-seat.is-me {
  border-color: var(--accent);
}

.player-seat.is-target {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}

.player-seat.is-current-datajack::before,
.player-seat.is-future-datajack::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
}

.player-seat.is-current-datajack::before {
  top: 0;
  background: var(--accent);
}

.player-seat.is-future-datajack::after {
  bottom: 0;
  background: var(--future);
}

.seat-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
  min-width: 0;
}

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

.seat-stats,
.seat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.chip.active {
  color: var(--accent-2);
  border-color: rgba(243, 198, 95, 0.65);
}

.chip.current {
  color: var(--accent);
  border-color: rgba(52, 214, 180, 0.65);
}

.chip.future {
  color: var(--future);
  border-color: rgba(139, 183, 255, 0.7);
}

.hardware-strip {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  min-height: 54px;
  overflow: visible;
}

.hardware-token {
  width: 28px;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: transparent;
}

.hardware-token.is-target {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(243, 198, 95, 0.25);
}

.hardware-token img {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  object-fit: cover;
}

.datajack-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.datajack-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
}

.datajack-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.datajack-card.current strong {
  color: var(--accent);
}

.datajack-card.future strong {
  color: var(--future);
}

.zone {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  background: var(--table);
}

.web-cards,
.hand-cards {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
}

.stack-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 4px 2px 12px;
}

.game-card {
  position: relative;
  flex: 0 0 112px;
  display: grid;
  gap: 5px;
  align-content: start;
  min-height: 158px;
  border-radius: 7px;
  padding: 6px;
  background: #0c1015;
  text-align: left;
}

.hand-cards .game-card {
  flex-basis: 128px;
  min-height: 190px;
}

.game-card img {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 5px;
  object-fit: cover;
  background: #050608;
}

.game-card span {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.game-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(52, 214, 180, 0.24);
}

.game-card.is-unplayable img {
  filter: grayscale(0.85) brightness(0.65);
}

.game-card.is-target {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(243, 198, 95, 0.25);
}

.game-card.is-picked {
  border-color: var(--future);
  box-shadow: 0 0 0 2px rgba(139, 183, 255, 0.25);
}

.game-card .order-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--future);
  color: #07101c;
  font-size: 0.78rem;
  font-weight: 1000;
}

.stack-item {
  flex: 0 0 210px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0c1015;
  padding: 7px;
  text-align: left;
}

.stack-item.is-target {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(243, 198, 95, 0.25);
}

.stack-item img {
  width: 58px;
  height: 82px;
  border-radius: 4px;
  object-fit: cover;
}

.stack-item strong,
.stack-item span {
  display: block;
}

.stack-item span {
  color: var(--muted);
  font-size: 0.75rem;
}

.floating-preview {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  width: 280px;
  max-width: 24vw;
  border: 1px solid rgba(139, 183, 255, 0.5);
  border-radius: 9px;
  background: #07090c;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.55);
  padding: 8px;
}

.floating-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  object-fit: contain;
}

.selection-summary,
.context-tools {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0c1015;
  padding: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.context-tools {
  display: grid;
  gap: 8px;
}

.context-tools .tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.choice-panel p {
  color: var(--muted);
  line-height: 1.35;
}

.choice-actions {
  display: grid;
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.84rem;
  align-self: center;
}

.hidden {
  display: none !important;
}
