* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme (Default) */
    --bg-primary: #000000;
    --bg-secondary: #2d2d2d;
    --bg-display: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --operator-bg: #ff9500;
    --operator-hover: #ffad33;
    --button-bg: #3a3a3a;
    --button-hover: #4a4a4a;
    --shadow: rgba(0, 0, 0, 0.3);
}

body.light-theme {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-display: #f0f0f0;
    --text-primary: #2d2d2d;
    --text-secondary: #6d6d6d;
    --operator-bg: #ff9500;
    --operator-hover: #ffad33;
    --button-bg: #e0e0e0;
    --button-hover: #d0d0d0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.title {
    text-align: center;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.calculator-wrapper {
    display: flex;
    justify-content: center;
}

.calculator {
    background: var(--bg-secondary);
    border-radius: 30px;
    padding: 25px 20px 25px 20px;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 20px 60px var(--shadow);
    position: relative;
}

/* Neumorphic effect for light theme */
body.light-theme .calculator {
    box-shadow: 
        20px 20px 60px rgba(0, 0, 0, 0.1),
        -20px -20px 60px rgba(255, 255, 255, 0.8);
}

.microphone {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.display {
    background: var(--bg-display);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    box-shadow: inset 0 2px 10px var(--shadow);
}

.operation {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 10px;
    min-height: 24px;
    word-break: break-all;
    text-align: right;
}

.result {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 600;
    word-break: break-all;
    text-align: right;
    line-height: 1.2;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 20px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.95);
}

/* Utility and Number Buttons */
.btn.utility,
.btn.number {
    background: var(--button-bg);
    color: var(--text-primary);
    box-shadow: 
        0 4px 8px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.light-theme .btn.utility,
body.light-theme .btn.number {
    background: var(--button-bg);
    color: var(--text-primary);
    box-shadow: 
        8px 8px 16px rgba(0, 0, 0, 0.1),
        -8px -8px 16px rgba(255, 255, 255, 0.8);
}

.btn.utility:hover,
.btn.number:hover {
    background: var(--button-hover);
}

body.light-theme .btn.utility:active,
body.light-theme .btn.number:active {
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.1),
        inset -4px -4px 8px rgba(255, 255, 255, 0.8);
}

/* Operator Buttons */
.btn.operator {
    background: var(--operator-bg);
    color: var(--text-primary);
    box-shadow: 
        0 4px 8px rgba(255, 149, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn.operator:hover {
    background: var(--operator-hover);
}

.btn.operator:active {
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Zero Button - spans 2 columns */
.btn.zero {
    grid-column: span 2;
}

/* Equals Button */
.btn.equals {
    background: var(--operator-bg);
    color: var(--text-primary);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--button-bg);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px var(--shadow);
}

.theme-toggle:hover {
    background: var(--button-hover);
    transform: rotate(180deg);
}

/* Responsive Design */
@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .calculator {
        padding: 20px 15px;
        border-radius: 25px;
    }

    .result {
        font-size: 2rem;
    }

    .btn {
        padding: 18px;
        font-size: 1.2rem;
    }

    .buttons {
        gap: 10px;
    }
}
