:root {
    --primary-gold: #d4af37;
    --primary-red: #c30010;
    --glass-bg: rgba(0, 0, 0, 0.85);
    --glass-border: 1px solid rgba(212, 175, 55, 0.4);
    --text-color: #ffffff;
    --success-green: #10b981;
    --warn-orange: #f59e0b;
}

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

body, html {
    width: 100%; 
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000; 
    color: var(--text-color);
    user-select: none; 
    -webkit-user-select: none;
    overflow-x: hidden;
}

.sub-screen { 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 20px; 
    background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(20px); 
    overflow-y: auto; 
    position: relative;
}

.sub-screen::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(8px) brightness(0.6);
    z-index: -1;
}

.back-btn { 
    align-self: flex-start; 
    background: none; 
    border: none; 
    color: white; 
    cursor: pointer; 
    font-size: 0.9rem; 
    margin-bottom: 15px; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    opacity: 0.8; 
    text-decoration: none;
}

.back-btn:hover { 
    opacity: 1; 
    color: var(--primary-gold); 
}

.roulette-layout-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    gap: 30px;
    align-items: center;
}

@media (min-width: 900px) {
    .roulette-layout-wrapper {
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 40px;
        width: 100%; 
        max-width: 1100px; 
        align-items: start;
    }
    .col-controls { order: 1; }
    .col-wheel { 
        order: 2; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        position: sticky; 
        top: 20px; 
    }
    .wheel-container { 
        width: 450px !important; 
        height: 450px !important; 
    }
}

@media (max-width: 899px) {
    .roulette-layout-wrapper { 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        width: 100%; 
        max-width: 500px; 
    }
    .col-controls, .col-wheel { 
        width: 100%; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
    }
}

.wheel-container { 
    position: relative; 
    width: 310px; 
    height: 310px; 
    margin: 10px 0; 
    flex-shrink: 0; 
}

@media (min-width: 768px) {
    .wheel-container {
        width: 400px;
        height: 400px;
    }
}

.wheel { 
    width: 100%; 
    height: 100%; 
    border-radius: 50%; 
    border: 6px solid var(--primary-gold); 
    box-shadow: 0 0 25px rgba(0,0,0,0.8); 
    position: relative; 
    overflow: hidden; 
    transform: rotate(0deg);
    background: conic-gradient(#333 0deg 360deg);
}

.pointer { 
    position: absolute; 
    top: 50%; 
    right: -25px;
    transform: translateY(-50%); 
    width: 0; 
    height: 0; 
    border-top: 20px solid transparent; 
    border-bottom: 20px solid transparent; 
    border-right: 35px solid var(--primary-red); 
    z-index: 10; 
    filter: drop-shadow(-2px 2px 2px rgba(0,0,0,0.5)); 
}

@media (max-width: 768px) {
    .pointer {
        right: -15px;
        border-top: 15px solid transparent;
        border-bottom: 15px solid transparent;
        border-right: 25px solid var(--primary-red);
    }
}

.wheel-line {
    position: absolute;
    top: 50%; 
    left: 50%;
    width: 50%; 
    height: 2px; 
    background-color: rgba(255, 255, 255, 0.8); 
    transform-origin: 0% 50%; 
    z-index: 1; 
    pointer-events: none;
}

.wheel-text {
    position: absolute;
    top: 50%; 
    left: 50%; 
    width: 50%; 
    height: 60px; 
    margin-top: -30px; 
    transform-origin: 0% 50%;
    display: flex; 
    align-items: center; 
    justify-content: flex-start; 
    padding-left: 80px; 
    padding-right: 5px;
    box-sizing: border-box;
    color: white; 
    font-weight: bold; 
    text-shadow: 1px 1px 3px black;
    white-space: nowrap; /* IMPEDE QUEBRA DE LINHA */
    overflow: hidden; 
    text-overflow: ellipsis; /* ADICIONA "..." SE TEXTO FOR MUITO LONGO */
    pointer-events: none; 
    text-transform: uppercase;
    z-index: 2; 
    transition: opacity 0.5s ease, visibility 0.5s;
}

.wheel-text.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}

.wheel-text:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.wheel-spinning {
    animation: none;
}

