:root {
    --bg: #05011d;
    --calc-bg: #2c2c2c;
    --display-bg: #000000;
    --text: #ffffff;
    --btn: #3a3a3a;
    --operator: #ff9500;
    --equals: #34c759;
    --clear: #ff3b30;
}

.light {
    --bg: #f5f4d2;
    --calc-bg: #f0caad;
    --display-bg: #eaeaea;
    --text: #000000;
    --btn: #cfe8d3;
    --operator: #ff9500;
    --equals: #34c759;
    --clear: #ff3b30;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg);
    font-family: Arial, sans-serif;
}

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

.theme-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    z-index: 1000;
}

.calculator {
    background: var(--calc-bg);
    padding: 20px;
    border-radius: 20px;
    width: 300px;
}

.display-container {
    background: var(--display-bg);
    padding: 10px;
    border-radius: 12px;
}

#display {
    width: 100%;
    height: 60px;
    font-size: 26px;
    padding: 10px;
    text-align: right;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text);
    box-sizing: border-box;
    outline: none;
}

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

button {
    height: 55px;
    border-radius: 12px;
    font-size: 18px;
    border: none;
    cursor: pointer;
    background: var(--btn);
    color: var(--text);
}

button:hover {
    opacity: 0.85;
}

.operator {
    background: var(--operator);
    color: #ffffff;
}

.equals {
    background: var(--equals);
    color: #ffffff;
    grid-row: span 2;
}

.clear {
    background: var(--clear);
    color: #ffffff;
}

.zero {
    grid-column: span 2;
}

.history {
    margin-top: 15px;
    background: var(--calc-bg);
    padding: 15px;
    border-radius: 15px;
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text);
}

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

#clearHistory {
    background: none;
    border: none;
    color: var(--operator);
    cursor: pointer;
    font-size: 14px;
}

#historyList {
    padding: 0;
    margin: 0;
}

#historyList li {
    list-style: none;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    cursor: pointer;
}

#historyList li:hover {
    opacity: 0.7;
}
