/* -- Onboarding pages ---------------------------- */
.page {
    display: none;
    position: relative;
    box-sizing: border-box;
}
.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out both;
    padding-top: var(--page-padding-top, 1rem);
    padding-bottom: var(--page-padding-bottom, 1rem);
}
.page-exercise.active {
    display: flex;
    flex-direction: column;
    min-height: min(720px, calc(100dvh - 5.5rem));
    gap: 0.15rem;
    padding-top: 3.25rem;
    padding-bottom: var(--page-padding-bottom, 1rem);
}

/* Language page */
.onboard-panel {
    text-align: center;
    margin: 0 auto 1rem;
    max-width: 480px;
}
.onboard-panel-learning {
    padding-top: 0.2rem;
}
.onboard-panel-ui,
.topic-panel {
    padding: 1rem 0.9rem;
    border: 1px solid rgba(232,221,211,0.78);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,250,246,0.94));
    box-shadow: 0 8px 24px rgba(201,142,104,0.08);
}
.onboard-mascot {
    width: 108px;
    height: 90px;
    margin: 0.65rem auto 0.55rem;
}
.onboard-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.45rem;
    padding: 0.18rem 0.62rem;
    border-radius: 999px;
    background: #fff1e8;
    color: #c65f44;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}
.onboard-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #e17055;
    text-align: center;
    margin-bottom: 0.15rem;
    letter-spacing: 0;
}
.onboard-title-sm { font-size: 1.4rem; }
.onboard-sub {
    font-size: 0.92rem;
    color: #b2a198;
    text-align: center;
    font-weight: 600;
    margin-bottom: 0.65rem;
}
.selection-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 340px;
    padding: 0.45rem 0.7rem;
    border-radius: 12px;
    background: rgba(108,92,231,0.08);
    color: #5f5a75;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}
.context-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.7rem;
}
.context-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.75rem;
    padding: 0.28rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(139,126,116,0.18);
    background: #fff;
    color: #5f5a75;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.2;
}
.context-pill-learning {
    color: #6c5ce7;
    border-color: rgba(108,92,231,0.18);
    background: rgba(108,92,231,0.08);
}
.context-pill-note {
    color: #8b7e74;
    background: rgba(247,242,238,0.82);
}
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.62rem;
}
.lang-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-height: 5.6rem;
    padding: 0.72rem 0.4rem;
    background: #fff;
    border: 2px solid #e8ddd3;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.lang-card:hover {
    border-color: #f0b89a;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.lang-card:active { transform: scale(0.96); }
.prompt-lang-card {
    border-color: rgba(108,92,231,0.14);
}
.prompt-lang-card:hover {
    border-color: rgba(108,92,231,0.34);
    box-shadow: 0 6px 18px rgba(108,92,231,0.1);
}
.prompt-lang-card.selected {
    border-color: #6c5ce7;
    background: #f4f1ff;
}
.lang-flag { font-size: 1.6rem; }
.lang-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: #2d3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

/* Topic page */
.topic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding-bottom: 1rem;
}
.training-type-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin: 0 auto 0.85rem;
    max-width: 360px;
}
.training-type-tab {
    min-height: 42px;
    border: 2px solid #e8ddd3;
    border-radius: 12px;
    background: #fff;
    color: #5f5a75;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.training-type-tab:hover {
    border-color: rgba(108,92,231,0.35);
    transform: translateY(-1px);
}
.training-type-tab.active {
    border-color: #2f8f7d;
    background: #edf7f4;
    color: #276c5a;
    box-shadow: 0 5px 14px rgba(47,143,125,0.14);
}
.practice-mode-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0 auto 0.75rem;
    max-width: 440px;
}
.practice-mode-tab {
    min-height: 42px;
    border: 2px solid #e8ddd3;
    border-radius: 12px;
    background: #fff;
    color: #5f5a75;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.practice-mode-tab:hover {
    border-color: rgba(108,92,231,0.35);
    transform: translateY(-1px);
}
.practice-mode-tab.active {
    border-color: #6c5ce7;
    background: #f4f1ff;
    color: #5c4bd6;
    box-shadow: 0 5px 14px rgba(108,92,231,0.14);
}
.topic-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    min-height: 6.6rem;
    padding: 0.8rem 0.5rem;
    background: #fff;
    border: 2px solid #e8ddd3;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-align: center;
}
.topic-card:hover { border-color: #00b894; transform: scale(1.03); box-shadow: 0 4px 16px rgba(0,180,120,0.1); }
.topic-card:active { transform: scale(0.96); }
.topic-card-emoji {
    font-size: 2.4rem; line-height: 1; text-align: center;
    margin-bottom: 0.2rem;
}
.topic-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #2d3436;
}
.topic-card-desc {
    max-width: 12rem;
    color: #8b7e74;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
}
.topic-card-section {
    grid-column: 1 / -1;
    color: #8b7e74;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
    margin-top: 0.25rem;
    text-transform: uppercase;
}
.targeted-card {
    border-color: rgba(108,92,231,0.18);
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
}
.targeted-card:hover {
    border-color: rgba(108,92,231,0.42);
    box-shadow: 0 5px 18px rgba(108,92,231,0.12);
}
.topic-card.is-disabled,
.topic-card:disabled {
    cursor: not-allowed;
    filter: grayscale(0.18);
    opacity: 0.46;
    transform: none;
}
.topic-card.is-disabled:hover,
.topic-card:disabled:hover {
    border-color: #e8ddd3;
    box-shadow: none;
    transform: none;
}
