* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, Avenir, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    padding: 1rem;
    color: white;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-button {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateX(-2px);
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    flex: 1;
}

.calculator {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    margin-bottom: 2rem;
}

.calculator-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.model {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.125rem;
}

.version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.display-container {
    background: linear-gradient(145deg, #1f2937, #111827);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.display-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    font-size: 0.75rem;
}

.display-indicators,
.display-status {
    display: flex;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.display {
    text-align: right;
    margin-bottom: 1rem;
}

.display-value {
    font-size: 1.75rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #00ff88;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    word-break: break-all;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
}

.display-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.display-functions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.shift-indicator {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.7rem;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.shift-indicator.hidden {
    display: none;
}

.display-controls {
    display: flex;
    gap: 0.75rem;
}

.buttons-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 0.875rem 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 3.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.3s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-number {
    background: linear-gradient(145deg, #374151, #1f2937);
    font-size: 1.1rem;
    font-weight: bold;
    color: #e5e7eb;
}

.btn-number:hover {
    background: linear-gradient(145deg, #4b5563, #374151);
    color: white;
}

.btn-operator {
    background: linear-gradient(145deg, #ea580c, #dc2626);
    color: white;
    font-size: 1rem;
    font-weight: bold;
}

.btn-operator:hover {
    background: linear-gradient(145deg, #f97316, #ef4444);
    box-shadow: 0 8px 25px rgba(234, 88, 12, 0.4);
}

.btn-function {
    background: linear-gradient(145deg, #4b5563, #374151);
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
}

.btn-function:hover {
    background: linear-gradient(145deg, #6b7280, #4b5563);
}

.btn-equals {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
}

.btn-equals:hover {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.btn-clear {
    background: linear-gradient(145deg, #ef4444, #dc2626);
    color: white;
    font-size: 0.875rem;
    grid-column: span 2;
    font-weight: bold;
}

.btn-clear:hover {
    background: linear-gradient(145deg, #f87171, #ef4444);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-clear-all {
    background: linear-gradient(145deg, #16a34a, #15803d);
    color: white;
    font-size: 0.875rem;
    grid-column: span 3;
    font-weight: bold;
}

.btn-clear-all:hover {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
}

.btn-off {
    background: linear-gradient(145deg, #dc2626, #b91c1c);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.btn-off:hover {
    background: linear-gradient(145deg, #ef4444, #dc2626);
}

.shift-btn {
    background: linear-gradient(145deg, #4b5563, #374151);
    color: #fbbf24;
    font-weight: bold;
}

.shift-btn.active {
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.secondary {
    display: none;
    font-size: 0.65rem;
    color: #fbbf24;
    font-weight: 500;
}

.shift-mode .secondary {
    display: block;
}

.shift-mode .primary {
    display: none;
}

.off-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.off-overlay.active {
    display: flex;
}

.off-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem;
}

.off-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.off-message p {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.off-message small {
    font-size: 0.875rem;
    opacity: 0.8;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.25rem;
}

.instruction-grid {
    display: grid;
    gap: 0.75rem;
}

.instruction-item {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.instruction-item strong {
    color: #fbbf24;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .calculator {
        padding: 1.5rem;
        border-radius: 1rem;
    }
    
    .btn {
        padding: 0.75rem 0.25rem;
        font-size: 0.75rem;
        min-height: 3rem;
    }
    
    .btn-number {
        font-size: 1rem;
    }
    
    .display-value {
        font-size: 1.5rem;
    }
    
    .buttons-grid {
        gap: 0.375rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }
    
    .calculator {
        padding: 1rem;
    }
    
    .btn {
        min-height: 2.75rem;
        font-size: 0.7rem;
    }
    
    .display-value {
        font-size: 1.25rem;
    }
}