* {
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --fg: #111;
    --card-bg: #ffffff;
    --input-bg: #f3f3f3;
    --button-bg: #007bff;
    --button-fg: #fff;
    --button-secondary-bg: #444;
}

:root[data-theme="dark"] {
    --bg: #111;
    --fg: #eee;
    --card-bg: #1b1b1b;
    --input-bg: #222;
    --button-bg: #0d6efd;
    --button-secondary-bg: #333;
}

body {
    background: var(--bg);
    color: var(--fg);
    margin: 0;
    padding: 20px;
    font-family: "Segoe UI", sans-serif;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
}

.header-bar {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.theme-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--fg);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--input-bg);
}

/* Card */
.card {
    margin: 0 auto;
    max-width: 350px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 6px 24px #0003;
}

/* Inputs */
label {
    display: block;
    margin: 12px 0 4px;
}

input,
select {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #4442;
    background: var(--input-bg);
    color: var(--fg);
    font-size: 1rem;
}

/* Buttons */
.button-primary {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border-radius: 8px;
    border: none;
    background: var(--button-bg);
    color: var(--button-fg);
    font-size: 1.1rem;
    cursor: pointer;
}

.button-secondary {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--button-secondary-bg);
    color: var(--fg);
    cursor: pointer;
}

.result {
    margin-top: 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.shake {
    animation: shake 0.3s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-4px);
    }

    100% {
        transform: translateX(0);
    }
}