/* =====================================================================
   Mobile-first stylesheet
   - เขียนสำหรับจอมือถือก่อน แล้วค่อยขยายด้วย @media (min-width: ...)
   - breakpoints: 480 (มือถือใหญ่) / 860 (แท็บเล็ต-เดสก์ท็อป) / 1100
   ===================================================================== */

:root {
  --bg1: #1e1b4b;
  --bg2: #4c1d95;
  --bg3: #be185d;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #7c3aed;
  --primary-2: #a855f7;
  --danger: #ef4444;
  --radius: 16px;
  --tap: 44px; /* ขนาดปุ่มขั้นต่ำสำหรับนิ้ว */
  --gutter: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ให้ attribute hidden ซ่อน element ได้เสมอ แม้ element นั้นจะตั้ง display:flex/grid
   (แก้บั๊ก modal ปิดไม่ลง / countdown ค้าง) */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 55%, var(--bg3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
  touch-action: manipulation; /* ไม่ให้ double-tap zoom */
}

/* กัน iOS ซูมเวลาโฟกัสช่องกรอก (ต้อง >= 16px) */
input,
textarea {
  font-size: 16px;
}

button {
  cursor: pointer;
}

.app {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--gutter) + var(--safe-top)) calc(var(--gutter) + var(--safe-right))
    calc(24px + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
}

/* ---------- header ---------- */
.header {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.title-text {
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: clamp(20px, 6vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  overflow-wrap: anywhere;
}

.title-input {
  width: 100%;
  max-width: 640px;
  text-align: center;
  font-size: clamp(18px, 5vw, 32px);
  font-weight: 700;
  color: #fff;
  background: transparent;
  border: none;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.25);
  padding: 8px 12px;
  outline: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.title-input:focus {
  border-bottom-color: rgba(255, 255, 255, 0.7);
}
.title-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- layout ---------- */
.layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  width: 100%;
}

/* หน้าเล่น: วงล้อเต็มจอ ปุ่มอยู่ในระยะนิ้วโป้ง */
.stage-solo {
  min-height: calc(100dvh - 90px - var(--safe-top) - var(--safe-bottom));
  justify-content: center;
  gap: 18px;
}

/* ---------- wheel ---------- */
.wheel-wrap {
  position: relative;
  /* ให้พอดีทั้งแนวตั้ง (กว้างจอ) และแนวนอน (สูงจอ) */
  width: min(100%, 92vw, 62dvh, 480px);
  aspect-ratio: 1;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.35));
  user-select: none;
  -webkit-user-select: none;
}

.wheel-svg {
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
}

.wheel-pointer {
  position: absolute;
  top: -2%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 40px solid #ffffff;
  z-index: 3;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
}
.wheel-pointer::after {
  content: '';
  position: absolute;
  top: -40px;
  left: -11px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 28px solid #f43f5e;
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22%;
  min-width: var(--tap);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid #fff;
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 60%, #d97706);
  color: #7c2d12;
  font-weight: 700;
  font-size: clamp(13px, 4vw, 22px);
  z-index: 2;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.wheel-center:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.94);
}
.wheel-center:disabled {
  cursor: not-allowed;
  filter: saturate(0.6);
}

