/* ============================================================
   Spinner Widget — all selectors namespaced with .sw- prefix
   ============================================================ */

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

.sw-widget {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: #222;
}

/* ── Card (3-D flip container) ─────────────────────────────── */

.sw-card {
  width: 100%;
  perspective: 1200px;
}

.sw-card-inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease-in-out, min-height 0.4s ease;
}

.sw-card-inner.is-flipped {
  transform: rotateY(180deg);
}

.sw-front,
.sw-back {
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.sw-back {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: rotateY(180deg);
}

/* ── Wheel area (square via padding-top trick) ─────────────── */

.sw-wheel-area {
  position: relative;
  width: 100%;
  padding-top: 100%;
  cursor: pointer;
  user-select: none;
}

/* Wheel ring SVG — fills the square */
.sw-wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Pin image — positioned so the donut-hole centre sits on the wheel centre.
   Image aspect ratio: 2380 / 3109 ≈ 0.765.
   Donut-hole centre measured at ≈ 38.3% down the image.

   Pin height = 60% of container.
   Pin width  = 60% × 0.765 = 45.9%.
   top  = 50% − (38.3% × 60%) = 50% − 23% = 27%  → keeps hole on wheel centre
   left = (100% − 45.9%) / 2 = 27.05%
   transform-origin: 50% 38.3%  → rotates around the hole centre            */
.sw-pin-img {
  position: absolute;
  width:   45.9%;
  height:  60%;
  top:     27%;
  left:    27.05%;
  transform-origin: 50% 38.3%;
  cursor: pointer;
  transition: none;           /* transitions applied inline by JS */
  pointer-events: none;       /* wheel-area click handles all taps */
}

/* ── Settings button (outside the flip card) ──────────────── */

.sw-settings-row {
  text-align: center;
  padding: 8px 0 0;
}

.sw-settings-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: #ccc;
  letter-spacing: 2px;
  padding: 4px 12px;
  line-height: 1;
}

.sw-settings-btn:hover {
  color: #999;
}

/* ── Config (back side) ────────────────────────────────────── */

.sw-config {
  padding: 16px;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.sw-config-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sw-done-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #E5173F;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.sw-done-btn:hover { background: #c41235; }

.sw-list-select {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.sw-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.sw-btn {
  padding: 5px 11px;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
}

.sw-btn:hover { background: #f0f0f0; }

.sw-btn-danger {
  border-color: #E5173F;
  color: #E5173F;
}

.sw-btn-danger:hover { background: #fff0f3; }

/* Items list */
.sw-items-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
}

.sw-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.sw-item:last-child { border-bottom: none; }

.sw-item-label {
  flex: 1;
  font-size: 0.9rem;
}

.sw-item-del {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: 1.1rem;
  padding: 0 2px;
  line-height: 1;
}

.sw-item-del:hover { color: #E5173F; }

/* Add row */
.sw-add-row {
  display: flex;
  gap: 8px;
}

.sw-add-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.sw-add-input:focus {
  outline: none;
  border-color: #E5173F;
  box-shadow: 0 0 0 2px rgba(229,23,63,0.15);
}

.sw-add-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #E5173F;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.sw-add-btn:hover { background: #c41235; }
