:root {
  --bg: #050607;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: var(--bg); overflow: hidden; }
.stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 16:9 con bandas negras, ocupando todo lo posible. El lienzo 3D va debajo
   y el 2D (HUD, textos) encima, transparente. */
.screen {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
}
.screen canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
#game3d[hidden] { display: none; }

/* ---- Vinculación con el reloj ---- */
.stage { position: relative; }
.pair {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(20, 60, 40, 0.86), rgba(3, 6, 5, 0.94));
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #eafff2;
  z-index: 2;
}
.pair[hidden], .watch-chip[hidden], .pair-btn[hidden] { display: none; }
.pair-card {
  width: min(520px, 100%);
  padding: 32px 28px;
  border-radius: 24px;
  background: rgba(8, 18, 13, 0.9);
  border: 2px solid #34e07a;
  box-shadow: 0 0 40px rgba(52, 224, 122, 0.35);
  text-align: center;
}
.pair-brand { font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: #34e07a; font-size: 14px; }
.pair h1 { margin: 10px 0 20px; font-size: clamp(24px, 4vw, 34px); }
.pair-code { display: flex; gap: 12px; justify-content: center; min-height: 10px; }
.pair-code span {
  width: clamp(56px, 13vw, 84px);
  padding: 10px 0;
  border-radius: 16px;
  background: #0f2a1c;
  border: 2px solid #2b8f55;
  font: 800 clamp(40px, 9vw, 64px) / 1.1 ui-monospace, 'SF Mono', Menlo, monospace;
  color: #8dffb9;
  text-shadow: 0 0 14px rgba(52, 224, 122, 0.7);
}
.pair-code .pair-ok { width: auto; padding: 10px 28px; border-color: #34e07a; }
.pair-hint { margin-top: 20px; font-size: 17px; line-height: 1.4; color: #c4ecd4; }
.pair-hint b { color: #fff; }
.pair-timer { margin-top: 10px; font-size: 14px; color: #7fb596; min-height: 1.2em; }
.pair-btn, .watch-chip button {
  margin-top: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid #2b8f55;
  background: transparent;
  color: #c4ecd4;
  font: 600 15px system-ui, sans-serif;
  cursor: pointer;
}
.pair-btn:hover, .watch-chip button:hover { background: #12321f; color: #fff; }
.watch-chip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgba(5, 12, 9, 0.78);
  border: 1px solid #1f5c39;
  color: #c4ecd4;
  font: 500 14px system-ui, sans-serif;
  z-index: 1;
}
.watch-chip button { margin: 0; padding: 6px 12px; font-size: 13px; }
.watch-chip { flex-direction: column; align-items: flex-end; border-radius: 18px; padding: 6px; }
.watch-chip .party-toggle { border: none; color: #c4ecd4; font-size: 14px; }
.party-panel { width: min(340px, calc(100vw - 64px)); padding: 8px 8px 4px; display: grid; gap: 10px; }
.party-panel[hidden] { display: none; }
.party-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.party-modes button { padding: 7px 4px; font-size: 12.5px; }
.party-modes button[aria-pressed='true'] { background: #2b8f55; color: #fff; border-color: #34e07a; }
.party-modes button:disabled { opacity: 0.4; cursor: not-allowed; }
.party-hint { margin: 0; font-size: 12.5px; line-height: 1.35; color: #9fcfb3; }
.party-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.party-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-size: 13.5px; }
.party-list .slot { font-weight: 900; min-width: 26px; }
.party-list .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-list button { padding: 4px 10px; font-size: 12px; }
.party-actions { display: flex; gap: 6px; justify-content: space-between; }
.party-actions button { flex: 1; }
.party-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 600px) {
  .watch-chip { left: 16px; right: 16px; justify-content: space-between; }
}
