/* LEGO Color Palette */
:root {
    --lego-red: #FF0000;
    --lego-yellow: #FFD700;
    --lego-blue: #0057B7;
    --lego-green: #00A651;
    --lego-black: #212121;
    --lego-gray: #F0F0F0;
}

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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background-color: var(--lego-gray);
    overflow-x: hidden;
}

.lego-world {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}

/* Floating LEGO Bricks Background */
.lego-bricks-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect x="10" y="10" width="80" height="80" rx="5" ry="5" fill="%23FF0000"/><circle cx="25" cy="25" r="4" fill="%23000000" opacity="0.2"/><circle cx="75" cy="25" r="4" fill="%23000000" opacity="0.2"/><circle cx="25" cy="75" r="4" fill="%23000000" opacity="0.2"/><circle cx="75" cy="75" r="4" fill="%23000000" opacity="0.2"/></svg>');
    background-size: 50px 50px;
    animation: floatBricks 100s linear infinite;
}

@keyframes floatBricks {
    0% { background-position: 0 0; }
    100% { background-position: 1000px 1000px; }
}

/* Calculator Container */
.lego-calculator {
    background: white;
    border: 8px solid var(--lego-black);
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.lego-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.lego-header h1 {
    color: var(--lego-red);
    font-size: 2rem;
    margin-bottom: 10px;
}

.lego-header h1 span {
    color: var(--lego-blue);
}

.lego-stud-row {
    height: 10px;
    background: repeating-linear-gradient(
        to right,
        var(--lego-black),
        var(--lego-black) 10px,
        transparent 10px,
        transparent 20px
    );
    opacity: 0.3;
}

/* Input Styles */
.input-section {
    margin-bottom: 30px;
}

.lego-input {
    margin-bottom: 25px;
}

.lego-input label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--lego-black);
    font-size: 1.1rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

input[type="range"] {

    width: 100%;
    height: 15px;
    background: var(--lego-gray);
    border-radius: 10px;
    outline: none;
    flex: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 25px;
    height: 25px;
    background: var(--lego-red);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

#age-value {
    background: var(--lego-yellow);
    color: var(--lego-black);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

/* Clumsiness Buttons */
.lego-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.lego-buttons button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--lego-gray);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.lego-buttons button.active {
    background: var(--lego-green);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    margin-top: 10px;
}

.toggle-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;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--lego-blue);
}

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

/* LEGO Button */
.lego-button {
    width: 100%;
    padding: 15px;
    background: var(--lego-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s;
    margin-top: 20px;
}

.lego-button:hover {
    transform: translateY(-3px);
}

.lego-button:active {
    transform: translateY(1px);
}

.lego-studs {
    display: inline-block;
    margin: 0 10px;
    letter-spacing: 5px;
    opacity: 0.5;
}

/* Results Section */
.results {
    text-align: center;
    margin-top: 30px;
    transition: all 0.5s;
}

.results.hidden {
    opacity: 0;
    transform: translateY(20px);
    height: 0;
    overflow: hidden;
    margin: 0;
}

.lego-brick {
    width: 80px;
    height: 40px;
    background: var(--lego-red);
    margin: 0 auto;
    position: relative;
    border-radius: 5px;
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2);
}

.lego-brick:before {
    content: "";
    position: absolute;
    top: -5px;
    left: 10px;
    right: 10px;
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50% 50% 0 0;
}

.foot {
    width: 60px;
    height: 80px;
    background: #333;
    margin: 20px auto;
    border-radius: 50% 50% 0 0;
    position: relative;
    display: none;
}

.result-text {
    margin-top: 20px;
}

.big-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--lego-red);
    margin: 10px 0;
}

.pain-level {
    font-size: 1.5rem;
    margin-top: 20px;
}

.fire {
    display: inline-block;
    animation: burn 0.5s infinite alternate;
}

.comment {
    display: block;
    font-size: 1rem;
    color: var(--lego-black);
    font-style: italic;
    margin-top: 5px;
}

@keyframes burn {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* Animations */
@keyframes stomp {
    0% { transform: translateY(-50px); }
    50% { transform: translateY(0) scale(1.1); }
    100% { transform: translateY(-50px); }
}

@keyframes crumble {
    0% { transform: scale(1); }
    50% { transform: scale(0.8) rotate(10deg); }
    100% { transform: scale(0) rotate(45deg); }
}

/* Responsive Design */
@media (max-width: 500px) {
    .lego-calculator {
        padding: 20px;
    }
    
    .lego-header h1 {
        font-size: 1.5rem;
    }
    
    .lego-buttons {
        flex-direction: column;
    }
}