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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
}

.main-content {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

.calculator-wrapper {
    flex: 0 0 auto;
}

.calculator {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.display {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
}

.display-history {
    color: #888;
    font-size: 14px;
    margin-bottom: 10px;
    min-height: 20px;
    word-break: break-all;
    text-align: right;
    width: 100%;
}

.display-input {
    color: #fff;
    font-size: 48px;
    font-weight: 300;
    word-break: break-all;
    text-align: right;
    width: 100%;
    line-height: 1.2;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 20px;
    background: #f0f0f0;
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn-number:hover {
    background: #e8e8e8;
}

.btn-operator {
    background: #667eea;
    color: #fff;
}

.btn-operator:hover {
    background: #5568d3;
}

.btn-clear {
    background: #ff6b6b;
    color: #fff;
}

.btn-clear:hover {
    background: #ee5a5a;
}

.btn-equals {
    background: #51cf66;
    color: #fff;
    grid-column: span 1;
}

.btn-equals:hover {
    background: #40c057;
}

.btn-zero {
    grid-column: span 1;
}

.history-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    min-width: 300px;
    max-width: 400px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.history-panel h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.history-list {
    overflow-y: auto;
    flex: 1;
}

.history-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(5px);
    background: #e9ecef;
}

.history-expression {
    color: #495057;
    font-size: 16px;
    margin-bottom: 5px;
    word-break: break-all;
}

.history-result {
    color: #212529;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-all;
}

.history-time {
    color: #6c757d;
    font-size: 12px;
}

.history-empty {
    color: #6c757d;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* 스크롤바 스타일 */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
    
    .history-panel {
        width: 100%;
        max-width: 400px;
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .calculator {
        padding: 20px;
    }
    
    .display-input {
        font-size: 36px;
    }
    
    .btn {
        font-size: 20px;
        padding: 16px;
    }
}