.wheel-spinning::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(255, 255, 255, 0.05) 70%);
    border-radius: 50%;
    animation: glowSpin 0.5s linear infinite;
}

@keyframes glowSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.roulette-controls { 
    width: 100%; 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 12px; 
    padding: 15px; 
    margin-top: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    box-sizing: border-box; 
}

.control-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    width: 100%; 
}

.full-width { width: 100%; }

input[type=range] { 
    width: 100%; 
    -webkit-appearance: none; 
    background: transparent; 
}

input[type=range]::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    height: 20px; 
    width: 20px; 
    border-radius: 50%; 
    background: var(--primary-gold); 
    cursor: pointer; 
    margin-top: -8px; 
}

input[type=range]::-webkit-slider-runnable-track { 
    width: 100%; 
    height: 4px; 
    cursor: pointer; 
    background: #444; 
    border-radius: 2px; 
}

textarea { 
    width: 100%; 
    height: 120px; 
    background: rgba(0,0,0,0.4); 
    border: 1px solid #444; 
    color: white; 
    border-radius: 8px; 
    padding: 10px; 
    font-family: monospace; 
    box-sizing: border-box; 
    resize: vertical; 
}

.result-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.98); 
    z-index: 50; 
    display: none; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
    box-sizing: border-box; 
    animation: fadeIn 0.3s; 
}

@keyframes fadeIn { 
    from {opacity:0} 
    to {opacity:1} 
}

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

.reveal-card { 
    background: linear-gradient(135deg, var(--primary-gold), #8a6e1c); 
    color: black; 
    padding: 40px; 
    border-radius: 15px; 
    text-align: center; 
    font-weight: bold; 
    font-size: clamp(1.2rem, 3vw, 1.5rem); 
    cursor: pointer; 
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4); 
    animation: pulse 1.5s infinite; 
    border: 2px solid white; 
    text-transform: uppercase; 
    max-width: 90%;
}

.winner-text { 
    font-size: clamp(1.8rem, 4vw, 2.5rem); 
    color: var(--primary-gold); 
    text-align: center; 
    margin: 20px 0; 
    font-weight: bold; 
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5); 
}

.tag-selector { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tag-btn { 
    padding: 10px 20px; 
    border-radius: 50px; 
    border: 2px solid transparent; 
    background: #333; 
    color: #888; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: clamp(0.8rem, 2vw, 1rem);
}

.tag-btn.selected-win { 
    background: var(--success-green); 
    color: white; 
    border-color: white; 
}

.tag-btn.selected-donor { 
    background: var(--warn-orange); 
    color: white; 
    border-color: white; 
}

.history-list { 
    width: 100%; 
    max-height: 200px; 
    overflow-y: auto; 
    margin-top: 10px; 
    background: rgba(0,0,0,0.3); 
    border-radius: 8px; 
    padding: 5px; 
}

.history-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 8px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    font-size: 0.85rem; 
}

.tag-badge { 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 0.7rem; 
    font-weight: bold; 
    margin-right: 5px; 
}

.bg-win { 
    background: var(--success-green); 
    color: black; 
}

.bg-donor { 
    background: var(--warn-orange); 
    color: black; 
}

.timer-display { 
    font-size: 4rem; 
    font-family: 'Courier New', monospace; 
    font-weight: bold; 
    color: var(--primary-gold); 
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5); 
    margin: 30px 0; 
}

.action-btn { 
    width: 100%; 
    max-width: 400px;
    background: var(--primary-red); 
    color: white; 
    border: none; 
    padding: 15px; 
    border-radius: 50px; 
    font-weight: bold; 
    font-size: clamp(1rem, 2vw, 1.1rem); 
    cursor: pointer; 
    box-shadow: 0 4px 10px rgba(195, 0, 16, 0.4); 
    margin-top: 10px; 
}

.action-btn:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

.small-btn { 
    padding: 10px 12px; 
    font-size: 0.8rem; 
    border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.2); 
    background: rgba(255,255,255,0.05); 
    color: white; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    transition: all 0.2s; 
}

.small-btn:hover { 
    background: rgba(255,255,255,0.15); 
    border-color: rgba(255,255,255,0.5); 
}

.small-btn:active { transform: scale(0.95); }

h2 {
    color: var(--primary-gold); 
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 1.8rem;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }