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

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-gold: #b45309;
    --color-gold-hover: #92400e;
    --color-gold-light: #fef3c7;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 150ms ease;
    --max-width: 720px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-title {
    text-align: left;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

.main {
    flex: 1;
    padding: 2.5rem 0;
}

.converter-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.drop-zone:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.drop-zone-content .icon {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.drop-zone-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-zone-content p {
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.link-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.link-btn:hover {
    color: var(--color-primary-hover);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.drop-zone-loading .icon,
.drop-zone-success .icon,
.drop-zone-error .icon,
.drop-zone-premium .icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
}

.drop-zone-success .icon.success {
    color: var(--color-success);
}

.drop-zone-error .icon.error {
    color: var(--color-error);
}

.drop-zone-premium .icon.premium {
    color: var(--color-gold);
}

.drop-zone-success h2,
.drop-zone-error h2,
.drop-zone-premium h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.drop-zone-success p,
.drop-zone-error p,
.drop-zone-premium p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.drop-zone-premium p {
    max-width: 34rem;
    margin-left: auto;
    margin-right: auto;
}

.utm-info {
    font-size: 0.8125rem;
    color: var(--color-primary);
    font-family: monospace;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
}

.preview-panel {
    margin-bottom: 1.5rem;
    text-align: left;
}

.preview-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.preview-frame {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    line-height: 0;
}

.preview-frame svg {
    display: block;
    width: 100%;
    height: auto;
}

.preview-note {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0.5rem 0 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

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

.btn-premium {
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
}

.btn-premium:hover {
    background: var(--color-gold-light);
}

.btn-premium.is-active {
    background: var(--color-gold);
    color: white;
}

.btn-premium.is-active:hover {
    background: var(--color-gold-hover);
}

.options-panel {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.options-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.options-intro {
    margin: -0.5rem 0 1rem;
}

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

.noscript-notice {
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    color: #78350f;
    padding: 1rem 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.option-group {
    margin-bottom: 1rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
    position: relative;
}

.checkbox-label input:checked + .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-help {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    margin-left: 1.75rem;
}

.option-group label[for] {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.option-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition);
}

.option-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.info-section,
.faq-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.info-section h2,
.faq-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.info-lead {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 1.75rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.step {
    text-align: center;
    padding: 1rem;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.step h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.step p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.faq-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--color-text-muted);
    transition: var(--transition);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    padding: 0 1.25rem 1rem;
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

.footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.footer-links {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    justify-content: center;
    align-items: center;
}

.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--color-primary);
    text-decoration: underline;
}

.legal-page {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin: 2rem auto;
}

.legal-page h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-page h2 {
    font-size: 1.0625rem;
    margin: 1.75rem 0 0.5rem;
}

.legal-page p,
.legal-page li {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-text-muted);
}

.legal-page ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.legal-page a {
    color: var(--color-primary);
}

.legal-page .legal-meta {
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
}

.legal-back {
    display: inline-block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.legal-back:hover {
    text-decoration: underline;
}

[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .header h1 {
        font-size: 2rem;
    }

    .converter-section,
    .info-section,
    .faq-section {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .header-container {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-title {
        text-align: center;
    }
}