:root {
    --bg-gradient: linear-gradient(135deg, #181c2f 0%, #232946 100%);
    --primary: #3a86ff;
    --primary-dark: #4361ee;
    --accent: #eebbc3;
    --surface: #232946cc;
    --surface-dark: #181c2f;
    --border: #393e5c;
    --result-bg: #393e5c;
    --error: #dc3545;
    --error-dark: #b02a37;
    --history-bg: #232946cc;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-light: 0 2px 8px #3a86ff22;
    --shadow-hover: 0 4px 16px #3a86ff33;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-main: #f0f0f0;
    --text-accent: #eebbc3;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: var(--bg-gradient);
    color: var(--text-main);
    transition: background 0.3s, color 0.3s;
}

body.dark {
    background: var(--bg-gradient);
    color: var(--text-main);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--accent);
    letter-spacing: 1px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.converter {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: 18px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 480px;
    transition: background 0.3s, box-shadow 0.3s;
    backdrop-filter: blur(2px);
    border: 1px solid var(--border);
}

label {
    display: block;
    margin: 1.5rem 0 0.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

input[type="text"] {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface-dark);
    color: var(--text-main);
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

input[type="text"]:focus,
input[type="text"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px #3a86ff33;
    background: #232946;
}

.error input[type="text"] {
    border-color: var(--error);
}

button,
.toggle-btn,
.clear-history {
    font-family: inherit;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s, box-shadow 0.3s;
    outline: none;
}

button {
    margin-top: 1.2rem;
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--shadow-light);
}

button:hover,
button:focus-visible {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--shadow-hover);
}

.toggle-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 24px;
    font-size: 1rem;
    box-shadow: var(--shadow-light);
}

.toggle-btn:hover,
.toggle-btn:focus-visible {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: var(--shadow-hover);
}

.result {
    margin-top: 1.2rem;
    padding: 1rem;
    background: var(--result-bg);
    border-radius: 10px;
    font-size: 1.1rem;
    word-break: break-all;
    transition: background 0.3s;
    box-shadow: 0 2px 8px #3a86ff11;
    color: var(--accent);
}

.error {
    color: var(--error);
    font-size: 1rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.history {
    margin-top: 2.5rem;
    width: 100%;
    max-width: 480px;
    background: var(--history-bg);
    padding: 2rem 1.5rem;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    transition: background 0.3s;
    border: 1px solid var(--border);
    backdrop-filter: blur(2px);
}

.history h2 {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    color: var(--accent);
    font-weight: 800;
}

.history ul {
    list-style: none;
    padding: 0;
}

.history li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 1rem;
}

.clear-history {
    margin-top: 1.2rem;
    background: linear-gradient(90deg, var(--error) 0%, #ff6b6b 100%);
    color: #fff;
    box-shadow: 0 2px 8px #dc354522;
}

.clear-history:hover,
.clear-history:focus-visible {
    background: linear-gradient(90deg, var(--error-dark) 0%, #ff6b6b 100%);
    box-shadow: 0 4px 16px #dc354533;
}

@media (max-width: 600px) {
    .converter,
    .history {
        padding: 1.2rem 0.7rem;
        max-width: 98vw;
    }
    h1 {
        font-size: 2rem;
    }
    .toggle-btn {
        top: 1rem;
        right: 1rem;
        font-size: 0.95rem;
        padding: 0.4rem 1rem;
    }
}