/* =========================
   Wheel & Modal (wheel.css)
   ========================= */

/* ---- Wheel mount ---- */
#wfWheelMount,
.wf-wheel {
  position: relative;
  width: 100%;
  max-width: min(560px, 92vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
#wfWheelMount svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Right-side pointer (element: <div class="wf-pointer">) ---- */
.wf-pointer {
  position: absolute;
  top: calc(50% - 8px);
  right: -16px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 32px solid transparent;
  border-bottom: 32px solid transparent;
  border-right: 52px solid #19a974;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}
@media (max-width: 520px) {
  .wf-pointer {
    top: calc(50% - 6px);
    border-top-width: 24px;
    border-bottom-width: 24px;
    border-right-width: 40px;
    right: -12px;
  }
}

/* ---- Center cap + spin button ---- */
.wf-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wf-spin-btn {
  background: #ffffff;
  border: 3px solid #000000;
  color: #000000;
  border-radius: 50%;
  width: 90px;
  height: 90px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.wf-spin-btn:hover {
  transform: scale(1.05);
}
.wf-spin-btn:active {
  transform: scale(0.95);
}
@media (max-width: 520px) {
  .wf-spin-btn {
    width: 70px;
    height: 70px;
    font-size: 0.9rem;
  }
}

/* ---- Message outlet ---- */
#wfMsgOutlet.wf-msg-container {
  margin-top: 6px;
}
.wf-msg {
  font-size: 1.4rem;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.wf-msg.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.wf-msg--info {
  background: #eef6ff;
  color: #0a3f7a;
  border-color: #b6dbff;
}
.wf-msg--error {
  background: #ffecec;
  color: #7a0611;
  border-color: #ffc2c2;
}

/* ---- Modal (Lucky Pick) ---- */
.wf-modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}
.wf-modal {
  background: #fff;
  border-radius: 12px;
  width: min(540px, 92vw);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: popIn 0.25s ease;
  font-family: "Inter", system-ui, sans-serif;
}
.wf-modal-header {
  background: #dd9c5c;
  color: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
}
.wf-modal-title {
  font-weight: 700;
  font-size: 24px;
  margin: 0;
}
.wf-modal-close {
  border: 1px solid #0303031a;
  background: transparent;
  color: #000;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s ease;
}
.wf-modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
}
.wf-modal-content {
  padding: 24px 20px 0;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #000;
}
.wf-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px 0 24px;
}
.wf-modal-actions button,
.wf-chipbtn {
  border: 1px solid #000;
  background: #fff;
  color: #000;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: inherit;
}
.wf-modal-actions button:hover,
.wf-chipbtn:hover {
  background: #000;
  color: #fff !important;
}

/* Modal card + body/footer */
.wf-modal-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  color: #0f172a;
}
.wf-modal-body,
.wf-modal-footer {
  padding: 10px;
}

/* Modal animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes popIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ---- Settings controls ---- */
.wf-setting-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  padding: 5px;
}
.wf-setting-label {
  color: #222;
  font-weight: 600;
}

/* Segmented control */
.wf-seg-control {
  display: inline-flex;
  background: #efefef;
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
  overflow: hidden;
  width: fit-content;
}
.wf-seg-control .seg {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #000;
}
.wf-seg-control .seg.selected {
  background: #000;
  color: #fff;
}

/* Toggle */
.wf-toggle {
  position: relative;
  width: 78px;
  height: 32px;
  background: #d9f2e4;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  cursor: pointer;
  outline: none;
}
.wf-toggle .wf-toggle-label {
  font-size: 12px;
  font-weight: 700;
  color: #4a4a4a;
  user-select: none;
}
.wf-toggle .wf-toggle-handle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  background: #21c087;
  border-radius: 50%;
  transition: transform 0.18s ease;
}
.wf-toggle.on .wf-toggle-handle {
  transform: translateX(46px);
}

/* ---- Layout: mobile & desktop ---- */
/* Mobile (<=900px): wheel first, controls as a centered row; hide fullscreen */
@media (max-width: 900px) {
  .wf-left {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 16px 20px;
  }
  #wfWheelMount,
  .wf-wheel {
    max-width: 94vw;
    margin: 0 auto;
  }
  .wf-left-controls {
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin-top: 8px;
  }
  #wfBtnFullscreen {
    display: none !important;
  }
}

/* Desktop (>=900px) layout */
@media (min-width: 900px) {
  .wf-left {
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }

  /* Wheel block */
  #wfWheelMount {
    order: 1;
  }

  /* Controls block */
  .wf-left-controls {
    order: 1;
    position: static !important;
    inset: auto !important;
    transform: none !important;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;

    margin-top: auto;
    z-index: 1;
  }

  .wf-left-controls > * {
    position: static !important;
  }
}

/* Focus / fullscreen mode for the wheel */
.wf-layout.is-focus {
  grid-template-columns: 1fr;
}
.wf-layout.is-focus .wf-right {
  display: none;
}
.wf-layout.is-focus .wf-left {
  padding: 24px;
}
.wf-layout.is-focus #wfWheelMount,
.wf-layout.is-focus .wf-wheel {
  max-width: none;
  width: 100%;
  margin: 0 auto;
}

/* ---- Palette selection ---- */
/* Palette rows: tighter layout with most space given to the swatch strip */
.wf-palette-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--ui-border, #e5e7eb);
}
.wf-palette-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Swatch strip: full-width pill with no internal gaps */
.wf-swatch-row {
  display: flex;
  gap: 0;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 9999px;
  overflow: hidden;
}
/* Each swatch takes equal width, no extra space left over */
.wf-swatch {
  flex: 1 1 0%;
  height: 100%;
  display: block;
}
/* Radio stays snug to the right edge */
.wf-palette-radio {
  justify-self: end;
  width: 18px;
  height: 18px;
}
/* Keyboard focus on the whole row */
.wf-palette-row:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---- List items with thumbnails ---- */
/* Make each item a single horizontal row */
.wf-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
/* Let the text input take remaining space */
.wf-list-input {
  flex: 1 1 auto;
  min-width: 0;
}
/* Thumbnail: small, fixed size */
.wf-list-thumb {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 0.5rem;
}
/* Icon buttons (reorder, image, remove) stay compact */
.wf-list-item button,
.wf-list-item .wf-icon-button {
  flex: 0 0 auto;
}