/* ============ БАЗА ============ */
:root {
    --black: #000000;
    --white: #FFFFFF;
    --yellow: #FFEB3B;
    --yellow-bg: #FFF9C4;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --error: #DC2626;
    --error-bg: #FEF2F2;
    --success: #16A34A;
    --success-bg: #DCFCE7;
    --info: #2563EB;
    --info-bg: #EFF6FF;
    --navy: #1E3A5F;
}

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--black);
    background: var(--white);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* Отключаем scroll anchoring — мобильные браузеры пытаются "сохранить" позицию скролла при смене DOM */
    overflow-anchor: none;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ HEADER ============ */
.site-header {
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--black);
}

.logo img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-800);
}

/* ============ ГЛАВНОЕ ============ */
.screen {
    display: none;
    padding: 40px 0 80px;
}

.screen.active {
    display: block;
}

h1 {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

h1 .highlight {
    background: var(--yellow);
    padding: 0 8px;
}

h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 32px 0 12px;
    line-height: 1.25;
}

h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 8px;
}

p {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--gray-800);
}

p.lead {
    font-size: 18px;
    color: var(--gray-700);
    line-height: 1.55;
}

strong { font-weight: 700; color: var(--black); }
em { font-style: italic; color: var(--gray-600); }

/* ============ ПРОГРЕСС-БАР ============ */
.progress-wrap {
    padding: 16px 0 4px;
}

.progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--black);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 8px;
    font-weight: 500;
}

/* ============ ФОРМЫ ============ */
.field {
    margin-bottom: 24px;
}

.field-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--black);
    line-height: 1.4;
}

.field-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 10px;
}

.field-required {
    color: var(--error);
    margin-left: 3px;
}

.input,
.textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    color: var(--black);
    background: var(--white);
    transition: border-color 0.15s;
}

.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--black);
}

.input.error,
.textarea.error {
    border-color: var(--error);
}

.textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.char-counter {
    font-size: 12px;
    color: var(--gray-400);
    text-align: right;
    margin-top: 4px;
}

.char-counter.warn {
    color: var(--error);
}

/* Radio group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--white);
}

.radio-option:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.radio-option.selected {
    border-color: var(--black);
    background: var(--gray-50);
}

.radio-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--black);
    cursor: pointer;
}

.radio-option-text {
    font-size: 15px;
    line-height: 1.4;
}

.radio-option .textarea {
    margin-top: 10px;
    background: var(--white);
}

.radio-conditional {
    display: none;
    margin-top: 12px;
}

.radio-option.selected .radio-conditional {
    display: block;
}

/* ============ КНОПКИ ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    background: var(--black);
    color: var(--white);
}

.btn:hover {
    background: var(--gray-800);
    transform: translateY(-1px);
}

.btn:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--black);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    border-color: var(--black);
    background: var(--gray-50);
}

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

.btn-danger:hover {
    background: #991B1B;
}

.btn-large {
    padding: 18px 40px;
    font-size: 18px;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 10px 18px;
    font-size: 14px;
}

/* ============ БЛОКИ ОШИБОК КАМЕРЫ ============ */
.camera-error-case code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 13px;
}

.camera-error-case a {
    text-decoration: none;
}

.camera-error-case a:hover {
    text-decoration: underline;
}

.camera-error-case .btn + .btn {
    margin-left: 4px;
}

.btn-row {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    flex-wrap: wrap;
}

.btn-row.center {
    justify-content: center;
}

/* ============ ИНФО-БЛОКИ ============ */
.info-box {
    padding: 16px 20px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 15px;
    line-height: 1.5;
}

.info-box strong { font-weight: 700; }

.info-box.yellow {
    background: var(--yellow-bg);
    border-left: 4px solid var(--yellow);
    color: var(--gray-900);
}

.info-box.blue {
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    color: var(--gray-900);
}

.info-box.gray {
    background: var(--gray-100);
    border-left: 4px solid var(--gray-500);
    color: var(--gray-800);
}

.info-box.red {
    background: var(--error-bg);
    border-left: 4px solid var(--error);
    color: var(--gray-900);
}

/* ============ СПИСКИ С ЧЕК-МАРК ============ */
.check-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.check-list li {
    padding: 8px 0 8px 32px;
    position: relative;
    font-size: 15px;
    line-height: 1.5;
}

.check-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 8px;
    color: var(--success);
    font-weight: 700;
    font-size: 18px;
}

/* ============ ВИДЕО-ЗАПИСЬ ============ */
/* На экране записи контейнер шире + всё компактнее, чтобы уложиться в один вьюпорт */
#screen-recording .container {
    max-width: 960px;
}

#screen-recording.screen {
    padding: 20px 0 40px;
}

#screen-recording h1 {
    font-size: 22px;
    margin-bottom: 12px;
}

.video-recorder {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 24px;
    margin: 16px 0;
    align-items: start;
}

.video-preview {
    background: var(--gray-900);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3;
    width: 100%;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-preview-placeholder {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

.rec-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(220, 38, 38, 0.95);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 6px;
}

.rec-indicator.active {
    display: flex;
    animation: recPulse 1.5s infinite;
}

@keyframes recPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.rec-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.timer-display {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    font-family: monospace;
}

.task-panel {
    background: var(--gray-50);
    padding: 18px 22px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    max-height: 300px;
    overflow-y: auto;
}

.task-panel h3 {
    margin-top: 0;
    font-size: 15px;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-bottom: 12px;
}

.task-panel-content {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--gray-900);
}

.task-panel-content p {
    font-size: 14.5px;
    margin-bottom: 10px;
}

/* Прогресс-таймер */
.prep-timer-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 12px 22px;
    margin: 12px 0;
    background: var(--yellow-bg);
    border-radius: 12px;
    border: 1px solid var(--yellow);
}

.prep-timer-value {
    font-size: 32px;
    font-weight: 800;
    font-family: monospace;
    color: var(--gray-900);
    line-height: 1;
    flex-shrink: 0;
}

.prep-timer-label {
    font-size: 13.5px;
    color: var(--gray-700);
    font-weight: 600;
    line-height: 1.4;
    max-width: 460px;
}

.rec-timer-panel {
    text-align: center;
    padding: 10px 0;
    margin: 10px 0;
}

.rec-timer-value {
    font-size: 30px;
    font-weight: 800;
    font-family: monospace;
    color: var(--error);
    line-height: 1;
}

.rec-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* ============ БЛАГОДАРНОСТЬ ============ */
.thank-screen {
    text-align: center;
    padding: 60px 0;
}

.thank-icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 24px;
}

.thank-icon.reject {
    filter: grayscale(1);
    opacity: 0.6;
}

/* ============ ОШИБКИ И ЗАГРУЗКА ============ */
.error-msg {
    color: var(--error);
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.error-msg.active { display: block; }

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 20px;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--black);
}

.loading-overlay-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .container {
        padding: 0 20px;
    }

    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 20px;
    }

    .btn-row {
        flex-direction: column-reverse;
    }

    .btn-row .btn {
        width: 100%;
    }

    .video-recorder {
        grid-template-columns: 1fr;
    }

    .task-panel {
        max-height: 380px;
        align-self: auto;
    }

    .prep-timer-panel {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 14px 16px;
    }

    .prep-timer-value {
        font-size: 40px;
    }

    .screen {
        padding: 24px 0 60px;
    }
}
