:root {
    --bg-color: #f8fafc;
    --container-bg: #ffffff;
    --text-color: #1e293b;
    --subtitle-color: #64748b;
    --input-border: #e2e8f0;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --badge-bg: #eef2ff;
    --badge-text: #4338ca;
    --accent-glow: rgba(99, 102, 241, 0.2);
}

.dark-theme {
    --bg-color: #0f172a;
    --container-bg: #1e293b;
    --text-color: #f8fafc;
    --subtitle-color: #94a3b8;
    --input-border: #334155;
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --badge-bg: #312e81;
    --badge-text: #c7d2fe;
    --accent-glow: rgba(129, 140, 248, 0.3);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.container {
    text-align: center;
    background-color: var(--container-bg);
    padding: 3rem 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px var(--shadow-color);
    width: 90%;
    max-width: 500px;
    position: relative;
    transition: background-color 0.4s, transform 0.3s;
    border: 1px solid var(--input-border);
}

.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
    background-color: var(--badge-bg);
}

.header {
    margin-bottom: 2.5rem;
}

.badge {
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 0.4rem 1rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--subtitle-color);
    font-size: 1.1rem;
    margin: 0;
}

.action-area {
    margin-bottom: 2rem;
}

.main-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px var(--accent-glow);
}

.main-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 30px var(--accent-glow);
}

.main-btn:active {
    transform: scale(0.98);
}

.message-display {
    background-color: var(--badge-bg);
    padding: 2rem;
    border-radius: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px dashed var(--primary-color);
    animation: fadeIn 0.5s ease-out;
}

.hidden {
    display: none;
}

#message-content {
    color: var(--text-color);
    font-size: 1.2rem;
    line-height: 1.6;
    font-style: italic;
    font-weight: 500;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--badge-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-container {
    margin-top: 3rem;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.history-item {
    font-size: 0.9rem;
    padding: 1rem;
    border-bottom: 1px solid var(--input-border);
    color: var(--subtitle-color);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}
