
@charset "UTF-8";

/* ==========================================
   LUCKY DRAW
========================================== */

.luckydraw-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.luckydraw-stat {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}

.luckydraw-stat span {
  color: var(--admin-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
}

.luckydraw-stat strong {
  color: #d5b0ff;
  font-family: 'Google Sans', sans-serif;
  font-size: 34px;
}

/* ==========================================
   MAIN WHEEL CARD
========================================== */

.luckydraw-main {
  position: relative;
  text-align: center;
  overflow: hidden;
}

.luckydraw-heading {
  margin-bottom: 28px;
}

.luckydraw-heading h3 {
  margin: 8px 0;
  font-family: 'Google Sans', sans-serif;
  font-size: 32px;
  letter-spacing: .08em;
}

.luckydraw-heading p {
  color: var(--admin-muted);
  font-size: 13px;
}

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

.luckydraw-wheel-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto 30px;
}

.ld-wheel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.luckydraw-pointer {
  position: relative;
  z-index: 3;
  margin-bottom: -17px;
  color: #ff527b;
  font-size: 35px;
  filter: drop-shadow(0 3px 5px #000);
}

.luckydraw-wheel {
  position: relative;
  width: min(420px, 88vw, 100%);
  aspect-ratio: 1;
  border: 9px solid #d4b1ff;
  border-radius: 50%;
  box-shadow:
    0 0 0 5px #33234e,
    0 0 35px #8a4bd855,
    inset 0 0 20px #0008;
  transition: transform 5.2s cubic-bezier(.12,.78,.16,1);
  overflow: hidden;
}

/* ==========================================
   RADIAL PARTICIPANT LABELS
========================================== */

.ld-wheel-label {
  position: absolute;
  z-index: 1;

  top: 50%;
  left: 50%;

  width: 30%;

  color: #ffffff;

  font-family: 'Google Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;

  text-align: center;
  text-transform: uppercase;

  line-height: 1.1;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  text-shadow:
    1px 1px 3px #000000,
    -1px -1px 3px #000000;

  pointer-events: none;
  user-select: none;
}

/* Readable fallback for dense pools: identity moves off the segments. */
.ld-wheel-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 2px 14px;

  width: min(100%, 680px);
  min-width: 0;
  max-height: 168px;
  margin-top: 18px;
  padding: 10px 12px;
  box-sizing: border-box;
  overflow-y: auto;

  text-align: left;

  background: #17142b;
  border: 1px solid #33234e;
  border-radius: 10px;
}

.ld-wheel-legend[hidden] {
  display: none;
}

.ld-wheel-legend-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;

  padding: 3px 0;

  border-bottom: 1px solid #2a2345;

  font-size: 12px;
  color: #e9e2ff;
}

.ld-wheel-legend-name {
  min-width: 0;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ld-wheel-legend-count {
  flex: none;
  max-width: 50%;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #c8a5ff;
  font-weight: 700;
}

/* ==========================================
   WHEEL CENTRE
========================================== */

.luckydraw-wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;

  width: clamp(76px, 24%, 110px);
  aspect-ratio: 1;
  box-sizing: border-box;

  transform: translate(-50%, -50%);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  background: #17142b;
  border: 5px solid #d4b1ff;
  border-radius: 50%;

  box-shadow: 0 4px 18px #0008;
}

.luckydraw-wheel-center span {
  color: #c8a5ff;
  font-size: clamp(7px, 1.8vw, 9px);
  font-weight: 700;
  letter-spacing: .1em;
  text-align: center;
}

.luckydraw-wheel-center strong {
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: clamp(16px, 4vw, 24px);
  line-height: 1;
}

/* ==========================================
   WINNER DISPLAY
========================================== */

.luckydraw-winner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  margin: 20px auto;
  padding: 22px;

  background: #17142b;
  border: 1px solid #a66be866;
  border-radius: 12px;
}

