/* MTG Precon Spinner - Styles */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

/* ===== MAIN LAYOUT ===== */

.app-container {
  display: grid;
  grid-template-areas:
    "header header header"
    "sidebar wheel info"
    "sidebar spin  info";
  grid-template-columns: 200px 1fr 300px;
  grid-template-rows: 56px 1fr 70px;
  height: 100vh;
  gap: 0;
}

/* ===== HEADER ===== */

.header {
  grid-area: header;
  background: #16213e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #2a2a4a;
  z-index: 10;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #B8860B;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f3460;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.room-info strong {
  color: #FFD700;
  font-family: 'Consolas', 'Courier New', monospace;
  letter-spacing: 1px;
}

.room-info .copy-btn {
  background: none;
  border: 1px solid #4a4a6a;
  color: #ccc;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.room-info .copy-btn:hover {
  background: #4a4a6a;
  color: #fff;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-actions button {
  background: #0f3460;
  border: 1px solid #4a4a6a;
  color: #e0e0e0;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.header-actions button:hover {
  background: #1a4a7a;
  border-color: #6a6a8a;
}

/* ===== USER SIDEBAR ===== */

.user-sidebar {
  grid-area: sidebar;
  background: #16213e;
  border-right: 1px solid #2a2a4a;
  padding: 16px;
  overflow-y: auto;
}

.user-sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8888aa;
  margin-bottom: 12px;
}

.user-list {
  list-style: none;
}

.user-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 14px;
  transition: background 0.15s;
}

.user-list li:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-list .user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  flex-shrink: 0;
}

.user-list .user-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.user-list .no-room {
  color: #666;
  font-style: italic;
  font-size: 13px;
}

.user-list .user-you {
  font-size: 10px;
  color: #888;
  margin-left: auto;
}

/* ===== WHEEL AREA ===== */

.wheel-area {
  grid-area: wheel;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

#wheel-canvas {
  max-width: 100%;
  max-height: 100%;
  cursor: pointer;
}

.cursor-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* ===== REMOTE CURSORS ===== */

.remote-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  transition: left 0.06s linear, top 0.06s linear;
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.remote-cursor .cursor-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 14px solid var(--cursor-color, #FF6B6B);
  transform: rotate(-30deg);
  transform-origin: top left;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.remote-cursor .cursor-label {
  background: var(--cursor-color, #FF6B6B);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  margin-left: 8px;
  margin-top: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ===== SPIN CONTROLS ===== */

.spin-controls {
  grid-area: spin;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16213e;
  border-top: 1px solid #2a2a4a;
}

.spin-btn {
  background: linear-gradient(135deg, #B8860B, #DAA520, #B8860B);
  color: #1a1a2e;
  border: none;
  padding: 12px 48px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(184, 134, 11, 0.3);
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(184, 134, 11, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(0);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== DECK INFO PANEL ===== */

.deck-info {
  grid-area: info;
  background: #16213e;
  border-left: 1px solid #2a2a4a;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.deck-info-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #555;
  font-size: 14px;
  padding: 20px;
  line-height: 1.6;
}

.deck-info-content {
  animation: fadeIn 0.3s ease;
}

.deck-info-content h2 {
  color: #FFD700;
  font-size: 20px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.deck-info-content .deck-set {
  color: #aaa;
  font-size: 14px;
  margin-bottom: 12px;
}

.deck-info-content .deck-commander {
  color: #ccc;
  font-size: 14px;
  margin-bottom: 16px;
}

.deck-info-content .deck-commander strong {
  color: #e0e0e0;
}

.color-identity {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.pip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.2);
}

.pip-w { background: #F5E6B8; color: #333; }
.pip-u { background: #0E4D92; color: #fff; }
.pip-b { background: #2C2033; color: #ccc; border-color: #555; }
.pip-r { background: #C0392B; color: #fff; }
.pip-g { background: #1E8449; color: #fff; }
.pip-c { background: #A0A0A0; color: #333; }

.moxfield-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #4a148c;
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  margin-top: auto;
}

.moxfield-link:hover {
  background: #6a1b9a;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(74, 20, 140, 0.4);
}

.moxfield-link::before {
  content: '\2197';
  font-size: 16px;
}

/* ===== LOBBY MODAL ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: #16213e;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 36px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-content h2 {
  text-align: center;
  color: #B8860B;
  margin-bottom: 24px;
  font-size: 22px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: #0f3460;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #B8860B;
}

.form-group input::placeholder {
  color: #555;
}

.lobby-actions {
  margin-top: 20px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #B8860B, #DAA520);
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: #555;
  font-size: 13px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2a4a;
}

.divider span {
  padding: 0 12px;
}

.join-group {
  display: flex;
  gap: 8px;
}

.join-group input {
  flex: 1;
  padding: 10px 14px;
  background: #0f3460;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 15px;
  text-transform: uppercase;
  font-family: 'Consolas', 'Courier New', monospace;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s;
}

.join-group input:focus {
  border-color: #B8860B;
}

.join-group input::placeholder {
  text-transform: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
  letter-spacing: normal;
}

.btn-secondary {
  padding: 10px 20px;
  background: #0f3460;
  border: 1px solid #4a4a6a;
  color: #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #1a4a7a;
}

.solo-note {
  text-align: center;
  margin-top: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-link:hover {
  color: #999;
}

/* ===== STATUS BAR / ERRORS ===== */

.status-banner {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #e74c3c;
  color: #fff;
  padding: 8px 20px;
  border-radius: 0 0 8px 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideDown 0.3s ease;
}

.status-banner.hidden {
  display: none;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -100%); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(184, 134, 11, 0); }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
  .app-container {
    grid-template-areas:
      "header header"
      "wheel  info"
      "spin   info";
    grid-template-columns: 1fr 260px;
    grid-template-rows: 56px 1fr 70px;
  }

  .user-sidebar {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-container {
    grid-template-areas:
      "header"
      "wheel"
      "spin"
      "info";
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr 60px auto;
  }

  .deck-info {
    max-height: 200px;
  }

  .user-sidebar {
    display: none;
  }

  .header h1 {
    font-size: 14px;
  }

  .spin-btn {
    padding: 10px 32px;
    font-size: 16px;
  }
}
