/* ===== Tutorial — режим обучения ===== */

/* Базовые переменные */
:root {
    --felt-dark: #0b241a;
    --felt: #164734;
    --felt-light: #23624a;
    --gold: #f0c24b;
    --gold-soft: rgba(240, 194, 75, 0.16);
    --text: #eaf3ee;
    --text-dim: #a4bdb1;
    --card-face: #fbf9f2;
    --danger: #e5484d;
    --success: #3fa96b;
    --card-w: clamp(52px, 6.5vw, 80px);
    --card-h: calc(var(--card-w) * 1.42);
}

/* ===== Экран обучения ===== */
.tutorial-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% -10%, #276a4d 0%, #123a2a 45%, #071410 100%);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ===== Шапка ===== */
.tutorial-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 8px;
    flex-shrink: 0;
    position: relative;
}

.btn-back {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: var(--text);
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.btn-back:hover { background: rgba(255,255,255,0.18); }

#chapterTitle {
    flex: 1;
    font-size: clamp(15px, 3vw, 19px);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-counter {
    font-size: 13px;
    color: var(--text-dim);
    flex-shrink: 0;
}

/* ===== Прогресс-бар ===== */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}
.progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ===== Тело ===== */
.tutorial-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 16px 24px;
    gap: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ===== Сцена с картами ===== */
.scene-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
}

.table-cards {
    display: flex;
    justify-content: center;
    gap: 12px;
    min-height: var(--card-h);
    flex-wrap: wrap;
}

.player-hand {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Карты ===== */
.card {
    width: var(--card-w);
    height: var(--card-h);
    background: var(--card-face);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 4vw, 32px);
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    border: 3px solid transparent;
    position: relative;
    min-width: 52px;
}
.card.red { color: #b3262c; }
.card.black { color: #23282b; }

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.card:active {
    transform: translateY(-2px);
}

.card.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.card.highlight {
    border-color: var(--gold);
    box-shadow: 0 0 16px var(--gold-soft);
    animation: pulse-gold 1.2s ease-in-out infinite;
}

.card.correct {
    border-color: var(--success);
    box-shadow: 0 0 16px rgba(63,169,107,0.3);
}

.card.wrong {
    border-color: var(--danger);
    box-shadow: 0 0 16px rgba(229,72,77,0.3);
    animation: shake 0.4s ease;
}

.card-small {
    width: clamp(40px, 5vw, 56px);
    height: calc(clamp(40px, 5vw, 56px) * 1.42);
    font-size: clamp(16px, 3vw, 22px);
    cursor: default;
}
.card-small:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 8px var(--gold-soft); }
    50% { box-shadow: 0 0 20px var(--gold-soft); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ===== Объяснение (Глава 5) ===== */
.explanation-area {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 20px;
}
.explanation-area h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--gold);
}
.explanation-area p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 10px;
}
.explanation-area ul {
    padding-left: 20px;
    margin-bottom: 10px;
}
.explanation-area li {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 6px;
}

/* ===== Хваленки (Глава 6) ===== */
.valency-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.valency-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.valency-card {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text);
    font-family: inherit;
}
.valency-card:hover,
.valency-card.active {
    border-color: var(--gold);
    background: var(--gold-soft);
}
.valency-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}
.valency-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}
.valency-card small {
    color: var(--text-dim);
    font-size: 12px;
}
.valency-detail {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 20px;
    font-size: 15px;
    line-height: 1.6;
}

/* ===== Тест (Глава 5) ===== */
.test-area {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#testQuestion {
    font-size: 16px;
    line-height: 1.5;
}
#testInput {
    padding: 12px 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
#testInput:focus {
    border-color: var(--gold);
}

/* ===== Обратная связь ===== */
.feedback-area {
    min-height: 48px;
}
.feedback-content {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}
.feedback-content.success {
    border-color: var(--success);
    background: rgba(63,169,107,0.12);
}
.feedback-content.error {
    border-color: var(--danger);
    background: rgba(229,72,77,0.12);
}

/* ===== Кнопки навигации ===== */
.nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding-top: 8px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: var(--text-dim);
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.btn-primary {
    background: linear-gradient(135deg, #f3cd68, #d9a52c);
    color: #23180a;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* ===== Кнопка обучения в меню ===== */
.btn-tutorial {
    background: linear-gradient(135deg, #46b979, #2f8b58);
    color: #fff;
    border: none;
}
.btn-tutorial:hover {
    background: linear-gradient(135deg, #52c989, #3a9b68);
}

/* ===== Утилиты ===== */
.text-input {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
}
.text-input:focus {
    border-color: var(--gold);
}

.hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ===== Адаптивность ===== */
@media (max-width: 400px) {
    .tutorial-header {
        padding: 10px 12px 6px;
        gap: 8px;
    }
    .tutorial-body {
        padding: 10px 12px 20px;
    }
    .valency-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .tutorial-body {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }
}