.luckydraw-winner span {
  color: #c6a1ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}

.luckydraw-winner strong {
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: clamp(25px, 5vw, 38px);
  text-transform: uppercase;

  max-width: 100%;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.luckydraw-winner small {
  color: var(--admin-muted);
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ==========================================
   ACTION BUTTONS
========================================== */

.luckydraw-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.luckydraw-actions button {
  min-width: min(190px, 100%);
}

#ldSpinBtn {
  background: linear-gradient(110deg, #8a4bd8, #d94c70);
  border: none;
}

#ldSpinBtn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

#ldRefreshBtn:disabled {
  opacity: .5;
  cursor: wait;
}

/* ==========================================
   PARTICIPANT MANAGEMENT
========================================== */

.ld-add-participant {
  margin-top: 12px;
}

.ld-add-participant h4 {
  margin: 0 0 8px;
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
}

.ld-add-participant p {
  margin-bottom: 18px;
  font-size: 12px;
}

.ld-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  align-items: end;
  gap: 12px;
}

.ld-add-form label,
.ld-editor-fields label {
  display: flex;
  flex-direction: column;
  gap: 8px;

  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
}

.ld-add-form input,
.ld-editor-fields input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;

  padding: 11px 12px;

  color: #fff;
  background: #17142b;

  border: 1px solid var(--admin-line);
  border-radius: 8px;

  outline: none;
}

.ld-add-form input:focus,
.ld-editor-fields input:focus {
  border-color: #a66be8;
  box-shadow: 0 0 0 2px #a66be822;
}

.ld-add-form button {
  min-height: 40px;
  white-space: nowrap;
}

.ld-editor-divider {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--admin-line);
}

/* ==========================================
   BULK IMPORT
========================================== */

.ld-bulk-import {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--admin-line);
}

.ld-bulk-import h4 {
  margin: 0 0 8px;
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
}

.ld-bulk-import > p {
  margin-bottom: 16px;
  font-size: 12px;
}

.ld-bulk-import label {
  display: flex;
  flex-direction: column;
  gap: 8px;

  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
}

.ld-bulk-import textarea {
  width: 100%;
  min-height: 160px;
  box-sizing: border-box;

  padding: 11px 12px;

  color: #fff;
  background: #17142b;

  border: 1px solid var(--admin-line);
  border-radius: 8px;

  outline: none;
  resize: vertical;

  font: inherit;
  font-size: 12px;
  line-height: 1.6;
}

.ld-bulk-import textarea:focus {
  border-color: #a66be8;
  box-shadow: 0 0 0 2px #a66be822;
}

.ld-bulk-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.ld-bulk-preview {
  margin-top: 16px;
  padding: 14px;

  background: #17142b66;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
}

.ld-bulk-preview[hidden] {
  display: none;
}

.ld-bulk-summary {
  margin: 0 0 8px;
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.5;
}

.ld-bulk-error {
  color: #ff8ba4;
}

.ld-bulk-preview-list {
  max-height: 320px;
  overflow: auto;
}

.ld-bulk-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;

  padding: 7px 0;
  border-bottom: 1px solid #ffffff0d;

  font-size: 12px;
}

.ld-bulk-row:last-child {
  border-bottom: 0;
}

.ld-bulk-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #fff;
}

.ld-bulk-meta {
  flex-shrink: 0;
  max-width: 55%;
  overflow-wrap: anywhere;
  text-align: right;
  color: var(--admin-muted);
}

.ld-bulk-duplicate .ld-bulk-name,
.ld-bulk-duplicate .ld-bulk-meta,
.ld-bulk-invalid .ld-bulk-name,
.ld-bulk-invalid .ld-bulk-meta {
  color: #ff8ba4;
}

#ldBulkImportBtn {
  width: 100%;
  margin-top: 14px;
}

/* ==========================================
   EDIT PARTICIPANT LIST
========================================== */

.ld-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;

  padding: 16px 0;
  border-bottom: 1px solid var(--admin-line);
}

.ld-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  min-width: 0;
}

.ld-editor-fields label span {
  color: var(--admin-muted);
}

.ld-editor-fields input {
  font-size: 12px;
}

.ld-remove-btn {
  min-width: 90px;
  min-height: 38px;
  padding: 8px 12px;

  color: #ff8ba4;
  border-color: #d94c7055;
}

.ld-remove-btn:hover {
  background: #d94c7018;
}

