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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #444444 0%, #272727 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
}

.calculator {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border-radius: 18px;
    padding: 20px 15px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.8);
    width: 100%;
    max-width: 360px;
    position: relative;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Realistic 3D border effect */
.calculator::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(145deg, #555, #222);
    border-radius: 20px;
    z-index: -1;
}

.calculator::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(145deg, #1a1a1a, #4a4a4a);
    border-radius: 22px;
    z-index: -2;
}

.brand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 5px;
}

.brand {
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.model {
    color: #aaa;
    font-size: 9px;
    margin-top: 2px;
}

.solar-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
    height: 18px;
    width: 70px;
    border-radius: 3px;
    border: 1px solid #333;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.solar-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: solarShine 3s infinite;
}

@keyframes solarShine {

    0%,
    100% {
        left: -100%;
    }

    50% {
        left: 100%;
    }
}

.display-container {
    background: linear-gradient(145deg, #2d4a2d, #1f3a1f);
    border: 3px solid #1a1a1a;
    border-radius: 8px;
    padding: 12px 10px;
    margin-bottom: 12px;
    box-shadow:
        inset 0 3px 8px rgba(0, 0, 0, 0.6),
        0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
}

.shift-alpha {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.shift-indicator,
.alpha-indicator {
    background: rgba(0, 0, 0, 0.3);
    color: #666;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    border: 1px solid rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.shift-indicator.active {
    background: #ff6600;
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 102, 0, 0.6);
    animation: pulse 0.3s ease;
}

.alpha-indicator.active {
    background: #ff0000;
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
    animation: pulse 0.3s ease;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.display {
    background: #0a1a0a;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 8px;
    border-radius: 4px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.3), transparent);
}

.second-line {
    font-size: 11px;
    color: #00cc00;
    min-height: 16px;
    opacity: 0.8;
}

.main-line {
    font-size: 20px;
    font-weight: bold;
    color: #00ff00;
    text-align: right;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.status-indicators {
    display: flex;
    justify-content: space-between;
    color: #00aa00;
    font-size: 9px;
    margin-top: 4px;
    font-weight: bold;
}

.mode-indicators {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
    padding: 0 2px;
}

.mode-indicator {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    color: #666;
    padding: 4px 0;
    border-radius: 4px;
    font-size: 9px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.5);
    font-weight: bold;
    transition: all 0.2s ease;
}

.mode-indicator.active {
    background: #00ff00;
    color: #000;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.button-section,
.main-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.btn {
    height: 38px;
    border: none;
    border-radius: 5px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    line-height: 1.2;
    transition: all 0.1s ease;
    box-shadow:
        0 3px 0 rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
    user-select: none;
}

.btn:active {
    transform: translateY(3px);
    box-shadow:
        0 0 0 rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
    animation: btnPress 0.1s ease;
}

@keyframes btnPress {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(4px);
    }

    100% {
        transform: translateY(3px);
    }
}

.btn-function {
    background: linear-gradient(145deg, #5a5a5a, #4a4a4a);
    color: #fff;
    border-bottom: 2px solid #2a2a2a;
}

.btn-function:hover {
    background: linear-gradient(145deg, #6a6a6a, #5a5a5a);
}

.btn-number {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    color: #fff;
    font-size: 16px;
    border-bottom: 2px solid #1a1a1a;
}

.btn-number:hover {
    background: linear-gradient(145deg, #5a5a5a, #4a4a4a);
}

.btn-operator {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    color: #fff;
    border-bottom: 2px solid #0a0a0a;
}

.btn-operator:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.btn-clear {
    background: linear-gradient(145deg, #8a5a5a, #7a4a4a);
    color: #fff;
    border-bottom: 2px solid #5a2a2a;
}

.btn-clear:hover {
    background: linear-gradient(145deg, #9a6a6a, #8a5a5a);
}

.btn-equals {
    background: linear-gradient(145deg, #5a8a5a, #4a7a4a);
    color: #fff;
    font-size: 18px;
    border-bottom: 2px solid #2a5a2a;
}

.btn-equals:hover {
    background: linear-gradient(145deg, #6a9a6a, #5a8a5a);
}

.second-func {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 7px;
    color: #ff6600;
    font-weight: normal;
}

.main-func {
    color: #fff;
    font-size: 9px;
}

.bottom-func {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 7px;
    color: #ffff00;
    font-weight: normal;
}

/* Mobile optimization */
@media (max-width: 380px) {
    .calculator {
        max-width: 100%;
        padding: 15px 12px;
    }

    .btn {
        height: 36px;
        font-size: 9px;
    }

    .btn-number {
        font-size: 15px;
    }

    .main-line {
        font-size: 18px;
    }
}

@media (max-height: 700px) {
    .calculator {
        padding: 12px 10px;
    }

    .btn {
        height: 34px;
    }

    .display {
        min-height: 50px;
    }
}

/* Smooth transitions for better performance */
.calculator * {
    will-change: transform;
}