:root {
    --bg-sky-top: #6a1b9a;
    --bg-sky-bottom: #29b6f6;
    --wheel-color: #7b1fa2;
    --wheel-border: #ce93d8;
    --player1-cyan: #00e5ff;
    --text-shadow-color: #000;
}

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

body {
    font-family: 'Bangers', cursive, sans-serif;
    background: linear-gradient(180deg, var(--bg-sky-top) 0%, var(--bg-sky-bottom) 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background-image: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.3) 100%);
}

.select-title {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    color: #ffca28;
    text-shadow: 4px 4px 0 #d84315, 8px 8px 0 #000;
    letter-spacing: 3px;
    z-index: 10;
}

.wheel-container {
    position: absolute;
    left: -800px;
    top: 50%;
    transform: translateY(-50%);
    width: 1200px;
    height: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-indicator {
    position: absolute;
    left: 1350px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.selected-name {
    background: linear-gradient(90deg, #4dd0e1, #00bcd4, #00838f);
    padding: 10px 50px;
    border-radius: 40px;
    font-size: 2.5rem;
    border: 4px solid white;
    box-shadow: 4px 4px 15px rgba(0,0,0,0.6);
    text-shadow: 2px 2px 3px #000;
    white-space: nowrap;
}

.selection-hint {
    margin-top: 10px;
    font-size: 1.2rem;
    color: #ffea00;
    text-shadow: 2px 2px 0 #000;
    animation: pulseHint 1.5s infinite;
    font-family: sans-serif;
    font-weight: bold;
}

@keyframes pulseHint {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.6; transform: scale(1); }
}

.wheel {
    position: relative;
    width: 1200px;
    height: 1200px;
    border-radius: 50%;
    border: 20px solid var(--wheel-color);
    box-shadow: 0 0 0 6px var(--wheel-border), inset 0 0 30px rgba(0,0,0,0.7);
    background: rgba(123, 31, 162, 0.4);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10;
}

.character-slot {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: #333;
    border: 4px solid #fff;
    top: 50%;
    left: 50%;
    margin-top: -45px;
    margin-left: -45px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: sans-serif;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 900;
    overflow: hidden;
    transition: filter 0.3s, z-index 0.3s;
    text-shadow: 1px 1px 2px #000;
}

.character-slot.active {
    z-index: 15;
    /* Active scaling is handled in JS via inline transform to avoid conflicting with rotation */
}

/* Static ring at 3 o'clock position (right side of the wheel) */
.selection-ring {
    position: absolute;
    top: 50%;
    left: 1200px;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 6px solid var(--player1-cyan);
    box-shadow: 0 0 20px var(--player1-cyan), inset 0 0 20px var(--player1-cyan);
    z-index: 20;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.selection-ring:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 30px #fff, inset 0 0 30px var(--player1-cyan);
}
.selection-ring:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Decorative waves around the selection ring */
.selection-wave {
    position: absolute;
    top: 50%;
    left: 1200px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(0, 229, 255, 0.5);
    z-index: 19;
    pointer-events: none;
}
.inner-wave { width: 140px; height: 140px; }
.outer-wave { width: 160px; height: 160px; border-color: rgba(0, 229, 255, 0.2); }


.arrow {
    position: absolute;
    right: -60px; 
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s, text-shadow 0.2s;
    z-index: 15;
    user-select: none;
}

.arrow:hover {
    color: white;
    transform: scale(1.2);
    text-shadow: 0 0 10px white;
}

.up-arrow {
    top: 35%;
}

.down-arrow {
    bottom: 35%;
}

/* === Customization Panel === */

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

.customization-panel {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 450px;
    height: 80vh;
    background: rgba(0, 0, 0, 0.6);
    border: 4px solid var(--player1-cyan);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 50;
    transition: opacity 0.4s, transform 0.4s;
    backdrop-filter: blur(5px);
}

.customization-panel.hidden {
    transform: translateY(-50%) translateX(50px);
}

.custom-header {
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.custom-header h2 {
    font-size: 3.5rem;
    color: #ffca28;
    text-shadow: 3px 3px 0 #d84315;
    letter-spacing: 2px;
}

.level-badge {
    font-size: 1.5rem;
    color: #fff;
    background: #e91e63;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 15px;
    border: 2px solid #fff;
    margin-top: 10px;
}

.custom-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.custom-body::-webkit-scrollbar {
    width: 8px;
}
.custom-body::-webkit-scrollbar-thumb {
    background: var(--player1-cyan);
    border-radius: 4px;
}

.stats-section, .skills-section {
    margin-bottom: 30px;
}

.stats-section h3, .skills-section h3 {
    font-size: 2rem;
    color: #00e5ff;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    font-size: 1.5rem;
    width: 100px;
}

.stat-controls {
    display: flex;
    align-items: center;
}

.stat-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(180deg, #ffca28, #f57f17);
    color: #000;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}
.stat-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.stat-value {
    width: 40px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 10px;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-slot {
    background: linear-gradient(90deg, #283593, #3f51b5);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #fff;
    font-size: 1.2rem;
    text-align: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    cursor: pointer;
}
.skill-slot.empty {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
}
.skill-slot:hover {
    filter: brightness(1.2);
}

.password-prefix-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.password-prefix-section label {
    font-size: 1.2rem;
    font-family: 'Bangers', cursive, sans-serif;
    color: #ffca28;
    text-shadow: 1px 1px 0 #000;
}

#pw-prefix {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #00e5ff;
    border-radius: 5px;
    color: white;
    font-size: 1.2rem;
    font-family: monospace;
    text-align: center;
    width: 100px;
    padding: 5px;
    outline: none;
}
#pw-prefix:focus {
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
}

.custom-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.action-btn {
    font-family: 'Bangers', cursive, sans-serif;
    font-size: 1.5rem;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

.action-btn:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.back-btn {
    background: linear-gradient(180deg, #e53935, #c62828);
}

.generate-btn {
    background: linear-gradient(180deg, #43a047, #2e7d32);
}

/* === Skill Selection Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(180deg, #311b92, #512da8);
    width: 600px;
    height: 80vh;
    border-radius: 15px;
    border: 4px solid #ffca28;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(255,202,40,0.2);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-header h3 {
    font-size: 2.5rem;
    color: #00e5ff;
    text-shadow: 2px 2px 0 #000;
}

.close-btn {
    background: #e53935;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-family: 'Bangers', sans-serif;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}
.close-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.skill-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px;
    font-family: 'Bangers', sans-serif;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
}
.tab-btn.active {
    background: #00e5ff;
    color: #000;
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0,229,255,0.5);
}

.modal-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.skills-grid {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 10px;
}

.skills-grid::-webkit-scrollbar {
    width: 8px;
}
.skills-grid::-webkit-scrollbar-thumb {
    background: #ffca28;
    border-radius: 4px;
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}
.skill-item:hover {
    border-color: #00e5ff;
    background: rgba(0,229,255,0.1);
    transform: translateX(5px);
}
.skill-item.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
}

.skill-info {
    display: flex;
    flex-direction: column;
}
.skill-name {
    font-size: 1.5rem;
    color: white;
    text-shadow: 1px 1px 0 #000;
}
.skill-type {
    font-size: 1rem;
    color: #aaa;
    font-family: sans-serif;
}

.skill-slots-cost {
    display: flex;
    gap: 3px;
}
.slot-indicator {
    width: 15px;
    height: 15px;
    background: #ffea00;
    border: 1px solid #000;
    border-radius: 3px;
    box-shadow: 1px 1px 0 #000;
}

.modal-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: center;
}

/* === Password Output === */
#password-output-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00e5ff;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0,229,255,0.3);
}

#password-output-section h4 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    color: #ffca28;
    text-shadow: 1px 1px 0 #000;
}

.password-box {
    font-family: monospace;
    font-size: 1.5rem;
    color: #fff;
    letter-spacing: 2px;
    word-break: break-all;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 5px;
    user-select: all;
    border: 1px dashed rgba(255,255,255,0.5);
}

/* === Footer Notice === */
.footer-notice {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-family: sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    z-index: 100;
}

.footer-notice a {
    color: #00e5ff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

.footer-notice a:hover {
    color: #ffea00;
    text-decoration: underline;
}
