* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: #101014;
  color: #f5f5f5;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  background: #181822;
  border-bottom: 1px solid #2c2c3a;
}

main {
  padding: 24px;
}

h1, h2, h3, p {
  margin-top: 0;
}

button {
  cursor: pointer;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: #6c63ff;
  color: white;
  font-weight: 700;
}

button:hover {
  opacity: 0.9;
}

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

.danger {
  background: #d94c4c;
}

.full-width {
  width: 100%;
}

.hidden {
  display: none !important;
}

.muted {
  color: #aaa;
}

.panel {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px;
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
}

label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #44445a;
  background: #101014;
  color: white;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 18px;
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
}

.controls {
  display: grid;
  grid-template-columns: 160px 220px 160px 160px;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 24px;
}

.players-panel,
.preview-panel {
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.player-box {
  padding: 12px;
  margin-bottom: 12px;
  background: #222231;
  border-radius: 12px;
  border: 1px solid transparent;
}

.player-box.active {
  border-color: #6c63ff;
  box-shadow: 0 0 12px rgba(108, 99, 255, 0.4);
}

.player-box.retired {
  opacity: 0.55;
}

.commander-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.choice-box {
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
  padding: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 18px;
}

.card {
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  transition: 0.15s transform, 0.15s opacity;
}

.card:hover {
  transform: translateY(-2px);
}

.card.illegal {
  opacity: 0.3;
}

.card img {
  width: 100%;
  border-radius: 12px;
  background: #333;
}

.card h3 {
  margin: 10px 0 4px;
  font-size: 16px;
}

.card p {
  font-size: 13px;
  color: #bbb;
}

.card button {
  margin-top: auto;
}

.card-preview img {
  width: 100%;
  border-radius: 14px;
}

.color-pips {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.pip {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.pip-W {
  background: #f8f0c6;
  color: #111;
}

.pip-U {
  background: #4aa3df;
  color: white;
}

.pip-B {
  background: #2b2b2b;
  color: white;
}

.pip-R {
  background: #d94c3d;
  color: white;
}

.pip-G {
  background: #3f8f4e;
  color: white;
}

.pip-C {
  background: #b8b8b8;
  color: #111;
}

.mini-list {
  max-height: 300px;
  overflow: auto;
  font-size: 14px;
  color: #ccc;
}

.mini-list div {
  padding: 4px 0;
  border-bottom: 1px solid #2c2c3a;
}

.decklists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.decklist,
.land-box,
.drafted-box {
  background: #181822;
  border: 1px solid #2c2c3a;
  border-radius: 16px;
  padding: 16px;
}

textarea {
  min-height: 420px;
  font-family: monospace;
}

.land-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

hr {
  border: none;
  border-top: 1px solid #2c2c3a;
  margin: 18px 0;
}

@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .players-panel,
  .preview-panel {
    position: static;
  }

  .controls {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .status-bar {
    flex-direction: column;
  }

  .commander-choices {
    grid-template-columns: 1fr 1fr;
  }
}

.room-info {
  max-width: none;
  margin-bottom: 24px;
}

.room-info input {
  font-family: monospace;
}

.notice {
  padding: 12px;
  border-radius: 12px;
  background: #222231;
  border: 1px solid #44445a;
  margin-bottom: 16px;
}

.success {
  color: #9be59b;
}

.warning {
  color: #ffd27d;
}

.room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.claim-slot-area {
  display: grid;
  gap: 12px;
}

.claim-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.claim-button {
  background: #222231;
  border: 1px solid #44445a;
}

.claim-button.claimed {
  background: #6c63ff;
  border-color: #6c63ff;
}

.claim-status {
  padding: 12px;
  border-radius: 12px;
  background: #222231;
  border: 1px solid #44445a;
}

.success {
  color: #9be59b;
}

.warning {
  color: #ffd27d;
}