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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #478ef1, #857575, #b1cfff);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.phone-frame {
    position: relative;
}

.phone-body {
    width: 375px;
    height: 812px;
    background: #000000;
    border-radius: 60px;
    padding: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 4px solid #374151;
}

.screen {
    width: 100%;
    height: 100%;
    background: #000000;
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.dynamic-island {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 128px;
    height: 32px;
    background: #000000;
    border-radius: 16px;
    z-index: 10;
    border: 1px solid #374151;
}

.calculator-app {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 64px 24px 32px 24px;
}

.history-section {
    margin-bottom: 16px;
    max-height: 96px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-title {
    color: #9ca3af;
    font-size: 14px;
}

.clear-history-btn {
    color: #9ca3af;
    font-size: 12px;
    background: none;
    border: none;
    cursor: pointer;
}

.clear-history-btn:hover {
    color: #6b7280;
}

.history-list {
    color: #6b7280;
    font-size: 14px;
}

.history-item {
    margin-bottom: 4px;
}

.display-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 24px;
}

.equation-display {
    color: #6b7280;
    text-align: right;
    font-size: 18px;
    font-weight: 300;
    margin-bottom: 8px;
    min-height: 24px;
}

.main-display {
    color: #000000;
    text-align: right;
    font-size: 4.5rem;
    font-weight: 100;
    letter-spacing: -0.025em;
    line-height: 1;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 75px);
    grid-template-rows: repeat(5, 75px);
    gap: 12px;
    justify-content: center;
    align-content: center;
    width: 100%;
    max-width: 327px;
    margin: 0 auto;
}

.btn {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.btn:active {
    transform: scale(0.95);
}

.btn-function {
    background: #9ca3af;
    color: #000000;
    font-size: 20px;
    font-weight: 400;
}

.btn-function:hover {
    background: #6b7280;
}

.btn-number {
    background: #374151;
    color: #ffffff;
}

.btn-number:hover {
    background: #4b5563;
}

.btn-operation {
    background: #f97316;
    color: #ffffff;
}

.btn-operation:hover {
    background: #fb923c;
}

.btn-zero {
    width: 162px;
    grid-column: span 2;
    border-radius: 37.5px;
    justify-content: flex-start;
    padding-left: 32px;
}

.side-button {
    position: absolute;
    background: #6b7280;
}

.side-button-1 {
    left: -8px;
    top: 120px;
    width: 4px;
    height: 32px;
    border-radius: 2px 0 0 2px;
}

.side-button-2 {
    left: -8px;
    top: 160px;
    width: 4px;
    height: 48px;
    border-radius: 2px 0 0 2px;
}

.side-button-3 {
    left: -8px;
    top: 180px;
    width: 4px;
    height: 48px;
    border-radius: 2px 0 0 2px;
}

.side-button-4 {
    right: -8px;
    top: 140px;
    width: 4px;
    height: 64px;
    border-radius: 0 2px 2px 0;
}

.credit-text {
    color: #000000;
    font-size: 25px;
    text-align: center;
    margin-top: 16px;
    user-select: none;
}

/* Responsive Design */
@media (max-width: 480px) {
    .phone-body {
        width: 300px;
        height: 650px;
    }
    
    .button-grid {
        grid-template-columns: repeat(4, 55px);
        grid-template-rows: repeat(5, 55px);
        gap: 8px;
        max-width: 247px;
    }
    
    .btn {
        width: 55px;
        height: 55px;
        font-size: 18px;
    }
    
    .btn-zero {
        width: 118px;
        padding-left: 20px;
        border-radius: 27.5px;
    }
    
    .main-display {
        font-size: 3.5rem;
    }
}
