:root {
  --bg-color: #1a1a2e;
  --primary-color: #16213e;
  --secondary-color: #0f3460;
  --accent-color: #e94560;
  --text-color: #f0f0f0;
  --white-color: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.app-container {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

.roulette-section {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-width: 400px;
}

h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: 2px;
  margin-bottom: 2rem;
}

.roulette-container {
  position: relative;
  width: 450px;
  height: 450px;
}

#arrow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid var(--accent-color);
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.3));
  z-index: 10;
}

#roulette-canvas {
  transition: transform 5s cubic-bezier(0.25, 0.1, 0.25, 1);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

#spin-button {
  margin-top: 2rem;
  padding: 1rem 3rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-color);
  background-image: linear-gradient(45deg, var(--accent-color), #ff7a90);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#spin-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

#spin-button:disabled {
  cursor: not-allowed;
  background: #555;
  box-shadow: none;
}

.options-section {
  /* flex: 1; */
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 30vw;
  background-color: var(--primary-color);
  padding: 2rem;
  /* min-width: 320px; */
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  z-index: 1000;
}

.options-section.open {
  transform: translateX(0);
}

#settings-button {
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-color);
  background: var(--secondary-color);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#settings-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.2rem;
  cursor: pointer;
}

.close-button:hover {
  color: var(--accent-color);
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 0.5rem;
}

/* 옵션 추가 폼 */
#option-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.input-row {
  display: flex;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.text-group {
  flex-grow: 1;
}

.input-group label {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #ccc;
}

input[type='text'],
input[type='number'] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.8rem;
  border: 2px solid var(--secondary-color);
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 5px;
  font-size: 1rem;
}

input[type='color'] {
  width: 50px;
  height: 46px;
  padding: 5px;
  border: 2px solid var(--secondary-color);
  border-radius: 5px;
  background: var(--bg-color);
  cursor: pointer;
}

#option-form button {
  border-radius: 5px;
  padding: 0.8rem;
  border: none;
  background: var(--accent-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
}

/* 옵션 리스트 컨테이너 */
#option-list {
  list-style: none;
  max-height: 45vh;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-left: 0;
}

/* 각 옵션 항목: 가로 레이아웃 */
#option-list li {
  display: block;
  background: var(--secondary-color);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* 내부 콘텐츠 flex 배치 */
.option-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* 색상 편집 섹션 */
.color-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 50px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.color-swatch:active {
  transform: scale(1.05);
}

/* 텍스트·비중 편집 섹션 */
.text-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.text-edit-group,
.weight-edit-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.option-text,
.option-weight {
  flex: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
  min-width: 0;
}

.option-text {
  font-weight: 600;
  font-size: 1.1rem;
}

.option-weight {
  font-size: 0.9rem;
  color: #ccc;
}

.option-text:hover,
.option-weight:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* 편집 아이콘 */
.edit-icon {
  font-size: 0.8rem;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.1s;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  user-select: none;
}

.edit-icon:hover {
  opacity: 1;
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.1);
}

.edit-icon:active {
  transform: scale(0.95);
}

.text-edit-group:hover .edit-icon,
.weight-edit-group:hover .edit-icon,
.color-section:hover .edit-icon {
  opacity: 1;
}

/* 삭제 버튼 영역 */
.control-section {
  display: flex;
  align-items: center;
}

.delete-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s, transform 0.2s;
}

.delete-btn:hover {
  background-color: rgba(233, 69, 96, 0.2);
  transform: scale(1.1);
}

/* 인라인 편집 입력 필드 */
.inline-input {
  background: var(--bg-color);
  color: var(--text-color);
  border: 2px solid var(--accent-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: inherit;
  font-weight: inherit;
  min-width: 100px;
  flex: 1;
}

.inline-input:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 5px rgba(233, 69, 96, 0.5);
}

/* 옵션 초기화 버튼 */
#reset-button {
  width: 100%;
  border-radius: 5px;
  padding: 0.8rem;
  border: 1px solid var(--secondary-color);
  background: transparent;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: background-color 0.2s, color 0.2s;
}

#reset-button:hover {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

/* 옵션 리스트 스크롤바 스타일링 (선택사항) */
#option-list::-webkit-scrollbar {
  width: 6px;
}

#option-list::-webkit-scrollbar-track {
  background: var(--primary-color);
}

#option-list::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: 3px;
}

#option-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* 반응형 */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .option-content {
    flex-direction: column;
    gap: 0.8rem;
    align-items: stretch;
  }

  .text-section {
    order: -1;
  }

  .color-section {
    flex-direction: row;
    justify-content: center;
  }
}
