:root {
    --bg-0: #090d18;
    --bg-1: #101828;
    --panel: #141b2ab8;
    --panel-border: #2f3b57;
    --text: #ebf1ff;
    --muted: #95a3c6;
    --accent: #8ab4ff;
    --accent-2: #7dd3fc;
    --wheel-height: 188px;
    --item-height: 38px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Inter, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 10%, #1f2a44 0%, transparent 35%),
        radial-gradient(circle at 85% 0%, #2d1f47 0%, transparent 28%),
        linear-gradient(160deg, var(--bg-0), var(--bg-1));
    padding: 18px 12px 28px;
}

.app {
    max-width: 1220px;
    margin: 0 auto;
}

h1 {
    margin: 0 0 10px;
    text-align: center;
    font-weight: 750;
    letter-spacing: 0.3px;
    font-size: clamp(1.35rem, 2.8vw, 2.1rem);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(6px);
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 0.86rem;
    letter-spacing: 0.9px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 700;
}

.wheel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.core-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.skill-panel {
    padding-top: 8px;
}

.skill-row {
    display: block;
}

.skill-wheel {
    --wheel-height: 210px;
    --item-height: 42px;
}

.unique-grid {
    margin-top: 10px;
}

.wheel {
    position: relative;
    overflow: hidden;
    height: var(--wheel-height);
    border-radius: 14px;
    border: 1px solid #3a4b71;
    background: linear-gradient(180deg, #17233aca, #10192cca);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.wheel.hidden {
    display: none;
}

.wheel::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 8px;
    font-size: 0.7rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--muted);
    z-index: 5;
    pointer-events: none;
}

.wheel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% - (var(--item-height) / 2));
    height: var(--item-height);
    border-top: 1px solid #5f83c8;
    border-bottom: 1px solid #5f83c8;
    background: linear-gradient(90deg, transparent, #7da4f21f 18%, #7da4f236 50%, #7da4f21f 82%, transparent);
    pointer-events: none;
    z-index: 3;
}

.wheel ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
}

.wheel li {
    height: var(--item-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: #dce7ff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wheel.has-icons li {
    justify-content: flex-start;
    padding: 0 10px;
}

.wheel-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-width: 0;
}

.wheel-item-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    flex: 0 0 22px;
    object-fit: cover;
    background: #0a1324;
    border: 1px solid #3c547f;
}

.wheel-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wheel .wheel-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background: linear-gradient(180deg,
            #0f1628a3 0%,
            transparent 24%,
            transparent 76%,
            #0f1628a3 100%);
}

#unique-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 6px;
}

#unique-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e3ecff;
    font-size: 0.88rem;
    padding: 7px 8px;
    background: #111a2c8a;
    border: 1px solid #30405f;
    border-radius: 10px;
    user-select: none;
}

#unique-options input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-2);
}

.actions {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

#spin-btn,
#copy-link-btn {
    border: 1px solid #4f6fab;
    background: linear-gradient(180deg, #2a3f6e, #20345c);
    color: #f0f5ff;
    border-radius: 12px;
    padding: 9px 14px;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

#spin-btn:hover,
#copy-link-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 5px 16px rgba(71, 111, 187, 0.35);
}

#spin-btn:active,
#copy-link-btn:active {
    transform: translateY(1px);
}

#spin-btn {
    min-width: 144px;
}

#result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 9px 10px;
}

#result-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#result-skill-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #4a6599;
    background: #0a1324;
    flex: 0 0 28px;
}

#build-text {
    margin: 0;
    color: #e6eeff;
    font-size: 0.92rem;
    line-height: 1.4;
    min-width: 0;
}

@media (max-width: 760px) {
    :root {
        --wheel-height: 160px;
        --item-height: 34px;
    }

    body {
        padding: 10px 8px 18px;
    }

    h1 {
        font-size: clamp(1.1rem, 5.4vw, 1.4rem);
        margin-bottom: 8px;
    }

    .panel {
        padding: 8px;
        border-radius: 10px;
    }

    .wheel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .core-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-wheel {
        --wheel-height: 186px;
        --item-height: 38px;
    }

    #unique-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    #unique-options label {
        font-size: 0.84rem;
        padding: 6px 7px;
    }

    .wheel::before {
        font-size: 0.62rem;
        left: 8px;
        top: 6px;
    }

    .wheel li {
        font-size: 0.82rem;
        padding: 0 8px;
    }

    .wheel.has-icons li {
        padding: 0 7px;
    }

    .wheel-item {
        gap: 7px;
    }

    .wheel-item-icon {
        width: 20px;
        height: 20px;
        border-radius: 4px;
    }

    #spin-btn,
    #copy-link-btn {
        width: 100%;
        text-align: center;
        min-width: 0;
    }

    #result {
        flex-direction: column;
        align-items: stretch;
    }

    #result-main {
        width: 100%;
    }
}

@media (max-width: 480px) {
    :root {
        --wheel-height: 150px;
        --item-height: 32px;
    }

    body {
        padding: 8px 6px 14px;
    }

    .panel {
        margin-bottom: 8px;
    }

    .core-grid,
    .wheel-grid {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    #unique-options {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .skill-wheel {
        --wheel-height: 172px;
        --item-height: 34px;
    }

    #result-skill-icon {
        width: 24px;
        height: 24px;
        border-radius: 5px;
        flex-basis: 24px;
    }
}