.ld-editor-id {
  grid-column: 1 / -1;
  min-width: 0;
  overflow-wrap: anywhere;

  color: var(--admin-muted);
  font-size: 10px;
  line-height: 1.4;
}

.ld-removed-row {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 0;
  border-bottom: 1px solid var(--admin-line);
}

.ld-removed-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ld-removed-info strong {
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.ld-removed-info span {
  overflow-wrap: anywhere;
  color: var(--admin-muted);
  font-size: 10px;
}

.ld-restore-btn {
  min-width: 90px;
  min-height: 38px;
  padding: 8px 12px;

  color: var(--admin-green);
  border-color: #65e0b455;
}

.ld-restore-btn:hover {
  background: #65e0b418;
}

#ldResetEditsBtn {
  margin-top: 22px;
  color: #d5b0ff;
  border-color: #a66be866;
}

/* ==========================================
   PARTICIPANTS
========================================== */

.luckydraw-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.luckydraw-section-title h3 {
  margin: 0;
}

.luckydraw-section-title > span {
  color: var(--admin-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
}

.ld-participant-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--admin-line);
}

.ld-participant-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.ld-participant-info strong {
  flex: 1 1 140px;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
  color: #fff;
  font-size: 13px;
}

.ld-participant-info span {
  flex-shrink: 0;
  color: #c6a1ff;
  font-size: 12px;
  font-weight: 700;
}

.ld-progress {
  height: 7px;
  overflow: hidden;
  background: #ffffff12;
  border-radius: 20px;
}

.ld-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8a4bd8, #d94c70);
  border-radius: 20px;
}

/* ==========================================
   WINNER HISTORY
========================================== */

.ld-history-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--admin-line);
}

.ld-history-rank {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  flex: 0 0 32px;

  border-radius: 50%;
  background: #8a4bd833;
  color: #d5b0ff;
  font-weight: 700;
}

.ld-history-info {
  display: flex;
  flex: 1 1 140px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ld-history-info strong {
  overflow-wrap: anywhere;
  line-height: 1.5;
  color: #fff;
  font-size: 13px;
}

.ld-history-info span {
  overflow-wrap: anywhere;
  color: var(--admin-muted);
  font-size: 10px;
}

.ld-history-ticket {
  color: #c6a1ff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 700px) {

  .luckydraw-wheel-area {
    width: 100%;
    margin: 24px auto;
    padding: 0 4px;
    box-sizing: border-box;
  }

  .luckydraw-wheel {
    width: min(420px, 88vw, 100%);
  }

  .luckydraw-stats {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .luckydraw-actions {
    flex-direction: column;
  }

  .luckydraw-actions button {
    width: 100%;
  }

  .luckydraw-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .ld-add-form {
    grid-template-columns: 1fr;
  }

  .ld-add-form button {
    width: 100%;
  }

  .ld-bulk-actions {
    justify-content: stretch;
  }

  .ld-bulk-actions button {
    width: 100%;
  }

  .ld-bulk-row {
    flex-direction: column;
    gap: 2px;
  }

  .ld-bulk-meta {
    max-width: none;
    text-align: left;
  }

  .ld-editor-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ld-editor-fields {
    grid-template-columns: minmax(0, 1fr) 90px;
  }

  .ld-remove-btn {
    width: 100%;
  }

  .ld-history-row {
    gap: 9px;
  }

}

.ld-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ld-editor-actions button {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .ld-editor-actions {
    width: 100%;
  }

  .ld-editor-actions button {
    flex: 1;
  }
}

/* ==========================================
   WINNER CONFETTI
========================================== */

.ld-confetti {
  position: fixed;
  inset: 0;
  z-index: 9999;

  overflow: hidden;
  pointer-events: none;
}

.ld-confetti-piece {
  position: absolute;
  top: -20px;
  left: var(--x);

  width: 9px;
  height: 14px;

  background: var(--color);
  border-radius: 2px;

  opacity: 0;

  animation:
    ld-confetti-fall
    var(--duration)
    var(--delay)
    ease-out
    forwards;
}

@keyframes ld-confetti-fall {
  0% {
    opacity: 1;
    transform: translate3d(0, -5vh, 0) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform:
      translate3d(var(--drift), 110vh, 0)
      rotate(var(--rotation));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ld-confetti {
    display: none;
  }
}

/* ==========================================
   LUCKY DRAW PRESENTATION MODE
========================================== */

body.ld-presentation-mode {
  background: #0b0b16;
  padding: 0;
}

/* Collapse the parent layout as well as hiding the sidebar. */
body.ld-presentation-mode .admin-main {
  max-width: none;
  padding: 0;
}

body.ld-presentation-mode #adminContent {
  display: block;
}

body.ld-presentation-mode .topbar,
body.ld-presentation-mode .site-footer,
body.ld-presentation-mode .dashboard-heading,
body.ld-presentation-mode .admin-nav,
body.ld-presentation-mode #dashboardMessage,
body.ld-presentation-mode #luckydraw > .admin-section-heading,
body.ld-presentation-mode #luckydraw > .luckydraw-stats,
body.ld-presentation-mode #luckydraw > .admin-card:not(.luckydraw-main),
body.ld-presentation-mode .luckydraw-heading > .eyebrow,
body.ld-presentation-mode .luckydraw-heading > p {
  display: none !important;
}

body.ld-presentation-mode #luckydraw {
  width: 100%;
  padding: 8px;
}

body.ld-presentation-mode #luckydraw .luckydraw-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 8px;
  width: 100%;
  height: calc(100dvh - 16px);
  margin: 0;
  padding: 12px;
}

