:root {
    --color-bg: #ffffff;
    --color-text: #1d1d1f;
    --color-text-secondary: #86868b;
    --color-accent: #0071e3;
    --color-accent-hover: #0077ed;
    --color-border: #d2d2d7;
    --color-card: #fbfbfd;
    --color-glass: rgba(255, 255, 255, 0.72);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    --header-height: 56px;
    --radius: 16px;
    --max-width: 1400px;
}

[data-theme="dark"] {
    --color-bg: #000000;
    --color-text: #f5f5f7;
    --color-text-secondary: #86868b;
    --color-accent: #2997ff;
    --color-accent-hover: #4da8ff;
    --color-border: #424245;
    --color-card: #161617;
    --color-glass: rgba(29, 29, 31, 0.72);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    font-size: 17px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: -0.015em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background var(--transition-smooth), color var(--transition-smooth);
}

.tool-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tool-header {
    height: var(--header-height);
    background: var(--color-glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition-smooth);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: 980px;
    color: var(--color-accent);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.back-btn:hover {
    background: rgba(0, 113, 227, 0.08);
}

[data-theme="dark"] .back-btn:hover {
    background: rgba(41, 151, 255, 0.15);
}

.tool-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.theme-toggle-small {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    opacity: 0.8;
    transition: all var(--transition-fast);
}

.theme-toggle-small:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle-small:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tool-main {
    flex: 1;
    padding: 32px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 980px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    color: var(--color-accent);
}

.btn-secondary:hover {
    background: rgba(0, 113, 227, 0.08);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(41, 151, 255, 0.15);
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 28px;
    transition: all var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

[data-theme="dark"] .input:focus {
    box-shadow: 0 0 0 4px rgba(41, 151, 255, 0.15);
}

.input::placeholder {
    color: var(--color-text-secondary);
}

.label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease forwards;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    .tool-main {
        padding: 20px;
    }
    .tool-header {
        padding: 0 20px;
    }
    .card {
        padding: 20px;
        border-radius: 16px;
    }
}
