/* Pastel Sandfall — TV-safe fullscreen layout and soft pastel HUD styling */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #15141c;
  color: #f2eef9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #15141c;
}

#sim-canvas,
#overlay-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  max-width: 177.78vh;
  max-height: 56.25vw;
  display: block;
}

#sim-canvas {
  background: #1e1d26;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
}

#overlay-canvas {
  cursor: none;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  max-width: 177.78vh;
  max-height: 56.25vw;
  margin: auto;
  pointer-events: none;
  padding: 2.2% 2.8%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.25s ease;
}

.hud.hidden {
  opacity: 0;
}

.hud-top {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.status-pill {
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(28, 27, 38, 0.72);
  border: 1px solid rgba(242, 238, 249, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #dfd9ec;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8c9aa8;
}

.status-dot.active {
  background: #a8e6cf;
  box-shadow: 0 0 8px rgba(168, 230, 207, 0.75);
}

.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.player-card {
  min-width: 210px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(28, 27, 38, 0.76);
  border: 1px solid rgba(242, 238, 249, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.player-card.p1 {
  border-color: rgba(168, 230, 207, 0.45);
}

.player-card.p2 {
  border-color: rgba(255, 183, 178, 0.45);
}

.player-card.inactive {
  opacity: 0.48;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.player-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
}

.player-card.p1 .player-tag {
  background: rgba(168, 230, 207, 0.22);
  color: #a8e6cf;
}

.player-card.p2 .player-tag {
  background: rgba(255, 183, 178, 0.22);
  color: #ffb7b2;
}

.player-device {
  font-size: 12px;
  color: #b5aec8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}

.player-material {
  display: flex;
  align-items: center;
  gap: 9px;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.material-name {
  font-size: 15px;
  font-weight: 600;
  color: #f7f4fc;
}

.brush-badge {
  margin-left: auto;
  font-size: 12px;
  color: #c8c1db;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
}

.palette-dock {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 8px;
  border-radius: 18px;
  background: rgba(28, 27, 38, 0.72);
  border: 1px solid rgba(242, 238, 249, 0.13);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.palette-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 7px;
  border-radius: 11px;
  border: 2px solid transparent;
  background: transparent;
  color: #cfc8e0;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.palette-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.palette-item.selected-p1 {
  border-color: #a8e6cf;
  background: rgba(168, 230, 207, 0.13);
  color: #ffffff;
}

.palette-item.selected-p2 {
  border-color: #ffb7b2;
  background: rgba(255, 183, 178, 0.13);
  color: #ffffff;
}

.palette-item.selected-both {
  border-color: #f7f4fc;
  box-shadow: 0 0 0 2px #a8e6cf, 0 0 0 4px rgba(255, 183, 178, 0.75);
  background: rgba(247, 244, 252, 0.14);
  color: #ffffff;
}

.palette-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.25), inset 2px 2px 4px rgba(255, 255, 255, 0.35);
}

.controls-hint {
  font-size: 11px;
  color: #a8a1bd;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .hud {
    padding: 1.4% 1.8%;
  }

  .hud-bottom {
    gap: 8px;
  }

  .player-card {
    min-width: 132px;
    padding: 6px 9px;
  }

  .player-device {
    display: none;
  }

  .material-name {
    font-size: 13px;
  }

  .palette-dock {
    padding: 6px 8px;
  }

  .palette-row {
    gap: 4px;
  }

  .palette-item {
    padding: 3px 4px;
    font-size: 10px;
  }

  .palette-dot {
    width: 16px;
    height: 16px;
  }

  .controls-hint {
    display: none;
  }
}