body.ld-presentation-mode .luckydraw-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 0;
}

body.ld-presentation-mode .luckydraw-heading h3 {
  margin: 0;
  font-size: clamp(16px, 2.4vw, 28px);
  letter-spacing: .03em;
}

body.ld-presentation-mode #ldPresentationBtn {
  max-width: 50%;
  padding: 8px;
  font-size: 11px;
}

body.ld-presentation-mode .luckydraw-wheel-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

/* Size the wheel against the space left after the winner and controls,
   not just viewport width. Container sizing also accounts for the legend. */
body.ld-presentation-mode .ld-wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  container-type: size;
  height: 100%;
  min-height: 0;
}

body.ld-presentation-mode .luckydraw-wheel {
  width: min(calc(100cqw - 24px), calc(100cqh - 32px), 640px);
}

body.ld-presentation-mode .luckydraw-pointer {
  position: absolute;
  top: calc(50% - min(50cqw - 12px, 50cqh - 16px, 320px) - 16px);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 26px;
  line-height: 1;
}

body.ld-presentation-mode .ld-wheel-legend {
  max-height: min(96px, 18dvh);
  margin-top: 4px;
  padding: 4px 8px;
}

body.ld-presentation-mode .luckydraw-winner {
  min-width: 0;
  max-height: min(140px, 22dvh);
  gap: 4px;
  margin: 0;
  padding: 8px;
  overflow: auto;
}

body.ld-presentation-mode .luckydraw-winner strong {
  font-size: clamp(18px, 3vw, 32px);
}

body.ld-presentation-mode .luckydraw-actions {
  flex-direction: row;
  gap: 8px;
}

body.ld-presentation-mode .luckydraw-actions button {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 9px 6px;
  font-size: 11px;
}

body.ld-presentation-mode #ldMessage {
  max-height: none;
  margin: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* Short/wide screens put the operator controls beside the wheel. */
@media (min-aspect-ratio: 4/3) {
  body.ld-presentation-mode #luckydraw .luckydraw-main {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-rows: auto 1fr auto auto 1fr;
  }

  body.ld-presentation-mode .luckydraw-heading {
    grid-column: 1 / -1;
  }

  body.ld-presentation-mode .luckydraw-wheel-area {
    grid-column: 1;
    grid-row: 2 / 6;
    height: 100%;
  }

  body.ld-presentation-mode .luckydraw-winner {
    grid-column: 2;
    grid-row: 3;
    max-height: 45dvh;
  }

  body.ld-presentation-mode .luckydraw-actions {
    grid-column: 2;
    grid-row: 4;
  }

  body.ld-presentation-mode #ldMessage {
    grid-column: 2;
    grid-row: 5;
    align-self: start;
  }
}