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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    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: 500px;
}

.calculator {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.display {
    background: #222;
    padding: 20px;
    color: white;
}

.history-display {
    font-size: 14px;
    color: #888;
    min-height: 20px;
    text-align: right;
    margin-bottom: 5px;
}

#display {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    font-size: 36px;
    text-align: right;
    outline: none;
    font-weight: 300;
}

.mode-toggle {
    display: flex;
    background: #f5f5f5;
    padding: 10px;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.angle-toggle {
    padding: 10px 15px;
    border: none;
    background: #764ba2;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
    min-width: 60px;
}

.angle-toggle:hover {
    background: #654090;
}

.buttons {
    padding: 20px;
    background: #f9f9f9;
}

.scientific-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

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

.btn {
    padding: 20px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

.btn:active {
    transform: translateY(0);
}

.btn.number {
    background: white;
}

.btn.operator {
    background: #e0e0e0;
    color: #667eea;
    font-weight: 600;
}

.btn.function {
    background: #f0f0f0;
    color: #764ba2;
    font-size: 12px;
    padding: 15px 8px;
}

.btn.clear {
    background: #ff6b6b;
    color: white;
}

.btn.equals {
    grid-column: span 4;
    background: #667eea;
    color: white;
    font-size: 24px;
}

.history-section {
    background: #f5f5f5;
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #e0e0e0;
}

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

.history-header h3 {
    font-size: 16px;
    color: #333;
}

.btn-small {
    padding: 5px 15px;
    border: none;
    border-radius: 5px;
    background: #ff6b6b;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #ff5252;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-item {
    padding: 8px;
    background: white;
    border-radius: 5px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: #e8e8e8;
}

.history-item .expression {
    color: #333;
}

.history-item .result {
    color: #667eea;
    font-weight: 600;
}

.history-list:empty::after {
    content: "No history yet";
    color: #999;
    font-size: 14px;
    text-align: center;
    display: block;
    padding: 20px;
}
