* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

:root {
    /* Font variables */
    --font-family: 'Google Sans Code', sans-serif;
    --font-family-mono: 'Google Sans Code', monospace;
    
    /* Light mode variables */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --active: #16a34a;
    --slider-track: #d0d0d0;
}

[data-theme="dark"] {
    /* Dark mode variables */
    --bg-primary: #26262c;
    --bg-secondary: #1a1a1d;
    --bg-tertiary: #16181d;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --active: #16a34a;
    --slider-track: #34343b;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
}

/* Theme Toggle Container - Top Right */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 4px 12px var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.theme-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.light-icon {
    color: #fbbf24;
}

.dark-icon {
    color: #6366f1;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.active .toggle-switch {
    background: #6366f1;
}

.theme-toggle.active .toggle-switch::before {
    transform: translateX(20px);
}

.theme-toggle.active .light-icon {
    opacity: 0.5;
}

.theme-toggle.active .dark-icon {
    opacity: 1;
    color: #a5b4fc;
}

.theme-toggle:not(.active) .light-icon {
    opacity: 1;
}

.theme-toggle:not(.active) .dark-icon {
    opacity: 0.5;
}

/* Sound Toggle */
.sound-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    cursor: pointer;
    user-select: none;
}

.toggle-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sound-toggle[data-enabled="true"] .toggle-background {
    border-color: #16a34a;
}

.toggle-background .enabled-icon {
    font-size: 16px;
    color: #16a34a;
}

.sound-toggle[data-enabled="false"] .toggle-background {
    border-color: #dc2626;
}

.toggle-background .disabled-icon {
    font-size: 16px;
    color: #dc2626;
}

.toggle-icon {
    font-size: 12px;
    color: white;
    transition: all 0.3s ease;
    z-index: 1;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.sound-toggle[data-enabled="true"] .toggle-slider{
    background: #16a34a;
}

.sound-toggle[data-enabled="false"] .toggle-slider{
    background: #dc2626;
}

.sound-toggle[data-enabled="true"] .toggle-slider {
    transform: translateX(30px);
}

.sound-toggle[data-enabled="false"] .toggle-slider {
    transform: translateX(0);
}

.sound-toggle[data-enabled="true"] .disabled-icon {
    opacity: 0.5;
}

.sound-toggle[data-enabled="true"] .enabled-icon {
    opacity: 1;
}

.sound-toggle[data-enabled="false"] .disabled-icon {
    opacity: 1;
}

.sound-toggle[data-enabled="false"] .enabled-icon {
    opacity: 0.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px var(--shadow);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    color: var(--text-secondary);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Wheel Section */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    margin-bottom: 30px;
}

#wheelCanvas {
    border-radius: 50%;
    /* remove CSS border/box-shadow so the canvas-drawn ring is the single visible border */
    border: none !important;
    box-shadow: none;
    outline: none;
    background: var(--bg-primary);
}

