:root {
    --bg-color: #0d0d0d;
    --calc-bg: rgba(35, 35, 40, 0.7);
    --display-bg: rgba(18, 18, 22, 0.9);
    --btn-bg: rgba(255, 255, 255, 0.04);
    --btn-hover: rgba(255, 255, 255, 0.08);
    --btn-active: rgba(255, 255, 255, 0.12);
    --accent-color: #0077ff;
    --accent-hover: #3395ff;
    --text-main: #f0f0f0;
    --text-muted: #888888;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #001a4d, var(--bg-color) 60%);
    color: var(--text-main);
    margin: 0;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    position: relative;
}

.header {
    position: absolute;
    top: 30px;
    left: 30px;
    font-size: 2rem;
    color: #fff;
    font-family: 'Pacifico', cursive;
    text-shadow: 0 0 10px rgba(0, 119, 255, 0.5), 0 0 20px rgba(0, 119, 255, 0.3);
    animation: pulse-glow 3s infinite alternate;
    z-index: 10;
}

@keyframes pulse-glow {
    0% { text-shadow: 0 0 10px rgba(0, 119, 255, 0.5), 0 0 20px rgba(0, 119, 255, 0.3); }
    100% { text-shadow: 0 0 15px rgba(0, 119, 255, 0.8), 0 0 30px rgba(0, 119, 255, 0.5); }
}

.calculator {
    background: var(--calc-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 25px;
    width: 320px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    z-index: 10;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.calculator:hover {
    transform: translateY(-5px);
}

.display-container {
    background: var(--display-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.04);
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    overflow: hidden;
    position: relative;
}

.display {
    width: 100%;
    color: var(--text-main);
    font-size: 2.5rem;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.display.message-mode {
    font-size: 1.3rem;
    color: var(--accent-hover);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 119, 255, 0.4);
    white-space: normal;
    line-height: 1.4;
    text-align: center;
    align-self: center;
    justify-self: center;
    margin: auto 0;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

.button {
    background: var(--btn-bg);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.35rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.button:hover {
    background: var(--btn-hover);
    transform: scale(1.05);
}

.button:active {
    background: var(--btn-active);
    transform: scale(0.95);
}

.button.operator {
    color: #4da6ff;
    background: rgba(77, 166, 255, 0.05);
}

.button.operator:hover {
    background: rgba(77, 166, 255, 0.15);
}

.button.clear {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.05);
}

.button.clear:hover {
    background: rgba(255, 77, 77, 0.15);
}

.button.equals {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--accent-color), #00aaff);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 119, 255, 0.4);
}

.button.equals:hover {
    background: linear-gradient(135deg, var(--accent-hover), #33bbff);
    box-shadow: 0 6px 20px rgba(0, 119, 255, 0.6);
    transform: translateY(-2px) scale(1.02);
}

.button.equals:active {
    transform: translateY(1px) scale(0.98);
}

/* Heart Animation Styles */
.heart {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    transform: rotate(-45deg);
    animation: floatUp 4s ease-in forwards;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 119, 255, 0.6);
}

.heart::before,
.heart::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: inherit;
    border-radius: 50%;
}

.heart::before {
    top: -10px;
    left: 0;
}

.heart::after {
    top: 0;
    left: 10px;
}

@keyframes floatUp {
    0% {
        transform: rotate(-45deg) translateY(0) scale(0);
        opacity: 0;
    }
    15% {
        opacity: 0.9;
        transform: rotate(-45deg) translateY(0) scale(1.2);
    }
    100% {
        transform: rotate(-45deg) translateY(-80vh) scale(1.5);
        opacity: 0;
    }
}
