:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --border-color: #cccccc;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --table-header-bg: #f2f2f2;
    --table-border: #dddddd;
    --error-color: #d9534f;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --border-color: #444444;
    --accent-color: #3793ff;
    --accent-hover: #1e70d1;
    --table-header-bg: #3d3d3d;
    --table-border: #444444;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.calculator {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 500px;
    position: relative;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    margin-top: 0;
}

.theme-toggle:hover {
    background-color: var(--table-header-bg);
}

h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
}

button#calculate-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    transition: background-color 0.2s ease;
}

button#calculate-btn:hover {
    background-color: var(--accent-hover);
}

#result {
    margin-top: 2rem;
}

.error {
    color: var(--error-color);
    font-size: 1rem;
    text-align: center;
    background-color: rgba(217, 83, 79, 0.1);
    padding: 1rem;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

th, td {
    border: 1px solid var(--table-border);
    padding: 12px 8px;
    text-align: right;
}

th {
    background-color: var(--table-header-bg);
    color: var(--text-secondary);
    text-align: center;
    font-weight: 600;
}

h3 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

h4 {
    margin-top: 2rem;
    text-align: right;
    font-size: 1.4rem;
    color: var(--accent-color);
    border-top: 2px solid var(--table-border);
    padding-top: 1rem;
}
