:root {
    --brand: #0066FF;
    --brand-2: #0052CC;
    --accent: #00A3FF;
    --grad: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    --success: #00C48C;
}

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

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

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Шапка */
.site-header {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border);
}

.logo a {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--step-1);
    display: inline-flex;
    align-items: center;
    transition: opacity 150ms var(--ease-out);
}

.logo a:hover {
    opacity: 0.7;
}

/* Главный экран */
.hero-section {
    flex: 1;
    display: flex;
    align-items: center;
    padding: var(--space-8) 0;
}

.hero-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-4);
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--step-1);
    color: var(--muted);
    margin-bottom: var(--space-6);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-image {
    margin-top: var(--space-8);
    border-radius: var(--radius-3);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Форма загрузки */
.upload-form {
    margin-top: var(--space-6);
}

.upload-buttons {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--step-0);
    font-weight: 600;
    border-radius: var(--radius-2);
    border: none;
    cursor: pointer;
    transition: all 150ms var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--grad);
    color: white;
    box-shadow: var(--shadow-1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--brand);
}

.btn-upload svg,
.btn-camera svg {
    flex-shrink: 0;
}

.btn-submit {
    margin-top: var(--space-4);
    font-size: var(--step-1);
    padding: var(--space-4) var(--space-6);
}

/* Предпросмотр фото */
.preview-container {
    margin-top: var(--space-5);
    position: relative;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--radius-3);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}

.preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

.btn-close-preview {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms var(--ease-out);
}

.btn-close-preview:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Модальное окно камеры */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-3);
    padding: var(--space-6);
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-3);
}

.modal-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content h2 {
    margin-bottom: var(--space-4);
    text-align: center;
}

#cameraVideo {
    width: 100%;
    border-radius: var(--radius-2);
    background: #000;
    margin-bottom: var(--space-4);
}

.camera-buttons {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

/* Экран загрузки */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4);
}

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

.loading-content h2 {
    font-size: var(--step-2);
    margin-bottom: var(--space-2);
}

.loading-content p {
    color: rgba(255, 255, 255, 0.7);
}

/* Экран результата */
.result-section {
    padding: var(--space-8) 0;
}

.result-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.result-photo {
    border-radius: var(--radius-3);
    overflow: hidden;
    box-shadow: var(--shadow-3);
    position: relative;
}

.result-photo img {
    width: 100%;
    height: auto;
    display: block;
}

.photo-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.7));
    color: white;
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--step-0);
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.result-info {
    padding: var(--space-4);
}

.result-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-4);
}

.result-description {
    font-size: var(--step-1);
    color: var(--muted);
    margin-bottom: var(--space-5);
    line-height: 1.6;
}

.match-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--surface);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-pill);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border);
}

.match-label {
    font-size: var(--step--1);
    color: var(--muted);
}

.match-percent {
    font-size: var(--step-1);
    font-weight: 700;
    color: var(--success);
}

.result-info .btn-primary {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    font-size: var(--step-1);
}

/* Шаринг */
.share-section {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.share-label {
    font-size: var(--step-0);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.share-buttons {
    display: flex;
    gap: var(--space-2);
}

.share-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-2);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms var(--ease-out);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-1);
}

.share-vk:hover {
    background: #0077FF;
    border-color: #0077FF;
    color: white;
}

.share-telegram:hover {
    background: #0088CC;
    border-color: #0088CC;
    color: white;
}

.share-copy:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

/* Альтернативный блок */
.alternative-section {
    background: var(--surface);
    padding: var(--space-8) 0;
    border-top: 1px solid var(--border);
}

.alternative-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.alternative-content h2 {
    font-size: var(--step-2);
    margin-bottom: var(--space-3);
}

.alternative-content p {
    color: var(--muted);
    margin-bottom: var(--space-5);
}

/* Подвал */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--space-6) 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    font-size: var(--step--1);
    color: var(--muted);
    margin-bottom: var(--space-2);
}

.footer-content a {
    color: var(--brand);
    text-decoration: none;
    transition: opacity 150ms var(--ease-out);
}

.footer-content a:hover {
    opacity: 0.7;
}

.footer-note {
    font-size: var(--step--2);
}

.error-message {
    background: #FEE;
    border: 1px solid #FCC;
    color: #C33;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-2);
    margin-bottom: var(--space-4);
    text-align: center;
}

/* Адаптив */
@media (max-width: 768px) {
    .result-content {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .upload-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .hero-section {
        padding: var(--space-5) 0;
    }

    .share-buttons {
        justify-content: center;
    }

    .camera-buttons {
        flex-direction: column;
    }
}

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

/* --- Недостающие дизайн-токены (значения из theme.css платформы) --- */
:root{
  --bg: #f7f7fb;
  --text: #14141c;
  --container: 1160px;
  --space-4: 16px;
  --border: #e7e7ef;
  --step-1: clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --space-8: 64px;
  --muted: #6a6a7b;
  --space-6: 32px;
  --radius-3: 22px;
  --shadow-2: 0 1px 2px rgba(20, 20, 40, .06), 0 10px 24px rgba(20, 20, 40, .08);
  --space-3: 12px;
  --space-2: 8px;
  --space-5: 24px;
  --step-0: clamp(1rem, .96rem + .2vw, 1.125rem);
  --radius-2: 16px;
  --shadow-1: 0 1px 2px rgba(20, 20, 40, .06);
  --surface: #ffffff;
  --surface-2: #f1f1f7;
  --shadow-3: 0 2px 4px rgba(20, 20, 40, .06), 0 24px 60px rgba(20, 20, 40, .14);
  --step-2: clamp(1.45rem, 1.3rem + .9vw, 1.9rem);
  --radius-pill: 999px;
}
