/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink:       #f472b6;
  --pink-dark:  #db2777;
  --pink-light: #fce7f3;
  --rose:       #fdf2f8;
  --text:       #1e1b4b;
  --text-muted: #6b7280;
  --sidebar-w:  300px;
  --radius:     14px;
  --shadow:     0 4px 24px rgba(0,0,0,.10);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--rose);
  color: var(--text);
}

/* ── Layout ── */
body { display: flex; overflow: hidden; }

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid #fce7f3;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(244,114,182,.10);
  z-index: 10;
}

#right-panel {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #fff;
  border-left: 1px solid #fce7f3;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: -2px 0 12px rgba(244,114,182,.10);
  z-index: 10;
}

#sidebar-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--pink-light);
}

#sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pink-dark);
}

#main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Sidebar sections ── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-title button {
  background: var(--pink-light);
  border: none;
  color: var(--pink-dark);
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.section-title button:hover { background: var(--pink); color: #fff; }

/* Wheel list */
#wheel-list, #item-list {
  list-style: none;
  padding: 0 10px;
}

#wheel-list li, #item-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s;
  font-size: .95rem;
}

#wheel-list li:hover { background: var(--pink-light); }

#wheel-list li.active {
  background: var(--pink);
  color: #fff;
  font-weight: 600;
}

/* Item list */
#item-list li {
  cursor: default;
  gap: 6px;
}

#item-list li .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

#item-list li .item-label {
  flex: 1;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#item-list li .btn-remove {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: .85rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .12s;
  flex-shrink: 0;
}

#item-list li .btn-remove:hover { color: var(--pink-dark); }

/* Add item row */
#add-item-row {
  display: flex;
  gap: 6px;
  padding: 10px 10px 16px;
}

#new-item-input {
  flex: 1;
  border: 1px solid var(--pink-light);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}

#new-item-input:focus { border-color: var(--pink); }

#btn-add-item {
  background: var(--pink);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 34px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}

#btn-add-item:hover { background: var(--pink-dark); }

/* ── Wheel area ── */
#wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

#wheel-wrapper {
  position: relative;
  width: 500px;
  height: 500px;
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow: var(--shadow);
  display: block;
}

#pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.2rem;
  color: var(--pink-dark);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
  z-index: 5;
  pointer-events: none;
  line-height: 1;
}

#btn-spin {
  background: var(--pink);
  color: #fff;
  border: none;
  padding: 14px 48px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244,114,182,.45);
  transition: background .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
}

#btn-spin:hover:not(:disabled) {
  background: var(--pink-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(219,39,119,.4);
}

#btn-spin:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Result banner ── */
#result-banner {
  background: #fff;
  border: 2px solid var(--pink);
  border-radius: var(--radius);
  padding: 14px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: pop .25s ease;
}

@keyframes pop {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

#result-banner span {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pink-dark);
}

/* ── Empty state ── */
#empty-state {
  display: none;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

#empty-state.show { display: block; }
#wheel-container.hidden { display: none !important; }

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 32px;
  width: 320px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#modal h2 { font-size: 1.15rem; color: var(--pink-dark); }

#modal-input {
  border: 1px solid var(--pink-light);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .95rem;
  outline: none;
  width: 100%;
  transition: border-color .15s;
}

#modal-input:focus { border-color: var(--pink); }

#modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#modal-actions button {
  padding: 8px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: background .12s;
}

#modal-cancel { background: #f3f4f6; color: var(--text-muted); }
#modal-cancel:hover { background: #e5e7eb; }
#modal-confirm { background: var(--pink); color: #fff; }
#modal-confirm:hover { background: var(--pink-dark); }

/* ── Helpers ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  body { flex-direction: column; overflow: auto; }

  #sidebar, #right-panel {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--pink-light);
    box-shadow: none;
  }

  #right-panel { border-top: 1px solid var(--pink-light); border-bottom: none; }

  #wheel-wrapper { width: 90vw; height: 90vw; }
  #wheel-canvas  { width: 100%; height: 100%; }
  #main { padding: 24px 0 32px; }
}
