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

body {
    font-family: sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 200px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

.header, .footer-section {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header a, .footer-section a {
    color: #4CAF50;
    text-decoration: none;
    margin: 0 10px;
    display: inline-block;
}

.header a:hover, .footer-section a:hover {
    text-decoration: underline;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 15px;
    align-items: start;
}

.attack-side, .defense-side {
    width: 100%;
}

.section {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section + .section {
    margin-top: 10px;
}

.section h2 {
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #4CAF50;
}

.section h3 {
    margin: 8px 0;
    color: #2E7D32;
}

.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}

.input-group label {
    width: 65%;
    padding-right: 10px;
    font-size: 0.95em;
}

.input-group input[type="number"],
.input-group select {
    width: 35%;
    min-width: 100px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.input-group input[type="range"] {
    width: 50%;
    float: right;
}

.input-group button{
    float: center;
}

.calculation-wrapper {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.calculation-container {
    background: #fff;
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 800px;
    width: 90%;
    pointer-events: auto;
    text-align: center;
}

.calculate-button {
    padding: 12px 40px;
    font-size: 18px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.calculate-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#result {
    font-size: 1.2em;
    margin-top: 20px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 4px;
}

.footer-section {
    margin-bottom: 180px;
}

input[type="range"] {
    width: 100%;
    height: 30px;
    margin-bottom: 4px;
}

.input-group button {
    width: 15%;
    height: 35px;
    font-size: 15px;
}

.buff-group input[type="range"] {
    width: 50%;
    float: right;
}

.input-group span {
    float: center;
    font-size: 1.2em;
    margin: 5px;
}

.buff-toggles {
    margin: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    margin: 4px 0;
    gap: 6px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

.slider.round {
    border-radius: 16px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(12px);
}

.toggle-label {
    flex-grow: 1;
    font-size: 0.7em;
    color: #555;
}

.toggle-state {
    font-weight: bold;
    color: #666;
    min-width: 40px;
}

.base-attack {
    margin-top: 6px;
    padding: 4px;
    background-color: #f8f8f8;
    border-radius: 4px;
}

.base-attack h3 {
    margin: 0;
}

@media (max-width: 767px) {
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    h2 {
        background-color: #f8f8f8;
        border-bottom: 2px solid #000;
    }

    .container {
        padding-bottom: 80px;
    }

    .attack-input h2, .def-input h2 {
        margin-bottom: 8px;
        padding-bottom: 4px;
        border-bottom: 2px solid #4CAF50;
    }

    .attack-side::-webkit-scrollbar-track,
    .defense-side::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .attack-side::-webkit-scrollbar-thumb,
    .defense-side::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

    .section {
        padding: 8px;
        margin-bottom: 6px;
        background: #fff;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .section h3 {
        margin: 4px 0;
        background: #fff;
    }

    .input-group {
        margin-bottom: 4px;
        min-height: 30px;
    }

    .input-group label {
        width: 65%;
        font-size: 0.85em;
        padding-right: 6px;
        line-height: 1.2;
    }

    .input-group input[type="number"],
    .input-group select {
        width: 35%;
        min-width: 80px;
        padding: 4px;
        height: 28px;
    }

    .calculation-wrapper {
        bottom: 8px;
    }

    .calculation-container {
        padding: 10px;
        width: 95%;
    }

    .calculate-button {
        padding: 8px 24px;
        font-size: 15px;
    }

    .footer-section {
        margin-bottom: 80px;
    }

    .input-group button {
        width: 35%;
        height: 50px;
        font-size: 18px;
    }

    .buff-group input[type="range"] {
        width: 100%;
        float: right;
    }

    .input-group span {
        float: center;
        font-size: 18px;
        margin: 8px;
    }

    .switch {
        width: 40px;
        height: 22px;
    }

    .slider:before {
        height: 16px;
        width: 16px;
    }

    input:checked + .slider:before {
        transform: translateX(18px);
    }

    .toggle-label {
        font-size: 0.85em;
    }
}