.lock-badge {
  position: absolute;
  top: 2%;
  right: 2%;
  z-index: 4;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-spin {
  width: min(100%, 360px);
  min-height: 56px;
  font-size: clamp(17px, 4.5vw, 20px);
  padding: 12px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f472b6, #db2777);
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(219, 39, 119, 0.45);
}
.btn-spin:active:not(:disabled) {
  transform: scale(0.97);
}
.btn-spin:disabled {
  background: #9ca3af;
  box-shadow: none;
}

.last-result {
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  text-align: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- panel ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  width: 100%;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: #faf5ff;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 5;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: 1 0 auto;
  min-width: 64px;
  min-height: var(--tap);
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
}
.tab.tab-lock-on {
  color: #b91c1c;
}

.panel-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.hint.warn {
  color: #b45309;
}
.hint.center {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toolbar .btn {
  flex: 1 1 auto;
}
.row-end {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.row-end .btn {
  flex: 1;
}

/* ---------- buttons ---------- */
.btn {
  min-height: var(--tap);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--text);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
  background: #f3f4f6;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}
.btn-danger-ghost {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.icon-btn:active:not(:disabled) {
  background: #f3f4f6;
}
.icon-btn.danger:active:not(:disabled) {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- slice list ---------- */
.slice-list,
.color-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slice-row,
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.slice-index {
  width: 20px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.swatch-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line), 0 2px 4px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.slice-input {
  flex: 1 1 100px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f9fafb;
  outline: none;
}
.slice-input:focus {
  border-color: var(--primary-2);
  background: #fff;
}

.row-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.swatch-picker {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 2px 2px;
  border-top: 1px dashed var(--line);
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 0.1s;
}
.swatch:active:not(:disabled) {
  transform: scale(0.92);
}
.swatch.active {
  box-shadow: 0 0 0 3px var(--primary);
}
.swatch.used {
  opacity: 0.4;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- color panel ---------- */
.color-input-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.color-input-wrap input {
  position: absolute;
  inset: -10px;
  width: 200%;
  height: 200%;
  opacity: 0;
  cursor: pointer;
}

.usage-chip {
  font-size: 12px;
  color: var(--muted);
  background: #f3f4f6;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.lock-chip {
  background: #fee2e2;
}

/* ---------- lock panel ---------- */
.seg {
  display: flex;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  min-height: var(--tap);
  padding: 8px 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.2;
}
.seg-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field > label {
  font-size: 14px;
  color: var(--muted);
}
.field input[type='range'] {
  width: 100%;
  height: 32px;
  accent-color: var(--primary);
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  max-width: 100%;
}
.choice.active {
  border-color: var(--primary);
  background: #f5f3ff;
  color: var(--primary);
  font-weight: 600;
}

.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.lock-status {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.lock-status.on {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.lock-status.off {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.toggle-row input {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.bulk-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bulk-box textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  resize: vertical;
  outline: none;
}
.bulk-box textarea:focus {
  border-color: var(--primary-2);
}

/* ---------- history ---------- */
.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 14px;
  flex-wrap: wrap;
}
.history-no {
  color: var(--muted);
  font-size: 12px;
  width: 28px;
}
.history-name {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}
.history-time {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- modal (bottom-sheet บนมือถือ) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fade 0.2s ease-out;
}
.modal {
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  animation: slide-up 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.modal-title {
  text-align: center;
  font-size: 17px;
  color: var(--muted);
}
.result-card {
  border-radius: 16px;
  padding: 24px 14px;
  text-align: center;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.15);
}
.result-name {
  font-size: clamp(26px, 8vw, 40px);
  font-weight: 700;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.result-sub {
  margin-top: 6px;
  opacity: 0.85;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.modal-actions .btn-primary {
  grid-column: 1 / -1;
  min-height: 52px;
  font-size: 17px;
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* ---------- นับถอยหลังก่อนหมุน ---------- */
.countdown-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.62);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  color: #fff;
  pointer-events: none;
}
.countdown-ring {
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fde68a;
  animation: ring-spin 1s linear infinite;
}
.countdown-num {
  font-size: clamp(56px, 18vw, 110px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  animation: count-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.countdown-label {
  margin-top: 6px;
  font-size: clamp(14px, 3.5vw, 18px);
  opacity: 0.9;
}

/* ---------- หลังบ้าน ---------- */
.header-admin {
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.admin-bar {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.admin-badge {
  background: rgba(17, 24, 39, 0.6);
  color: #fde68a;
  border: 1px solid rgba(253, 230, 138, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.btn-logout {
  background: rgba(17, 24, 39, 0.5);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  padding: 6px 12px;
  min-height: 36px;
}

.links-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
}
.link-row.primary {
  border-color: #c4b5fd;
  background: #f5f3ff;
}
.link-label {
  font-size: 13px;
  color: var(--muted);
  grid-column: 1 / -1;
}
.link-url {
  color: var(--primary);
  font-size: 13px;
  overflow-wrap: anywhere;
  text-decoration: none;
  min-width: 0;
}

/* ตัวอย่างวงล้อบนหลังบ้าน: มือถือย่อได้ */
.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.preview-wrap .wheel-wrap {
  width: min(64vw, 40dvh, 320px);
}
.preview-toggle {
  width: 100%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.preview-toggle[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.22);
}

.pin-box {
  max-width: 380px;
  margin: 10vh auto 0;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.pin-box h2 {
  margin: 0;
}
.pin-box .slice-input {
  text-align: center;
  border: 1px solid var(--line);
  min-height: 48px;
}
.link-muted {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 8px;
}

/* ---------- animations ---------- */
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slide-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes count-pop {
  from {
    transform: scale(1.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-backdrop,
  .countdown-num {
    animation: none;
  }
}

/* =====================================================================
   มือถือแนวนอน (landscape, จอเตี้ย): วงล้อซ้าย ปุ่มขวา
   ===================================================================== */
@media (max-height: 520px) and (orientation: landscape) {
  .app-player .header {
    margin-bottom: 0;
  }
  .app-player .title-text {
    font-size: 18px;
    padding: 0;
  }
  .stage-solo {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-height: calc(100dvh - 60px);
    gap: 12px 24px;
  }
  .stage-solo .wheel-wrap {
    width: min(78dvh, 60vw);
  }
  .stage-solo .btn-spin {
    width: auto;
    min-width: 180px;
  }
}

/* =====================================================================
   มือถือใหญ่ / แท็บเล็ตเล็ก
   ===================================================================== */
@media (min-width: 480px) {
  :root {
    --gutter: 16px;
  }
  .toolbar .btn {
    flex: 0 1 auto;
  }
  .row-end .btn {
    flex: 0 1 auto;
  }
  .seg-btn {
    font-size: 14px;
  }
  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }
  .modal {
    border-radius: 20px;
    padding: 22px;
    width: min(100%, 440px);
    animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  }
  .modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .modal-actions .btn-primary {
    min-height: var(--tap);
    font-size: inherit;
  }
}

/* =====================================================================
   แท็บเล็ต / เดสก์ท็อป: 2 คอลัมน์
   ===================================================================== */
@media (min-width: 860px) {
  :root {
    --gutter: 20px;
  }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 24px;
    align-items: start;
  }
  .stage {
    position: sticky;
    top: 12px;
  }
  .panel-body {
    padding: 16px;
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
  }
  .tabs {
    position: static;
  }
  .tab {
    flex: 1;
  }
  .preview-wrap .wheel-wrap {
    width: min(100%, 360px);
  }
  .preview-toggle {
    display: none;
  }
  .btn:hover:not(:disabled) {
    background: #f3f4f6;
  }
  .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #9333ea);
  }
  .btn-danger-ghost:hover:not(:disabled) {
    background: #fef2f2;
  }
  .btn-logout:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.8);
    border-color: transparent;
  }
  .btn-spin:hover:not(:disabled) {
    filter: brightness(1.08);
  }
  .wheel-center:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.06);
  }
  .swatch:hover:not(:disabled) {
    transform: scale(1.12);
  }
  .icon-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: var(--text);
  }
  .link-url:hover,
  .link-muted:hover {
    text-decoration: underline;
  }
}

@media (min-width: 1100px) {
  .wheel-wrap {
    width: min(100%, 520px);
  }
}

/* มือถือ: ซ่อนตัวอย่างวงล้อเมื่อย่อ */
@media (max-width: 859px) {
  .preview-wrap.collapsed .wheel-wrap,
  .preview-wrap.collapsed .hint {
    display: none;
  }
}

/* ---------- CI4: save-state indicator ---------- */
.admin-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-state {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}
.save-state.dirty { color: #fde68a; }
.save-state.saving { color: #93c5fd; }
.save-state.ok { color: #86efac; }
.save-state.err { color: #fca5a5; }

.lock-slice-names { color: var(--muted); font-weight: 400; font-size: 0.9em; }