.wheel-pointer {
    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: 30px solid #ff4757;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.spin-button {
    width: 100%;
    height: 50px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(45deg, #ff4757, #ff3742);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    margin-top: 10px;
}

.spin-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

.spin-button:active {
    transform: scale(0.95);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spin-button.spinning {
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.result-display {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-announcement {
    background: linear-gradient(45deg, #2ed573, #1e90ff);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease, background 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.3);
}

.winner-announcement.show {
    opacity: 1;
    transform: translateY(0);
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.prizes-panel, .settings-panel, .history-panel {
    background: var(--bg-secondary);
    border-radius: 4px;
    border-width: 1px;
    border-style: solid;
    border-color: var(--border-color);
    padding: 20px;
}

.prizes-panel h3, .settings-panel h3, .history-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Wheels Manager */
.wheels-manager {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.wheels-dropdown-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.wheels-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

#wheelSelect {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.wheel-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.load-btn {
    background: #8b5cf6;
    color: white;
}

.load-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.save-btn {
    background: var(--active);
    color: white;
}

.save-btn:hover:not(:disabled) {
    background: var(--active);
    transform: translateY(-2px);
}

.save-btn:disabled {
    background: #9ca3af;
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
}

.save-settings-btn {
    background: var(--active);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
    justify-content: center;
}

.save-settings-btn:hover:not(:disabled) {
    background: #15803d;
    transform: translateY(-2px);
}

.save-settings-btn:disabled {
    background: #9ca3af;
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
}

.settings-actions {
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.rename-btn {
    background: #f59e0b;
    color: white;
}

.rename-btn:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.new-btn {
    background: #3b82f6;
    color: white;
}

.new-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.delete-btn {
    background: #ef4444;
    color: white;
}

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.wheel-btn:active {
    transform: translateY(0);
}

.prize-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#prizeInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

#prizeInput:focus {
    outline: none;
    border-color: #667eea;
}

#addPrizeButton {
    padding: 10px 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#addPrizeButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.prizes-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.prize-wrapper {
    position: relative;
    margin-bottom: 5px;
}

.prize-wrapper:last-child {
    margin-bottom: 0;
}

.prize-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 0 4px 4px 0;
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: none;
    margin-left: 70px;
    height: 32px;
    box-sizing: border-box;
    position: relative;
}

.prize-item::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--prize-color, #667eea);
}

.prize-item:last-child {
    margin-bottom: 0;
}

.prize-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    user-select: none; /* Prevent text selection during drag */
}

.prize-text:hover {
    background-color: var(--bg-secondary);
}

.prize-edit-input {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Google Sans Code', monospace;
    user-select: text; /* Allow text selection in edit mode */
    cursor: text; /* Show text cursor */
}

.prize-edit-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.remove-prize {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-prize:hover {
    background: #ff3742;
}

.edit-prize {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 5px;
}

.edit-prize:hover {
    background: #d97706;
}

.prize-weight-group {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 70px;
    flex-shrink: 0;
}

.prize-weight-icon {
    color: var(--text-secondary);
    font-size: 12px;
    width: 12px;
    flex-shrink: 0;
}

.prize-weight-group label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.prize-weight-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 48px;
    height: 32px;
}

.prize-weight-input {
    width: 100%;
    height: 32px;
    padding: 2px 20px 2px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    text-align: center;
    font-family: 'Google Sans Code', monospace;
    line-height: 1.2;
    box-sizing: border-box;
}

/* Hide native spinner buttons */
.prize-weight-input::-webkit-outer-spin-button,
.prize-weight-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.prize-weight-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

.prize-weight-nav {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 16px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 0 3px 3px 0;
    overflow: hidden;
}

.prize-weight-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 8px;
    transition: all 0.2s;
    border-radius: 0;
}

/* Drag & drop prize reordering */
.prize-wrapper {
    cursor: default; /* Don't show grab cursor everywhere */
}

.prize-wrapper.dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.prize-drag-handle {
    position: absolute;
    left: -26px; /* sits just to the left of weight group */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: grab;
    user-select: none;
    font-size: 14px;
}

.prize-drag-handle:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 4px;
}

.prize-drag-handle:active {
    cursor: grabbing;
}

/* Custom Color Picker Styles */
.prize-color-wrapper {
    display: flex;
    align-items: center;
    margin: 0 8px 0 0;
    position: relative;
}

.custom-color-picker {
    position: relative;
    display: inline-block;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-block;
}

.color-swatch:hover {
    filter: brightness(1.2);
}

.color-panel {
    position: fixed;
    z-index: 10000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-picker-main {
    display: flex;
    gap: 10px;
    height: 180px;
}

.saturation-lightness-area {
    position: relative;
    width: 200px;
    height: 180px;
    border-radius: 4px;
    cursor: crosshair;
    background: linear-gradient(to top, #000, transparent),
                linear-gradient(to right, #fff, #ff0000);
}

.sl-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.hue-bar {
    position: relative;
    width: 20px;
    height: 180px;
    border-radius: 4px;
    cursor: pointer;
    background: linear-gradient(to bottom,
        #ff0000 0%,
        #ffff00 16.66%,
        #00ff00 33.33%,
        #00ffff 50%,
        #0000ff 66.66%,
        #ff00ff 83.33%,
        #ff0000 100%
    );
}

.hue-cursor {
    position: absolute;
    left: -2px;
    width: 24px;
    height: 4px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 2px;
    transform: translateY(-50%);
    pointer-events: none;
}

.color-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prize-color-hex {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Google Sans Code', monospace;
    font-size: 12px;
    text-transform: uppercase;
    min-width: 0; /* Allow flex shrinking */
}

.prize-color-hex:focus {
    outline: none;
    border-color: #667eea;
}

.close-color {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 3px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.close-color:hover {
    background: #ff3742;
}

.prize-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.prize-wrapper.dragging .prize-drag-handle {
    cursor: grabbing;
}

.prize-wrapper:active,
.prize-wrapper:active .prize-drag-handle {
    cursor: grabbing;
}

/* Optional visual placeholder while dragging (handled by DOM move) */
.prize-wrapper.drag-over:not(.dragging) {
    outline: 2px dashed var(--accent-color);
    outline-offset: 2px;
}
.prize-weight-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.prize-weight-button.weight-up {
    border-bottom: 1px solid var(--border-color);
}

.prize-weight-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Drag and drop styles */
.prize-drag-handle {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: grab;
    font-size: 12px;
    transition: color 0.2s ease;
}

.prize-drag-handle:hover {
    color: var(--text-primary);
}

.prize-drag-handle:active {
    cursor: grabbing;
}

.prize-wrapper.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.prize-wrapper.drag-over {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.prize-wrapper[draggable="true"]:hover .prize-drag-handle {
    color: var(--active);
}

/* Inline wheel name editing */
.wheel-name-edit-input {
    background: var(--bg-primary);
    border: 2px solid var(--active);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    min-width: 150px;
    outline: none;
    transition: border-color 0.2s ease;
}

.wheel-name-edit-input:focus {
    border-color: var(--active);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.preset-buttons {
    display: flex;
    gap: 10px;
}

.preset-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
}

.preset-btn.danger {
    border-color: #ff4757;
    color: #ff4757;
}

.preset-btn.danger:hover {
    background: #ff4757;
    color: white;
}

/* Settings Panel */
.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.slider-container input[type="range"] {
    flex: 1;
    margin: 10px 0;
}

.slider-labels {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    font-size: 14px;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#spinDurationValue {
    font-weight: bold;
    background: var(--active);
    color: white;
    border-radius: 3px;
    padding: 2px 6px;
    min-width: 24px;
    text-align: center;
    font-size: 12px;
}

/* Chrome/Edge/Safari range slider styling */
input[type="range"]#spinDuration::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--slider-track);
    border-radius: 3px;
}
input[type="range"]#spinDuration {
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}
input[type="range"]#spinDuration::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--active);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    position: relative;
    z-index: 1;
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.2s ease;
}

input[type="range"]#spinDuration::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(72, 192, 128, 0.2);
}

/* Firefox range slider styling */
input[type="range"]#spinDuration::-moz-range-track {
    height: 6px;
    background: var(--slider-track);
    border-radius: 3px;
}

input[type="range"]#spinDuration::-moz-range-progress {
    height: 6px;
    background: var(--active);
    border-radius: 3px;
}

input[type="range"]#spinDuration::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--active);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.2s ease;
}

input[type="range"]#spinDuration::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(72, 192, 128, 0.2);
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff4757;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotateZ(360deg);
        opacity: 0;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #wheelCanvas {
        width: 300px;
        height: 300px;
    }
    
    .controls-section {
        order: -1;
    }
}

/* Wheel Controls */
.wheel-controls {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.wheel-controls h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.obs-link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.url-input-container {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    position: relative;
    display: flex;
    align-items: center;
}

.obs-url-input {
    flex: 1;
    min-width: 0; /* Allow input to shrink */
    padding: 8px 40px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Google Sans Code', monospace;
    font-size: 12px;
    user-select: all;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obs-url-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.url-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    z-index: 1;
}

.url-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* OBS Display Toggle */
.obs-display-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    cursor: pointer;
    user-select: none;
}

.obs-display-toggle .toggle-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.obs-display-toggle[data-hidden="false"] .toggle-background {
    border-color: #dc2626;
}

.obs-display-toggle[data-hidden="true"] .toggle-background {
    border-color: #16a34a;
}

.obs-display-toggle .visible-icon {
    font-size: 12px;
    color: #dc2626;
}

.obs-display-toggle .hidden-icon {
    font-size: 12px;
    color: #16a34a;
}

.obs-display-toggle .toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #dc2626;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.obs-display-toggle[data-hidden="true"] .toggle-slider {
    transform: translateX(30px);
    background: #16a34a;
}

.copy-btn {
    padding: 8px 12px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent button from shrinking */
    min-width: fit-content;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background: #2ed573;
    pointer-events: none;
    cursor: not-allowed;
}

.copy-btn.copying {
    pointer-events: none;
    opacity: 0.8;
    cursor: not-allowed;
}

/* Notification System */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 300px;
    word-wrap: break-word;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.notification.warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.notification.info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Dark mode notification styles */
[data-theme="dark"] .notification.success {
    background: var(--active);
    color: white;
    border-color: rgba(40, 167, 69, 0.4);
}

[data-theme="dark"] .notification.error {
    background: rgba(220, 53, 69, 0.2);
    color: #f87171;
    border-color: rgba(220, 53, 69, 0.4);
}

[data-theme="dark"] .notification.warning {
    background: rgba(255, 193, 7, 0.2);
    color: #fbbf24;
    border-color: rgba(255, 193, 7, 0.4);
}

[data-theme="dark"] .notification.info {
    background: var(--active);
    color: #38bdf8;
    border-color: rgba(13, 202, 240, 0.4);
}

/* Prize History Panel */
.history-panel {
    margin-top: 20px;
}

.history-controls {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

.clear-history-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-history-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.clear-history-btn:active {
    transform: translateY(0);
}

.history-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--bg-tertiary);
}

.history-prize {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-wheel {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-family-mono);
}

.no-history {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Dark mode adjustments for history */
[data-theme="dark"] .clear-history-btn {
    background: #e74c3c;
}

[data-theme="dark"] .clear-history-btn:hover {
    background: #c0392b;
}
