* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-gradient-1: #667eea;
    --bg-gradient-2: #764ba2;
    --panel-bg: white;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e0e0e0;
    --sector-item-bg: #f8f9fa;
    --sector-item-hover: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --modal-shadow: rgba(0, 0, 0, 0.3);
    --canvas-bg: white;
    --center-circle: #fff;
    --center-dot: #333;
}

body.dark-theme {
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --panel-bg: #1e2139;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #3a3d5c;
    --sector-item-bg: #2a2d47;
    --sector-item-hover: #353859;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --modal-shadow: rgba(0, 0, 0, 0.6);
    --canvas-bg: #2a2d47;
    --center-circle: #1e2139;
    --center-dot: #e0e0e0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 30px;
}

h1 {
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 2.5em;
}

/* Theme Toggle Switch */
.theme-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    transition: .4s;
    border-radius: 34px;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.theme-slider:before {
    position: absolute;
    content: "☀️";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 2px;
    background: white;
    transition: .4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

input:checked+.theme-slider {
    background: #2c3e50;
    border-color: #34495e;
}

input:checked+.theme-slider:before {
    transform: translateX(28px);
    content: "🌙";
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
    }

    .theme-toggle {
        position: static;
        transform: none;
    }

    .controls-row {
        display: flex;
        gap: 20px;
        justify-content: center;
    }

    h1 {
        font-size: 2em;
    }
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--panel-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 50px;
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: 0 10px 30px var(--shadow-color);
    background: var(--canvas-bg);
    transition: background 0.3s ease;
}

.pointer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-top: 45px solid #ff4757;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
    z-index: 10;
}

.pointer::before {
    content: '';
    position: absolute;
    top: -45px;
    left: -15px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #c0392b;
}

.spin-button {
    margin-top: 30px;
    padding: 15px 50px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.spin-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(255, 71, 87, 0.5);
}

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

.panel h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.panel h3 {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.sector-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.sector-input input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--sector-item-bg);
    color: var(--text-primary);
}

.sector-input input:focus {
    outline: none;
    border-color: #667eea;
}

.sector-input button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.sector-input button:hover {
    background: #5a67d8;
}

.sectors-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: var(--sector-item-bg);
    border-radius: 5px;
    transition: all 0.3s;
    color: var(--text-primary);
}

.sector-item:hover {
    background: var(--sector-item-hover);
}

.sector-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 10px;
    display: inline-block;
    vertical-align: middle;
}

.delete-sector {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.delete-sector:hover {
    background: #ff3838;
}

.settings-group {
    margin-bottom: 15px;
}

.settings-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.settings-group input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    transition: all 0.3s;
    background: var(--sector-item-bg);
}

.settings-group input:focus {
    outline: none;
    border-color: #667eea;
}

.settings-value {
    display: inline-block;
    margin-left: 10px;
    color: #667eea;
    font-weight: bold;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--sector-item-bg);
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-time {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.history-result {
    font-weight: bold;
    color: var(--text-primary);
    margin-top: 5px;
    transition: color 0.3s ease;
}

.clear-history {
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    transition: background 0.3s;
}

.clear-history:hover {
    background: #c0392b;
}

.winner-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 60px var(--modal-shadow);
    z-index: 1000;
    text-align: center;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.winner-modal h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.5em;
}

.winner-text {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.presets {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.preset-button {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.preset-button:hover {
    background: #2980b9;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}


/* Тумблеры */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    transition: .3s;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch .slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.switch input:checked+.slider {
    background: #667eea;
}

.switch input:checked+.slider:before {
    transform: translateX(24px);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--sector-item-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}
