:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #f43f5e;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.background-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    z-index: -1;
    filter: blur(80px);
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    text-align: center;
}

.main-content {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    justify-content: center;
    margin-top: 2rem;
}

@media (max-width: 850px) {
    .main-content {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }
}

header {
    margin-bottom: 3rem;
}

.title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.title span {
    color: var(--primary);
}

.subtitle {
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Wheel Styles */
.wheel-section {
    position: relative;
    flex-shrink: 0;
}

.wheel-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition: transform 5s cubic-bezier(0.15, 0, 0.15, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.4);
    background: #1e293b;
}

.pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 45px;
    background: white;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid rgba(0,0,0,0.1);
}

.pointer::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 10px;
    background: white;
    border-radius: 4px 4px 0 0;
}

.spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--text-light);
    color: var(--bg-dark);
    font-weight: 800;
    border: none;
    cursor: pointer;
    z-index: 11;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s, background 0.2s;
}

.spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: #fff;
}

.spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Result Display */
.result-display {
    margin-top: 2rem;
    min-height: 3rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.result-display.show {
    opacity: 1;
    transform: translateY(0);
}

.result-label {
    font-size: 1.1rem;
    opacity: 0.8;
}

.result-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

/* Controls */
.mode-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Custom Panel */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
}

.hidden {
    display: none;
}

.custom-panel h3 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#option-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
}

#add-option {
    padding: 0 1.2rem;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.option-list {
    list-style: none;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 0.4rem;
}

.remove-btn {
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Canvas/SVG sectors will be generated by JS */
.sector {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
}

.sector-text {
    display: none;
}

.legend {
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    text-align: left;
    min-width: 300px;
}

@media (max-width: 480px) {
    .legend {
        grid-template-columns: 1fr;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.95rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.footer {
    margin-top: 3rem;
    opacity: 0.4;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-align: center;
    width: 100%;
}
