* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f2f2f7;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Área de regras (esquerda) – invisível */
#resultado {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100%;
    overflow-y: auto;
    padding: 16px 10px;
    z-index: 5;
}

/* Regras individuais – compactas */
.regra {
    background: #ffffffcc;
    backdrop-filter: blur(8px);
    border-left: 4px solid #007aff;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    font-size: 14px;
    transition: all 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    animation: ruleAppear 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1) forwards;
}

@keyframes ruleAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.regra.local {
    border-left-color: #34c759;
    background: #e9f9efcc;
}

.regra.server {
    border-left-color: #007aff;
    background: #e9f2ffcc;
}

.regra strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.3;
}

.regra small {
    font-size: 11px;
    color: #8e8e93;
    display: block;
    margin-top: 2px;
}

/* Responsivo */
@media (max-width: 640px) {
    #resultado {
        width: 220px;
        padding: 12px 8px;
    }
    .regra {
        padding: 4px 8px;
        margin-bottom: 4px;
    }
}

/* Container do menu circular (centralizado fixo) */
.center-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    z-index: 20;
}

/* Botão central */
.central-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #007aff;
    border: none;
    font-size: 40px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    z-index: 25;
}

.central-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
}

/* Elementos animados – escala a partir do centro */
.animated-element {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1),
                transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1),
                visibility 0s linear 0.25s;
    transform: scale(0.8);
    transform-origin: center;
}

.animated-element.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition-delay: 0s;
}

/* Wrapper dos selects */
.selects-wrapper {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 240px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 0.5px solid rgba(0, 0, 0, 0.05);
    z-index: 15;
}

.selects-wrapper.visible {
    transform: translateX(-50%) scale(1);
}

/* Selects estilizados */
select {
    width: 100%;                     /* ocupa toda largura do container */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 32px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: #1c1c1e;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    border-right: 2px solid rgba(0, 122, 255, 0.2); /* borda direita sutil */
}

select:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* Botões flutuantes (laterais) */
.floating-buttons {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    z-index: 15;
    pointer-events: none;
}

.action-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    border: none;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    color: #007aff;
    backdrop-filter: blur(4px);
    pointer-events: auto;
    transform-origin: center;
}

.action-btn.visible {
    transform: translateY(-50%) scale(1);
}

.action-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.left-btn {
    left: -70px;
}

.right-btn {
    right: -70px;
}

/* Input de nova regra */
.input-wrapper {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    margin-top: 20px;
    width: 260px;
    z-index: 15;
}

.input-wrapper.visible {
    transform: translateX(-50%) scale(1);
}

#novaRegraLcl {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 32px;
    padding: 12px 20px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    text-align: left;
}

#novaRegraLcl:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* Botão de limpar regras */
.clear-btn {
    position: absolute;
    top: calc(100% + 80px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(255, 59, 48, 0.9);
    backdrop-filter: blur(12px);
    border: none;
    border-radius: 40px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: 0.2s;
    z-index: 20;
    transform-origin: center;
}

.clear-btn.visible {
    transform: translateX(-50%) scale(1);
}

.clear-btn:active {
    transform: translateX(-50%) scale(0.96);
    background: #ff3b30;
}

/* Ajustes responsivos */
@media (max-width: 480px) {
    .left-btn {
        left: -55px;
    }
    .right-btn {
        right: -55px;
    }
    .selects-wrapper {
        min-width: 200px;
        padding: 12px 16px;
    }
    .input-wrapper {
        width: 220px;
    }
    .clear-btn {
        top: calc(100% + 70px);
    }
}