:root {
  --bg-color: #0f172a; /* Slate 900 */
  --text-color: #f8fafc; /* Slate 50 */
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --red-500: #ef4444;
  --red-400: #f87171;
  --amber-500: #f59e0b;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* --- Layout --- */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  width: 100%;
  max-width: 56rem; /* 4xl */
  margin: 0 auto;
  gap: 2rem;
  flex: 1;
}

/* --- Header --- */
.app-header {
  text-align: center;
  margin-top: 2rem;
}
.app-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(to right, #2dd4bf, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-header p {
  color: var(--slate-400);
  margin: 0;
  font-size: 0.875rem;
}
@media (min-width: 768px) {
    .app-header { margin-top: 0; }
    .app-header h1 { font-size: 3rem; }
    .app-header p { font-size: 1rem; }
}

/* --- Sound Button --- */
.sound-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.75rem;
  background-color: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--slate-700);
  border-radius: 9999px;
  color: var(--slate-400);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.sound-btn:hover {
  background-color: var(--slate-700);
  color: white;
}

/* --- Wheel --- */
.wheel-wrapper {
  position: relative;
  width: 100%;
  max-width: 350px;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-glow {
  position: absolute;
  inset: 0;
  background-color: rgba(99, 102, 241, 0.2);
  border-radius: 9999px;
  filter: blur(40px);
  transition: opacity 0.7s, transform 0.7s;
  opacity: 0.5;
  transform: scale(1);
  pointer-events: none;
}
.wheel-glow.active {
    opacity: 1;
    transform: scale(1.1);
}

.wheel-pointer-container {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -0.5rem);
    z-index: 20;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}
.wheel-pointer-triangle {
    width: 0; 
    height: 0; 
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid #ef4444;
}

.wheel-svg-container {
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 25px 25px rgba(0,0,0,0.15));
    transition: transform 0.2s;
}
.wheel-svg-container:hover {
    transform: scale(1.02);
}
.wheel-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* --- Status --- */
.status-container {
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}
.status-text {
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--slate-500);
    margin: 0;
}
.status-text.spinning {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.status-text.error {
    color: var(--amber-500);
    font-size: 0.875rem;
}

.winner-announcement {
    animation: bounce 1s infinite;
}
.winner-label {
    color: var(--slate-400);
    font-size: 0.875rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin: 0 0 0.25rem 0;
}
.winner-name {
    font-size: 2.25rem;
    font-weight: 900;
    color: white;
    filter: drop-shadow(0 0 15px rgba(255,255,255,0.5));
    margin: 0;
}

/* --- Controls --- */
.controls-wrapper {
    width: 100%;
    max-width: 28rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.spin-btn-container {
    display: flex;
    justify-content: center;
}
.spin-btn {
    width: 100%;
    max-width: 200px;
    padding: 1rem 2rem;
    background: linear-gradient(to right, #6366f1, #9333ea);
    border-radius: 9999px;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, opacity 0.2s;
    position: relative;
    overflow: hidden;
}
.spin-btn:hover { transform: scale(1.05); }
.spin-btn:active { transform: scale(0.95); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.spin-btn-shine {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background-color: white;
    opacity: 0;
    transition: opacity 0.2s;
}
.spin-btn:hover .spin-btn-shine { opacity: 0.2; }

/* Cards */
.card {
    background-color: rgba(30, 41, 59, 0.5);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
    backdrop-filter: blur(4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Input Section */
.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-300);
    margin-bottom: 0.5rem;
}

.text-input {
    width: 100%;
    background-color: var(--slate-900);
    border: 1px solid var(--slate-600);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: white;
    min-height: 100px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}
.text-input:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.text-input::placeholder { color: var(--slate-500); }

.btn-secondary {
    background-color: var(--slate-700);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    width: 100%;
    margin-top: 0.5rem;
}
.btn-secondary:hover { background-color: var(--slate-600); }
.btn-secondary:disabled { opacity: 0.5; }

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 0.25rem;
}
.checkbox-wrapper input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--indigo-500);
    cursor: pointer;
}
.checkbox-wrapper label {
    font-size: 0.875rem;
    color: var(--slate-400);
    cursor: pointer;
}
.checkbox-wrapper label:hover { color: var(--slate-300); }

.divider {
    width: 100%;
    height: 1px;
    background-color: var(--slate-700);
    margin: 1rem 0;
}

/* List Header */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--slate-500);
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}
.list-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    transition: color 0.2s;
}
.text-btn.indigo { color: var(--indigo-400); }
.text-btn.indigo:hover { color: #a5b4fc; }
.text-btn.red { color: var(--red-400); }
.text-btn.red:hover { color: #fca5a5; }
.text-btn.hidden, .hidden { display: none !important; }

/* Options List */
.options-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.25rem;
}

.option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(51, 65, 85, 0.5);
    padding: 0.75rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}
.option-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}
.color-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.option-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-300);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delete-btn {
    background: none;
    border: none;
    color: var(--slate-500);
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
}
.option-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { color: var(--red-400); }

/* History */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.card-header h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--slate-300);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.text-btn.small {
    font-size: 0.75rem;
    color: var(--slate-400);
}
.text-btn.small:hover { color: var(--red-400); }

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(15, 23, 42, 0.5);
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
    gap: 0.5rem;
}
.history-label-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}
.history-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.history-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--slate-300);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-time {
    font-size: 0.65rem;
    font-family: monospace;
    color: var(--slate-500);
    white-space: nowrap;
}
.empty-msg {
    text-align: center;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--slate-500);
    padding: 0.5rem 0;
}

/* Footer */
.app-footer {
    padding: 1.5rem;
    text-align: center;
    color: var(--slate-600);
    font-size: 0.75rem;
    margin-top: auto;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #1e293b; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1); }
    50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1); }
}
