/* BuddyPress Spin Wheel — Front (v1.0.10)
   - Winner title hides cleanly when empty
*/

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

/* ---------- Container & layout ---------- */
.bpw-wrap{
  max-width: 1100px;
  margin: 24px auto;
  padding: 22px 22px 26px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 50px rgba(0,0,0,.08);
  overflow: hidden;
}
.bpw-ui{
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}
.bpw-left{ position: relative; flex: 1 1 520px; min-width: 0; padding: 6px 0 14px; }
.bpw-right{ flex: 1 1 340px; min-width: 280px; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }

/* Canvas & overlay */
.bpw-canvas-wrap{ position: relative; }
.bpw-canvas, .bpw-overlay{ display:block; width:100%; height:auto; margin:22px auto 18px; }
.bpw-canvas{ background: transparent; }
.bpw-overlay{ position:absolute; left:0; top:0; pointer-events:none; z-index:3; }

/* ---------- Buttons / status ---------- */
.bpw-controls { display:flex; gap:12px; flex-wrap:wrap; justify-content:center; margin-top:16px; }
.bpw-btn,
.bpw-start, .bpw-start-session, .bpw-btn-start,
.bpw-spin, .bpw-leave, .bpw-invite-admin, .bpw-toggle-sound {
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px; padding:11px 16px; border-radius:12px; border:1px solid #e5e7eb;
  background: #111827; color:#fff; font:600 14px/1 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  box-shadow: 0 8px 20px rgba(17,24,39,.12); cursor:pointer;
}
.bpw-btn.is-disabled,
.bpw-start.is-disabled, .bpw-start-session.is-disabled, .bpw-btn-start.is-disabled,
.bpw-spin.is-disabled, .bpw-leave.is-disabled, .bpw-invite-admin.is-disabled, .bpw-toggle-sound.is-disabled,
.bpw-btn:disabled,
.bpw-start:disabled, .bpw-start-session:disabled, .bpw-btn-start:disabled,
.bpw-spin:disabled, .bpw-leave:disabled, .bpw-invite-admin:disabled, .bpw-toggle-sound:disabled {
  opacity:.55; cursor:not-allowed; filter:saturate(.6);
  background:#6b7280; border-color:#9ca3af;
}
.bpw-status { margin-top: 10px; min-height: 24px; font: 600 14px/1.25 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial; color:#0f172a; }
.bpw-remaining, .bpw-participants { margin-top: 6px; font-size: 13px; color: #444; overflow-wrap: anywhere; }

/* ---------- Items & history ---------- */
.bpw-list { list-style: none; margin: 0; padding: 0; }
.bpw-items-list{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; }
.bpw-items-list li{
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px;
  min-width: 0; padding:12px 14px; border-radius:10px; background:#f8fafc; color:#0f172a; border:1px solid #e5e7eb;
  font:600 14px/1.25 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
}
.bpw-swatch{ width:14px; height:14px; border-radius:3px; background:var(--swatch,#999); display:block; }
.bpw-label{
  min-width: 0; overflow: hidden; white-space: normal; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
  max-height: calc(1em * 1.25 * 2); word-break: break-word; overflow-wrap: anywhere;
}
.bpw-history{ list-style:none; margin:16px 0 0; padding:0; }
.bpw-history li{ padding:8px 0; border-bottom:1px dashed #e5e7eb; }
.bpw-history li:last-child{ border-bottom:0; }

/* ---------- Result card (now inside .bpw-canvas-wrap) ---------- */
.bpw-result-card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  background: #111; color: #fff; padding: 18px 20px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); z-index: 9; min-width: 260px;
  text-align: center; opacity: 0; pointer-events: none;
}
.bpw-result-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s ease; }
.bpw-result-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .76; margin-bottom: 4px; }
/* Hide the header line cleanly when admin set it empty */
.bpw-result-title:empty { display: none; }
.bpw-result-value { font-size: 20px; font-weight: 700; }
.bpw-result-close { margin-top: 12px; }

/* ---------- Fixed top pointer (tip only; hinge hidden) ---------- */
:root { --bpw-pointer-body:#1e2a3a; }
.bpw-t-hinge{ display:none !important; }
.bpw-ticker{ position:absolute; pointer-events:none; z-index:6; }
.bpw-t-tip{
  width:0; height:0;
  border-left:14px solid transparent;
  border-right:14px solid transparent;
  border-top:28px solid var(--bpw-pointer-body);
  transform-origin:50% 0%;
}
@keyframes bpw-flick{ 0%{transform:rotate(0)} 40%{transform:rotate(-12deg)} 100%{transform:rotate(0)} }
.bpw-t-tip.flick{ animation:bpw-flick .14s ease-out; }
@keyframes bpw-pointer-bounce{ 0%{transform:translate(-50%,0)} 50%{transform:translate(-50%,-2px)} 100%{transform:translate(-50%,0)} }
.bpw-ticker.is-ticking{ animation:bpw-pointer-bounce .14s cubic-bezier(.25,1.7,.45,1) both; }

.bpw-locked .bpw-canvas{ cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .bpw-right{ flex: 1 1 100%; min-width: 100%; }
  .bpw-items-list{ grid-template-columns: minmax(0, 1fr); }
  .bpw-wrap{ padding: 18px; }
}
@media (max-width: 480px){
  .bpw-controls .bpw-btn,
  .bpw-start, .bpw-start-session, .bpw-btn-start,
  .bpw-spin, .bpw-leave, .bpw-invite-admin, .bpw-toggle-sound {
    flex: 1 1 calc(50% - 8px);
    padding:12px 16px; border-radius:14px;
  }
}
@media (prefers-reduced-motion: reduce){
  .bpw-t-tip, .bpw-ticker{ animation: none !important; }
}
