:root {
  --card-bg: var(--surface);
  --card-border: var(--border);
  --card-shadow: var(--shadow);
}

.roulette-panel {
  max-width: 1100px;
  margin: 0 auto;
}

.interactive-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Config Section (Replaces .controls) */
.config-section {
  padding-top: 10px;
  margin-top: 20px;
}

.items-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.items-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.items-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.items-legend {
  display: grid;
  grid-template-columns: 1fr 90px 80px 44px;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border-radius: 10px;
}

.legend-text:nth-child(2),
.legend-text:nth-child(3) {
  text-align: center;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 90px 80px 44px;
  gap: 12px;
    padding: 8px 12px;
  align-items: center;
  transition: all 0.2s ease;
}

.item-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.item-visual {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.item-input-wrap {
  position: relative;
  flex: 1;
  width: 100%;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 3px var(--border);
}

.item-input {
  width: 100%;
  padding: 14px 46px 14px 16px!important;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.item-clear-btn {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  padding: 4px;
}

.item-input:focus {
  outline: none;
}

.weight-input {
  width: 100%;
  height: 100%;
  padding: 0 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  font-weight: 700;
}

.weight-input:focus {
  outline: none;
}

.percent-display {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.percent-display.is-highlight {
  color: var(--primary);
}

.item-add-btn {
  width: 100%;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  font-size: 0.95rem;
}

.item-add-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.item-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.remove-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.remove-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.remove-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Wheel Layout */
.wheel-area {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.wheel-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  flex: 1;
  min-width: 300px;
  max-width: 500px;
}

.wheel-shell {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%; 
  border-radius: 50%;
  box-shadow: 
    0 20px 40px -10px rgba(0, 0, 0, 0.2),
    0 0 0 10px var(--surface-2);
  background: var(--surface);
  overflow: visible; /* Pointer needs stick out */
}

#wheel-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  z-index: 1;
}

/* Pointer Styles */
.pointer {
  position: absolute;
  top: 0px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.pointer-body {
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 40px solid #ef4444; /* Red pointer */
}

/* Sidebar & Info */
.roulette-sidebar {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
}

.roulette-sidebar .control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.result-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
    align-items: center;
}

.result-highlight {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  text-align: left;
  padding: 8px 0;
  word-break: break-word;
  line-height: 1.3;
}

.result-highlight.animate-pop {
  animation: popVictory 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popVictory {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.status-hint {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: left;
  min-height: 1.2rem;
  line-height: 1.4;
}

.status-hint.is-error {
  color: #ef4444;
}

.control-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-actions .primary-btn,
.control-actions .pill-btn,
.control-actions .ghost-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Stop button specific styling - red color */
#stop-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: white !important;
  border: none !important;
}

#stop-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(239, 68, 68, 0.5);
}

#stop-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Collapsible Design (Copied from QR) */
.options-collapsible {
  position: relative;
  z-index: 10;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.options-collapsible:not(.collapsed) {
  border: none;
  box-shadow: none;
  overflow: visible;
}

.options-collapsible.collapsed {
  background: transparent;
  overflow: visible;
}

.options-toggle {
  width: 100%;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  z-index: 20;
}

/* Collapsed State: Prominent Action Button */
.options-collapsible.collapsed .options-toggle {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
  margin-bottom: 0;
}

.options-collapsible.collapsed .options-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.5);
  filter: brightness(1.1);
}

/* Expanded State: Subtle Control Button */
.options-collapsible:not(.collapsed) .options-toggle {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.options-collapsible:not(.collapsed) .options-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.options-toggle i {
  font-size: 1.1em;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.options-collapsible:not(.collapsed) .options-toggle i {
  transform: rotate(0deg);
}

.options-collapsible.collapsed .options-toggle i {
  transform: rotate(180deg);
}

.options-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transform-origin: top center;
  transition: max-height 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.options-content:not(.collapsed) {
  max-height: 2500px; /* Ample space */
  opacity: 1;
  transform: translateY(0) scale(1);
}

.options-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.options-content .options {
  padding: 24px;
}

.remove-btn[disabled] {
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

@media (max-width: 960px) {
  .wheel-area {
    flex-direction: column;
    align-items: center;
    gap: 30px;
  }

  .roulette-sidebar {
    width: 100%;
    max-width: none;
    flex-direction: row;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  /* 모바일 컨트롤 패널 중앙 정렬 */
  .roulette-sidebar .control-panel {
    align-items: center;
    text-align: center;
  }

  .result-section {
    align-items: center;
  }

  .result-highlight,
  .status-hint {
    text-align: center;
  }

  /* 모바일 사이드바 세로 배치 */
  .roulette-sidebar {
    flex-direction: column;
    gap: 20px;
  }
  .item-row {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
  }
  .items-legend {
        grid-template-columns: 1fr 1fr 1fr;
  }
  .color-dot {
        position: absolute;
        width: 100%;
        height: 100%;
        z-index: -1;
        border-radius: 16px;
        top: 0;
        left: 0;
  }
}

