:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.app-container {
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

.glow-text {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
    margin-bottom: 0.5rem;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    justify-content: center;
    align-items: flex-start;
}

/* Wheel Section */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    flex: 1;
    min-width: 300px;
}

.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    transition: transform cubic-bezier(0.17, 0.67, 0.12, 0.99); /* smooth deceleration */
    border: 8px solid var(--panel-bg);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--danger);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.spin-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.spin-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(59, 130, 246, 0.4);
}

.spin-btn:active {
    transform: translateY(1px);
}

.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Config Section */
.config-section {
    flex: 1;
    min-width: 350px;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.config-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.items-list::-webkit-scrollbar {
    width: 6px;
}
.items-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    transition: background 0.2s;
}

.item-row:hover {
    background: rgba(0,0,0,0.3);
}

.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
}

.item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-name {
    font-weight: 600;
}

.item-prob {
    color: var(--accent);
    font-weight: 800;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.delete-btn:hover {
    opacity: 1;
}

.add-item-form {
    display: flex;
    gap: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
}

#newItemName {
    flex: 1 1 100px;
}

#newItemColor {
    flex: 0 0 42px;
}

input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.6rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
    min-width: 0;
}

input:focus {
    border-color: var(--primary);
}

input[type="color"] {
    padding: 0;
    height: 42px;
    width: 42px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.add-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #059669;
}

.stats {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.warning {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: none;
}
.warning.show {
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    padding: 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.modal.hidden .modal-content {
    transform: scale(0.8);
}

.close-btn {
    margin-top: 1rem;
    padding: 0.8rem 2rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

@media (max-width: 768px) {
    .wheel-container {
        width: 300px;
        height: 300px;
    }
    
    .add-item-form {
        flex-wrap: wrap;
    }
    
    #newItemName { flex: 1 1 100%; }
}
