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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Roboto', sans-serif;
    background: radial-gradient(ellipse at 50% 30%, #1a1d2e 0%, #0f1419 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

main {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.device-body {
    background: linear-gradient(145deg, #16191f 0%, #1e2430 50%, #252b3a 100%);
    border-radius: 48px;
    padding: 24px 16px 28px 16px;
    width: 360px;
    max-width: 100%;
    box-shadow: 
        0 40px 80px rgba(0,0,0,0.6),
        0 2px 20px rgba(100,200,255,0.1),
        inset 0 1px 2px rgba(255,255,255,0.1);
    position: relative;
    border: 1px solid rgba(255,255,255,0.08);
}

.device-glow {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 120px;
    background: radial-gradient(ellipse, rgba(100,200,255,0.15) 0%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 8px;
}

.branding {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    font-size: 20px;
    color: #64c8ff;
    text-shadow: 0 0 10px rgba(100,200,255,0.5);
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #64c8ff 0%, #8dd5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.power-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a3142 0%, #3d4a63 100%);
    border: 2px solid rgba(100,200,255,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
}

.power-button:hover {
    border-color: rgba(100,200,255,0.6);
    box-shadow: 0 0 20px rgba(100,200,255,0.3);
}

.power-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 30px rgba(100,200,255,0.5);
}

.power-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #64c8ff 0%, #4a9fd5 100%);
    box-shadow: 0 0 8px rgba(100,200,255,0.6);
}

.display-module {
    margin-bottom: 20px;
}

.oled-display {
    background: linear-gradient(180deg, #0a0c10 0%, #12151a 100%);
    border-radius: 28px;
    padding: 16px;
    min-height: 140px;
    position: relative;
    box-shadow: 
        inset 0 4px 20px rgba(0,0,0,0.8),
        inset 0 1px 1px rgba(100,200,255,0.1),
        0 0 20px rgba(100,200,255,0.15);
    border: 2px solid #1a1f28;
    overflow: hidden;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 11px;
    opacity: 0.8;
}

.os-badge {
    color: #64c8ff;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(100,200,255,0.4);
}

.battery-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.battery-shell {
    width: 32px;
    height: 14px;
    border: 2px solid rgba(100,200,255,0.4);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    background: #0a0c10;
}

.battery-shell::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 8px;
    background: rgba(100,200,255,0.4);
    border-radius: 0 2px 2px 0;
}

.battery-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #6bcf7f 0%, #7fda89 100%);
    transition: width 0.5s ease, background 0.3s ease;
    border-radius: 2px;
}

.charging-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(100,200,255,0.4) 0%, transparent 70%);
    border-radius: 2px;
}

@keyframes chargingPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.battery-text {
    color: #64c8ff;
    font-size: 10px;
    font-weight: 600;
}

.charging-bolt {
    color: #64c8ff;
    font-size: 12px;
    display: none;
    animation: boltFlash 0.6s ease-in-out infinite;
}

@keyframes boltFlash {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.screen-dark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0a0c10 0%, #12151a 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.screen-dark.active {
    opacity: 1;
    pointer-events: all;
}

.update-screen,
.boot-screen,
.shutdown-screen,
.idle-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 5;
    padding: 20px;
}

.update-screen.active,
.boot-screen.active,
.shutdown-screen.active,
.idle-screen.active {
    opacity: 1;
}

.update-logo,
.boot-logo,
.shutdown-icon {
    font-size: 48px;
    color: #64c8ff;
    text-shadow: 0 0 20px rgba(100,200,255,0.6);
    margin-bottom: 16px;
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.update-title,
.boot-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.update-subtitle,
.boot-subtitle {
    font-size: 13px;
    color: #64c8ff;
    margin-bottom: 20px;
}

.update-version {
    font-size: 12px;
    color: #aafadc;
    margin-bottom: 16px;
    text-align: center;
}

.update-version span {
    display: block;
    margin: 2px 0;
}

.arrow {
    color: #64c8ff;
    margin: 4px 0;
}

.boot-progress,
.update-progress {
    width: 60%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #64c8ff 0%, #8dd5ff 100%);
    width: 0%;
    animation: progressLoad 2.8s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(100,200,255,0.5);
}

@keyframes progressLoad {
    0% { width: 0%; }
    100% { width: 100%; }
}

.boot-status,
.update-status {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-align: center;
}

.shutdown-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.shutdown-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

#idle-canvas {
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

.calculator-display {
    position: relative;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-top: 10px;
}

.calculator-display.active {
    opacity: 1;
    pointer-events: all;
}

.expression-line {
    font-size: 16px;
    color: rgba(100,200,255,0.6);
    text-align: right;
    margin-bottom: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    min-height: 20px;
}

.result-line {
    font-size: 42px;
    font-weight: 300;
    color: #fff;
    text-align: right;
    text-shadow: 0 0 20px rgba(100,200,255,0.3);
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: -1px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 0 4px;
}

.key {
    background: linear-gradient(145deg, #252b3a 0%, #1e2430 100%);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 18px;
    height: 62px;
    font-size: 22px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.key.function {
    background: linear-gradient(145deg, #3d4a63 0%, #2a3142 100%);
    color: #64c8ff;
}

.key.operator {
    background: linear-gradient(145deg, #3d7fcc 0%, #2563a8 100%);
    color: #fff;
    font-weight: 600;
}

.key.equals {
    background: linear-gradient(145deg, #64c8ff 0%, #4a9fd5 100%);
    color: #0a0c10;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(100,200,255,0.3);
}

.key.equals:active {
    box-shadow: 0 2px 12px rgba(100,200,255,0.4);
}

.key.wide {
    grid-column: span 2;
}

.key.special {
    background: linear-gradient(145deg, #2a5a4a 0%, #1e4336 100%);
    font-size: 14px;
    flex-direction: column;
    gap: 2px;
}

.key-icon {
    font-size: 18px;
}

.key-label {
    font-size: 11px;
    font-weight: 600;
}

.converter-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    background: linear-gradient(145deg, #1e2430 0%, #16191f 100%);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    border: 1px solid rgba(100,200,255,0.2);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.converter-modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #64c8ff;
    margin-bottom: 20px;
    text-align: center;
}

.converter-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.converter-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.converter-row label {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

.unit-select,
.convert-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(100,200,255,0.2);
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.unit-select:focus,
.convert-input:focus {
    border-color: #64c8ff;
    box-shadow: 0 0 12px rgba(100,200,255,0.2);
}

.convert-button {
    width: 100%;
    background: linear-gradient(145deg, #64c8ff 0%, #4a9fd5 100%);
    border: none;
    border-radius: 14px;
    padding: 14px;
    color: #0a0c10;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(100,200,255,0.3);
}

.convert-button:active {
    transform: scale(0.98);
}

.convert-result {
    margin-top: 16px;
    padding: 16px;
    background: rgba(100,200,255,0.1);
    border-radius: 12px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #64c8ff;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 400px) {
    .device-body {
        width: 100%;
        padding: 20px 12px 24px 12px;
        border-radius: 32px;
    }
    
    .key {
        height: 56px;
        font-size: 20px;
    }
    
    .result-line {
        font-size: 36px;
    }
}
