* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    height: 100vh;
    background: linear-gradient(135deg, #d9f0ff, #ffe0f5, #e0ffe8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: 0.3s;
}

body.dark {
    background: linear-gradient(135deg, #0f172a, #1e293b, #020617);
    color: #fff;
}

.background {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    transition: 0.3s;
}

.one { background: #7dd3fc; top: 10%; left: 10%; width: 300px; height: 300px; }
.two { background: #f9a8d4; bottom: 15%; right: 10%; width: 250px; height: 250px; }
.three { background: #86efac; top: 50%; left: 50%; width: 200px; height: 200px; }

body.dark .one { background: #1d4ed8; }
body.dark .two { background: #be185d; }
body.dark .three { background: #065f46; }

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.history-panel {
    width: 250px;
    background: #ffffff;
    border-radius: 15px;
    padding: 15px;
    margin-right: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: 0.3s;
}

body.dark .history-panel {
    background: #1e293b;
    color: #fff;
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.empty-history {
    color: #888;
    font-size: 14px;
}

.calculator {
    width: 380px;
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    transition: 0.3s;
}

body.dark .calculator {
    background: #1e293b;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.logo {
    font-weight: 600;
    font-size: 16px;
}

.top-buttons button {
    border: none;
    background: #f0f0f0;
    padding: 8px 10px;
    margin-left: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

body.dark .top-buttons button {
    background: #334155;
    color: #fff;
}

.display-box {
    background: #f9fafb;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: 0.3s;
}

body.dark .display-box {
    background: #0f172a;
}

.display-box input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    text-align: right;
}

#expression {
    font-size: 16px;
    color: #666;
}

body.dark #expression {
    color: #cbd5f5;
}

#result {
    font-size: 26px;
    font-weight: 600;
}

.memory-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.memory-buttons button {
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: #e0f2fe;
    cursor: pointer;
    transition: 0.3s;
}

body.dark .memory-buttons button {
    background: #334155;
    color: #fff;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

button {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    transform: scale(1.05);
}

.function { background: #fde68a; }

.operator {
    background: #93c5fd;
    color: white;
}

body.dark .function { background: #ca8a04; color: white; }
body.dark .operator { background: #2563eb; }

#equalsBtn {
    grid-column: span 2;
    background: linear-gradient(135deg, #34d399, #60a5fa);
    color: white;
    font-weight: bold;
}

body.dark #equalsBtn {
    background: linear-gradient(135deg, #059669, #2563eb);
}

#copyBtn {
    background: #fbcfe8;
}

body.dark #copyBtn {
    background: #be185d;
    color: white;
}

#toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4ade80;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    display: none;
}

footer {
    text-align: center;
    padding: 10px;
    font-size: 14px;
    color: #555;
}

body.dark footer {
    color: #cbd5e1;
}
