@font-face {
    font-family: "IRANSans";
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url("/babolharam/fonts/IRANSansWeb(FaNum)_Light.woff2") format("woff2"),
         url("/babolharam/fonts/IRANSansWeb(FaNum)_Light.woff") format("woff");
}

@font-face {
    font-family: "IRANSans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/babolharam/fonts/IRANSansWeb(FaNum).woff2") format("woff2"),
         url("/babolharam/fonts/IRANSansWeb(FaNum).woff") format("woff");
}

@font-face {
    font-family: "IRANSans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/babolharam/fonts/IRANSansWeb(FaNum)_Medium.woff2") format("woff2"),
         url("/babolharam/fonts/IRANSansWeb(FaNum)_Medium.woff") format("woff");
}

@font-face {
    font-family: "IRANSans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/babolharam/fonts/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
         url("/babolharam/fonts/IRANSansWeb(FaNum)_Bold.woff") format("woff");
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

*:focus,
*:focus-visible {
    outline: none;
}

button,
a,
input,
select,
textarea,
[role="button"],
[tabindex]:not([tabindex="-1"]) {
    touch-action: manipulation;
}

:root {
    --orange: #FF9D00;
    --orange-dark: #e88d00;
    --yellow: #EAD200;
    --blue: #3F51B5;
    --green: #4CAF50;
    --green-blue: #009688;
    --gray: #9E9E9E;
    --gray-light: #f5f5f5;
    --text: #333;
    --text-light: #666;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --image-radius: 8px;
    --nav-width: 220px;
    --bottom-nav-height: 72px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    font-family: "IRANSans", Tahoma, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn-primary,
.btn-secondary,
.btn-back,
.btn-save-profile,
.toolbar-btn,
.plan-btn,
.mic-btn,
.bottom-nav-item,
.more-menu-close,
.game-dialog-close {
    font-family: "IRANSans", Tahoma, sans-serif;
}

.english-app {
    min-height: 100vh;
}

/* Messenger webviews already inset content above system UI; env(safe-area-inset-bottom) would double the gap. */
.english-app.eitaa-webview,
.english-app.bale-webview {
    --safe-area-bottom: 0px;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    background: var(--white);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
    .app-shell {
        max-width: 900px;
        flex-direction: row;
    }
}

/* Navigation — sidebar on tablet+, bottom bar on mobile */
.app-nav--sidebar {
    display: none;
}

@media (min-width: 768px) {
    .app-nav--sidebar {
        display: block;
    }
}

.app-nav {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    padding: 16px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .app-nav {
        width: var(--nav-width);
        min-height: 100vh;
        position: sticky;
        top: 0;
        align-self: flex-start;
    }
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.app-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.app-brand-text {
    color: var(--white);
    font-size: 15px;
    font-weight: bold;
    line-height: 1.4;
}

.app-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 15px;
    transition: background 0.2s, color 0.2s;
}

.app-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.app-nav-item.active {
    background: var(--orange);
    color: var(--white);
    font-weight: bold;
}

.nav-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

/* Bottom navigation — mobile only */
.app-bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    min-height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    /*background: var(--white);*/
    background:#4bd590;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
    padding-bottom: var(--safe-area-bottom);
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .app-bottom-nav {
        display: none;
    }
}

.english-app.hide-bottom-nav .app-bottom-nav {
    display: none;
}

.english-app.hide-bottom-nav .app-content {
    padding-bottom: calc(12px + var(--safe-area-bottom));
    background: #f3f1d8;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--bottom-nav-height);
    padding: 6px 4px 8px;
    border: none;
    background: none;
    color: var(--text-light);
    text-decoration: none;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    transition: color 0.2s;
    min-width: 0;
    box-sizing: border-box;
}

    .bottom-nav-item:hover,
    .bottom-nav-item.active {
        /*color: var(--orange);*/
        color: #da00ff;
    }

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.1);
}

.bottom-nav-icon {
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1;
    transition: transform 0.15s;
}

.bottom-nav-label {
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}

.bottom-nav-more .bottom-nav-icon {
    font-size: 26px;
    font-weight: bold;
    letter-spacing: -2px;
}

/* More menu sheet */
.more-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.more-menu-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    z-index: 201;
    padding-bottom: var(--safe-area-bottom);
    animation: slideUp 0.25s ease;
}

@media (min-width: 768px) {
    .more-menu-backdrop,
    .more-menu-sheet {
        display: none !important;
    }
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100%); }
    to { transform: translateX(-50%) translateY(0); }
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-light);
    font-weight: bold;
    color: var(--text);
}

.more-menu-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.more-menu-close:hover {
    background: var(--gray-light);
}

.more-menu-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    transition: background 0.2s;
}

.more-menu-item:hover {
    background: var(--gray-light);
}

.more-menu-item.active {
    background: rgba(255, 157, 0, 0.12);
    color: var(--orange-dark);
    font-weight: bold;
}

body.more-menu-open {
    overflow: hidden;
}

/* Main content */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--gray-light);
}

.app-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-height: 52px;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 2px solid var(--orange);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: #4bd590;
}

.btn-back {
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
    border: 2px solid var(--orange);
    cursor: pointer;
    color: var(--orange-dark);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(255, 157, 0, 0.3);
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-back.is-visible {
    display: inline-flex;
}

.btn-back-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.btn-back-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

.btn-back:hover,
.btn-back:focus-visible {
    background: var(--orange);
    color: var(--white);
    box-shadow: 0 3px 12px rgba(255, 157, 0, 0.45);
    outline: none;
}

.btn-back:active {
    transform: scale(0.95);
}

.app-header--with-back .app-title {
    font-size: 14px;
}

.app-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--text);
    flex: 1;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-content {
    flex: 1;
    padding: 12px;
    padding-bottom: 12px;
    overflow-y: auto;
    background: #f3f1d8;
}

@media (min-width: 768px) {
    .app-content {
        padding-bottom: 16px;
    }
}

/* Cards grid — 2 columns on mobile, 3 on tablet+ */
.card-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-grid.cols-2,
.card-grid.cols-3 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

@media (min-width: 768px) {
    .card-grid.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    .card-grid.cols-2 {
        gap: 12px;
    }
}

/* Item cards */
.item-card {
    /*background: var(--white);*/
    background: #f6ffe2;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.item-card.locked {
    opacity: 0.7;
    position: relative;
}

.item-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 20px;
}

.item-card-image {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: var(--image-radius) var(--image-radius) 0 0;
}

    .item-card-image.small {
        aspect-ratio: 3/4;
        max-height: 120px;
        object-fit: contain;
        padding: 8px;
        /*background: var(--gray-light);*/
        background: linear-gradient(359deg, #b791c7, #8233c9);
        border-radius: var(--image-radius);
    }

.item-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-card-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text);
    line-height: 1.4;
    white-space: pre-line;
}

.item-card-summary {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tree/category cards */
.tree-card {
    border-color: gold;
    background: linear-gradient(135deg, #fffde7, #ffe89d);
    border-radius: var(--radius);
    padding: 10px 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: transform 0.15s;
}

@media (min-width: 768px) {
    .tree-card {
        padding: 16px;
        gap: 10px;
    }
}

.tree-card:hover {
    transform: translateY(-2px);
}

.tree-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: var(--image-radius);
}

@media (min-width: 768px) {
    .tree-card img {
        width: 80px;
        height: 80px;
    }
}

.tree-card-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--text);
    line-height: 1.35;
    white-space: pre-line;
}

.tree-card-count {
    font-size: 10px;
    color: var(--muted, #888);
    line-height: 1.2;
}

@media (min-width: 768px) {
    .tree-card-title {
        font-size: 13px;
    }

    .tree-card-count {
        font-size: 12px;
    }
}

/* Video rows */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-row {
    border: 2px solid gold;
    background: linear-gradient(135deg, #fffde7, #fbff00);
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s;
    position: relative;
}

.video-row:hover {
    transform: translateX(-4px);
}

.video-row.locked {
    opacity: 0.65;
}

.video-row.locked::after {
    content: '🔒';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 16px;
}

.video-row.viewed {
    border: 1px solid rgba(76, 175, 80, 0.35);
}

.video-row-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--gray-light);
}

.video-row-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.video-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.video-row-text-fa {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.video-row-text-en {
    font-size: 14px;
    font-weight: bold;
    color: var(--blue);
    line-height: 1.4;
    direction: ltr;
    text-align: left;
}

.video-row .progress-bar-wrap {
    margin-top: 4px;
}

/* Lesson rows */
.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s;
}

.lesson-row:hover {
    transform: translateX(-4px);
}

.lesson-row.locked {
    opacity: 0.65;
}

.lesson-badge {
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.lesson-badge.audio { background: var(--blue); }
.lesson-badge.video { background: var(--green); }
.lesson-badge.flashcard { background: var(--green-blue); }
.lesson-badge.vocabulary { background: #6c5ce7; }

.lesson-row-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.lesson-row-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.lesson-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lesson-row.viewed,
.item-card.viewed,
.tree-card.viewed {
    border: 1px solid rgba(76, 175, 80, 0.35);
}

.lesson-badge.done {
    background: var(--green) !important;
}

.progress-bar-wrap {
    position: relative;
    height: 6px;
    background: var(--gray-light);
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
}

.progress-bar-wrap.completed .progress-bar-fill {
    background: var(--green);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green-blue));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-bar-label {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    text-align: left;
}

.progress-done-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green);
    color: var(--white);
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.progress-done-badge.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tree-card {
    position: relative;
}

.tree-card .progress-bar-wrap {
    width: 100%;
    margin-top: 4px;
}

.item-card .progress-bar-wrap {
    margin-top: 8px;
}

.lesson-row .progress-bar-wrap {
    max-width: 100%;
}

.lesson-row .progress-done-badge {
    margin-right: 4px;
}

/* Flashcard / Video viewer */
.viewer-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100vh - 120px);
}

.viewer-media {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    overflow: hidden;
}

.viewer-media img {
    max-width: 85%;
    max-height: 240px;
    object-fit: contain;
}

.viewer-media video,
.viewer-media audio {
    width: 100%;
}

.viewer-media:has(.native-video-controls),
.player-media:has(.native-video-controls) {
    overflow: visible;
}

.native-video-controls {
    pointer-events: auto;
    touch-action: manipulation;
}

.native-video-controls::-webkit-media-controls {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.native-video-controls::-webkit-media-controls-enclosure {
    overflow: visible !important;
}

.native-video-controls::-webkit-media-controls-panel {
    display: flex !important;
}

.native-video-controls::-webkit-media-controls-fullscreen-button {
    display: flex !important;
}

body.messenger-mini-app .native-video-controls::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

.viewer-text-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-color: gold;
    background: linear-gradient(135deg, #fffde7, #ffe89d);
}

.viewer-text-en {
    font-size: 20px;
    font-weight: bold;
    color: var(--blue);
    direction: ltr;
    text-align: left;
}

.viewer-text-fa {
    font-size: 16px;
    color: var(--text);
    direction: rtl;
    text-align: right;
}

/* Video viewer */
.video-step-hint {
    background: #e3f2fd;
    color: var(--text);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.7;
    text-align: center;
}

.video-step-hint-sub {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.video-viewer {
    min-height: 0;
    gap: 12px;
}

.video-viewer .viewer-media {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    padding: 4px 0;
    overflow: visible;
}

.video-viewer .viewer-media video {
    max-height: min(56vw, 360px);
    width: 100%;
    border-radius: var(--image-radius);
    display: block;
}

.viewer-media:fullscreen,
.viewer-media:-webkit-full-screen,
.player-media:fullscreen,
.player-media:-webkit-full-screen {
    background: #000;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-media:fullscreen video,
.viewer-media:-webkit-full-screen video,
.player-media:fullscreen video,
.player-media:-webkit-full-screen video {
    max-height: 100vh;
    max-width: 100vw;
    width: 100%;
    height: auto;
    border-radius: 0;
    object-fit: contain;
}

.viewer-media video:fullscreen,
.viewer-media video:-webkit-full-screen,
.player-media video:fullscreen,
.player-media video:-webkit-full-screen {
    background: #000;
    border-radius: 0;
    max-height: 100%;
    max-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Fallback for in-app WebViews that block the Fullscreen API */
.viewer-media.video-pseudo-fullscreen,
.player-media.video-pseudo-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
    border-radius: 0 !important;
    z-index: 100000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.viewer-media.video-pseudo-fullscreen video,
.player-media.video-pseudo-fullscreen video,
.video-viewer .viewer-media.video-pseudo-fullscreen video,
.player-container--video .player-media.video-pseudo-fullscreen video {
    max-height: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 0 !important;
    object-fit: contain;
}

/* Landscape rotation for portrait phones inside messenger WebViews */
.viewer-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape,
.player-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape {
    inset: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: 100vh !important;
    height: 100vw !important;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    padding: env(safe-area-inset-right) env(safe-area-inset-top) env(safe-area-inset-left) env(safe-area-inset-bottom) !important;
}

.viewer-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape video,
.player-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape video,
.video-viewer .viewer-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape video,
.player-container--video .player-media.video-pseudo-fullscreen.video-pseudo-fullscreen-landscape video {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    max-width: 100% !important;
    object-fit: contain;
}

.video-pseudo-fs-close {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    z-index: 100002;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.video-pseudo-fs-close:active {
    background: rgba(0, 0, 0, 0.75);
}

.video-pseudo-fs-close[hidden] {
    display: none !important;
}

body.video-pseudo-fullscreen-landscape .video-pseudo-fs-close {
    top: calc(12px + env(safe-area-inset-right));
    right: calc(12px + env(safe-area-inset-top));
}

body.video-pseudo-fullscreen-active {
    overflow: hidden;
}

body.video-pseudo-fullscreen-active .app-header,
body.video-pseudo-fullscreen-active .app-bottom-nav,
body.video-pseudo-fullscreen-active .app-nav--sidebar,
body.video-pseudo-fullscreen-active .viewer-text-row,
body.video-pseudo-fullscreen-active .video-step-hint,
body.video-pseudo-fullscreen-active .card-counter,
body.video-pseudo-fullscreen-active .player-title,
body.video-pseudo-fullscreen-active .player-visual {
    visibility: hidden;
}

body.video-pseudo-fullscreen-active .viewer-toolbar,
body.video-pseudo-fullscreen-active .player-toolbar {
    display: none !important;
}

/* Vocabulary section */
.vocab-viewer {
    min-height: 0;
    gap: 12px;
}

.vocab-viewer .viewer-media {
    flex: 0 0 auto;
    min-height: 100px;
    height: 110px;
    max-height: 110px;
}

.vocab-audio-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    border-radius: var(--radius);
}

.vocab-speaker-icon {
    font-size: 52px;
    line-height: 1;
    transition: transform 0.2s;
}

.vocab-speaker-icon.playing {
    animation: vocab-pulse 0.8s ease-in-out infinite;
}

@keyframes vocab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.vocab-grade-icon {
    font-size: 48px;
    line-height: 1;
    padding: 16px 0 8px;
}

.vocab-tree-card .tree-card-title {
    padding-bottom: 4px;
}

.tree-card-meta,
.lesson-row-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.vocab-word-display {
    font-size: 22px;
    font-weight: bold;
    color: var(--text);
    direction: rtl;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-toolbar {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 12px;
    background: #ffebc7;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.toolbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom:20px;
}

.toolbar-label {
    font-size: 10px;
    font-weight: 300;
    color: var(--text-light);
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.toolbar-nav-group {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-right: 60px;
}

.toolbar-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #4bd590;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
}

.toolbar-btn:hover:not(:disabled) {
    background: var(--orange);
    transform: scale(1.05);
}

.toolbar-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
    opacity: 0.5;
}

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

.toolbar-btn-nav {
    background: linear-gradient(180deg, #fff648 0%, #feff00 100%);
    color: #14532D;
    box-shadow: 0 2px 6px rgba(20, 83, 45, 0.18);
    border: 1px solid rgba(20, 83, 45, 0.14);
}

.toolbar-btn .toolbar-icon,
.toolbar-btn-nav .toolbar-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.toolbar-btn-nav:hover:not(:disabled) {
    background: linear-gradient(180deg, #C0E8CC 0%, #8FD4A4 100%);
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(20, 83, 45, 0.22);
}

.toolbar-btn-nav:disabled {
    background: #E4EDE7;
    color: #7A9484;
    border-color: rgba(20, 83, 45, 0.08);
    box-shadow: none;
    opacity: 1;
}

/* Player page */
.player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px 16px;
}

.player-container--video {
    gap: 12px;
    padding: 12px 8px;
}

.player-visual {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--yellow));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: var(--shadow);
}

.player-visual.hidden {
    display: none;
}

.player-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.player-media {
    width: 100%;
    max-width: 100%;
}

.player-container--video .player-media {
    max-width: 100%;
    overflow: visible;
}

.player-media video {
    background: #000;
    min-height: 200px;
    max-height: min(56vw, 360px);
    object-fit: contain;
}

.media-protected,
.media-protect-active .viewer-media,
.media-protect-active .player-media {
    -webkit-user-select: none;
    user-select: none;
}

.player-media video,
.player-media audio {
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
}

.player-media audio {
    min-height: 48px;
}

.player-toolbar {
    width: 100%;
    max-width: 360px;
}

/* About page */
.about-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    line-height: 1.8;
    font-size: 15px;
}

.about-content h2 {
    color: var(--orange);
    margin-bottom: 16px;
    font-size: 20px;
}

.about-content p {
    margin-bottom: 12px;
    color: var(--text);
}

.about-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.about-links a {
    color: var(--blue);
    text-decoration: none;
    padding: 10px 14px;
    background: var(--gray-light);
    border-radius: 8px;
}

.about-links a:hover {
    background: var(--orange);
    color: var(--white);
}

/* Home welcome */
.welcome-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s;
}

.quick-link:hover {
    transform: translateX(-4px);
    color: var(--orange-dark);
}

.quick-link-icon {
    font-size: 32px;
}

.quick-link-text {
    flex: 1;
}

.quick-link-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 2px;
}

.quick-link-text span {
    font-size: 12px;
    color: var(--text-light);
}

/* Loading & empty states */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.error-state {
    background: #ffebee;
    color: #c62828;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.card-counter {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
}

/* Auth & shop */
.auth-form, .shop-notice, .payment-result {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.auth-hint {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: "IRANSans", Tahoma, sans-serif;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.captcha-row img {
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--orange);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
}

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

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: var(--gray-light);
    color: var(--text);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.plan-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px;
    background: var(--white);
    border: 2px solid var(--orange);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
}

.plan-btn strong {
    font-size: 16px;
    color: var(--text);
}

.plan-discount-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.plan-original-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.plan-final-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--orange-dark);
}

.payment-success {
    text-align: center;
    padding: 32px 16px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.user-bar {
    flex-shrink: 0;
}

.user-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-bar-link {
    color: var(--orange);
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid var(--orange);
    border-radius: 8px;
    white-space: nowrap;
}

.user-bar-profile {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.user-bar-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--orange);
}

.sub-badge {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 6px;
    background: var(--yellow);
    color: var(--text);
    text-decoration: none;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
    line-height: 1.2;
}

.sub-badge.active {
    background: var(--green);
    color: var(--white);
}

.sub-badge.active {
    background: var(--green);
    color: var(--white);
}

.gamif-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    line-height: 1.2;
}

.gamif-badge-emoji {
    font-size: 18px;
    line-height: 1;
}

.gamif-streak {
    background: #fffde7;
    color: #f57f17;
}

.gamif-coins {
    background: #fff8e1;
    color: #f57f17;
}

.gamif-goal {
    background: #e8f5e9;
    color: #2e7d32;
}

.gamif-goal.is-done {
    background: #c8e6c9;
}

.daily-goal-card {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #c8e6c9;
}

.daily-goal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.daily-goal-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
}

.daily-goal-status {
    font-size: 14px;
    font-weight: bold;
    color: #558b2f;
}

.daily-goal-status.is-done {
    color: #2e7d32;
}

.daily-goal-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 8px;
    line-height: 1.5;
}

.daily-goal-bar {
    height: 8px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #c8e6c9;
}

.daily-goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #81c784, #66bb6a);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.daily-goal-bar-fill.is-done {
    background: linear-gradient(90deg, #43a047, #2e7d32);
}

.profile-avatar-sublabel {
    font-size: 11px;
    color: #999;
    margin: 8px 0 4px;
}

.profile-gamif-stats {
    margin-bottom: 16px;
}

.profile-gamif-card {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
    border-radius: var(--radius);
    padding: 12px 8px;
    border: 1px solid #ffe0b2;
}

.profile-gamif-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profile-gamif-icon {
    font-size: 22px;
    line-height: 1;
}

.profile-gamif-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
}

.profile-gamif-label {
    font-size: 10px;
    color: #888;
}

.profile-form {
    background: #fbddef;
    border-radius: var(--radius);
    padding: 16px 16px 0;
    box-shadow: var(--shadow);
}

.profile-body {
    padding-bottom: 8px;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--orange);
}

.profile-avatar-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
    padding: 2px;
    margin-bottom: 4px;
}

.avatar-grid--classic {
    max-height: 200px;
}

.avatar-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 0;
    background: var(--gray-light);
    overflow: hidden;
}

.avatar-cell.is-selected {
    border-color: var(--orange);
    background: #fff3e0;
}

.avatar-cell.is-locked .avatar-option {
    opacity: 0.45;
    filter: grayscale(0.6);
}

.avatar-cell .avatar-option {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
    padding: 2px;
    background: transparent;
    pointer-events: none;
}

.avatar-lock {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}

.avatar-price {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 8px;
    font-weight: bold;
    text-align: center;
    background: rgba(0, 0, 0, 0.65);
    color: #ffd54f;
    padding: 2px 0;
    line-height: 1.2;
}

.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 2px;
    background: var(--gray-light);
}

.avatar-option.selected {
    border-color: var(--orange);
    background: #fff3e0;
}

.profile-actions {
    position: sticky;
    bottom: 0;
    margin: 12px -16px 0;
    padding: 12px 16px;
    background: var(--white);
    border-top: 2px solid var(--orange);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

.btn-save-profile {
    margin-top: 0;
    padding: 16px;
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.35);
}

.otp-timer {
    text-align: center;
    font-size: 18px;
    color: var(--text-light);
    margin: 12px 0;
}

/* Flashcard games */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-intro {
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

.game-hint {
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    color: var(--orange-dark);
    min-height: 24px;
}

.game-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-start-btn,
.game-repeat-btn {
    margin-top: 0;
}

.game-container.game-pending .game-grid {
    opacity: 0.55;
    pointer-events: none;
}

.game-container.game-pending .game-cell {
    cursor: default;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

@media (min-width: 480px) {
    .game-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

.game-cell {
    position: relative;
    aspect-ratio: 2 / 1;
    max-height: 72px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    background: var(--white);
    padding: 6px 8px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(14px, 3.8vw, 18px);
    font-weight: bold;
    color: var(--blue);
    direction: ltr;
}

.game-cell.static {
    cursor: default;
}

.game-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.game-cell-ok {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(76, 175, 80, 0.75);
    color: var(--white);
    font-size: 24px;
    align-items: center;
    justify-content: center;
}

.game-cell.matched .game-cell-ok {
    display: flex;
}

.game-cell.matched {
    border-color: var(--green);
}

.game-cell:active:not(.static):not(.matched) {
    transform: scale(0.96);
    border-color: var(--orange);
}

.game-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.game-dialog {
    background: var(--white);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-dialog.victory {
    border-top: 5px solid var(--green);
}

.game-dialog.defeat {
    border-top: 5px solid var(--gray);
}

.game-dialog-emoji {
    font-size: 56px;
    margin-bottom: 8px;
}

.game-dialog h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text);
}

.game-stars {
    font-size: 28px;
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.game-score {
    font-size: 22px;
    font-weight: bold;
    color: var(--orange-dark);
    margin-bottom: 12px;
}

.game-coins-reward {
    font-size: 18px;
    font-weight: bold;
    color: var(--green);
    margin-bottom: 8px;
}

.game-streak-bonus {
    font-size: 14px;
    font-weight: bold;
    color: var(--orange-dark);
    margin-bottom: 16px;
}

.game-dialog .game-dialog-close {
    margin-top: 4px;
}

.viewer-toolbar a.toolbar-btn {
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 6px rgba(20, 83, 45, 0.18);
}

/* Fill-blank game */
.fill-blank-progress {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--orange-dark);
}

.fill-blank-image-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    aspect-ratio: 3 / 2;
    max-height: 120px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
    font-size: 22px;
    font-weight: bold;
    color: var(--blue);
}

.fill-blank-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fill-blank-word {
    text-align: center;
    direction: ltr;
    unicode-bidi: isolate;
    min-height: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
}

.fill-blank-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 46px;
    border: 2px solid #d8dce8;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff 0%, #f4f6fb 100%);
    box-shadow: 0 2px 6px rgba(63, 81, 181, 0.1);
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
    text-transform: lowercase;
    line-height: 1;
    flex-shrink: 0;
}

.fill-blank-char.blank {
    background: rgba(255, 157, 0, 0.07);
    border: 2px dashed var(--orange);
    border-bottom: 3px solid var(--orange-dark);
    color: transparent;
    box-shadow: 0 2px 6px rgba(255, 157, 0, 0.12);
}

.fill-blank-char.filled {
    background: rgba(76, 175, 80, 0.14);
    border: 2px solid var(--green);
    color: var(--green);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
    animation: fill-blank-pop 0.28s ease;
}

.fill-blank-gap {
    display: inline-block;
    width: 10px;
    flex-shrink: 0;
}

.fill-blank-punct {
    font-size: 22px;
    font-weight: 700;
    color: var(--blue);
    line-height: 1;
    align-self: center;
    flex-shrink: 0;
}

@keyframes fill-blank-pop {
    0% { transform: scale(0.88); }
    55% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.fill-blank-image-wrap.fill-blank-audio-only {
    font-size: 48px;
    background: rgba(255, 152, 0, 0.08);
}

.fill-blank-actions {
    justify-content: center;
    margin-bottom: 4px;
}

.fill-blank-hint {
    text-align: center;
    font-size: 15px;
    color: var(--text-light);
    min-height: 22px;
}

.fill-blank-choices {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.fill-blank-choice {
    min-width: 44px;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    background: var(--white);
    font-size: 18px;
    font-weight: bold;
    color: var(--blue);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s, opacity 0.15s;
    direction: ltr;
    text-transform: lowercase;
}

.fill-blank-choice:active:not(:disabled) {
    transform: scale(0.97);
    border-color: var(--orange);
}

.fill-blank-choice.correct {
    border-color: var(--green);
    background: rgba(76, 175, 80, 0.12);
    color: var(--green);
}

.fill-blank-choice.used {
    opacity: 0.35;
    cursor: default;
}

.fill-blank-choice.wrong {
    border-color: #e53935;
    background: rgba(229, 57, 53, 0.08);
    color: #c62828;
    opacity: 0.7;
}

.fill-blank-choice:disabled {
    cursor: default;
}

/* Meaning / spelling choice games */
.choice-game-progress {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--orange-dark);
}

.choice-game-prompt {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    min-height: 0;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    background: var(--white);
    font-size: 20px;
    font-weight: bold;
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.25;
}

.choice-game-hint {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    min-height: 20px;
}

.choice-game-actions {
    justify-content: center;
    margin-bottom: 4px;
}

.choice-game-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.choice-game-btn {
    padding: 8px 6px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    background: var(--white);
    font-size: 14px;
    font-weight: bold;
    color: var(--blue);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s, opacity 0.15s;
    min-height: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    text-align: center;
}

.choice-game-btn.meaning-choice {
    direction: rtl;
    color: var(--text);
}

.choice-game-btn.spelling-choice {
    direction: ltr;
    text-transform: capitalize;
}

.choice-game-btn:active:not(:disabled) {
    transform: scale(0.97);
    border-color: var(--orange);
}

.choice-game-btn.correct {
    border-color: var(--green);
    background: rgba(76, 175, 80, 0.12);
    color: var(--green);
}

.choice-game-btn.wrong {
    border-color: #e53935;
    background: rgba(229, 57, 53, 0.08);
    color: #c62828;
    opacity: 0.7;
}

.choice-game-btn:disabled {
    cursor: default;
}

/* Voice game */
.voice-timer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.voice-timer-bar-wrap {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.voice-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--orange), var(--yellow));
    transition: width 1s linear;
    border-radius: 4px;
}

.voice-timer span {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}

.voice-score {
    text-align: center;
    font-size: 16px;
}

.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.mic-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: var(--green);
    font-size: 32px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.15s, background 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.mic-btn.recording {
    background: #e53935;
    transform: scale(1.08);
}

.speech-text {
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
    min-height: 20px;
    direction: ltr;
    line-height: 1.5;
    transition: color 0.15s;
}

.speech-text.is-listening {
    color: var(--green);
}

.speech-text.is-ok {
    color: var(--green);
    font-weight: 600;
}

.speech-text.is-wrong,
.speech-text.is-error {
    color: #c62828;
    font-weight: 500;
}

.voice-mode-notice {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #6d4c00;
    text-align: center;
}

.voice-type-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.voice-type-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    font-size: 16px;
    direction: ltr;
    text-align: left;
}

.voice-type-input:focus {
    outline: none;
    border-color: var(--orange);
}

.voice-type-controls .btn-primary {
    margin-top: 0;
}

.english-toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 360px);
    pointer-events: none;
}

.english-toast {
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--white);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
    cursor: pointer;
}

.english-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.english-toast--success {
    background: var(--green);
}

.english-toast--error {
    background: #e53935;
}

.english-toast--warning {
    background: var(--orange);
}

/* Badges */
.profile-leaderboard-link {
    display: block;
    text-align: center;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff8e1, #ffe082);
    border: 1px solid #ffd54f;
    color: var(--text);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}

.profile-leaderboard-link:hover {
    background: #ffe082;
}

.badges-section {
    margin-bottom: 16px;
}

.badge-count {
    font-size: 11px;
    color: #888;
    font-weight: normal;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 8px;
    background: var(--gray-light);
    border: 1px solid #e0e0e0;
    text-align: center;
}

.badge-item.is-earned {
    background: #fff8e1;
    border-color: #ffd54f;
}

.badge-item.is-locked {
    opacity: 0.55;
}

.badge-emoji {
    font-size: 22px;
    line-height: 1;
}

.badge-title {
    font-size: 9px;
    color: var(--text);
    line-height: 1.3;
}

.game-badge-earned {
    font-size: 14px;
    font-weight: bold;
    color: #6a1b9a;
    margin-bottom: 8px;
}

/* Leaderboard */
.loading-inline {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
}

.leaderboard-hero {
    text-align: center;
    margin-bottom: 16px;
}

.leaderboard-hero-icon {
    font-size: 48px;
    line-height: 1;
}

.leaderboard-hero-title {
    font-size: 20px;
    margin: 8px 0 4px;
    color: var(--text);
}

.leaderboard-week-label {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.leaderboard-login-prompt {
    text-align: center;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff3e0;
    border-radius: var(--radius);
}

.leaderboard-optin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.leaderboard-optin-text strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.leaderboard-optin-text p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    right: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--green);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(-20px);
}

.leaderboard-my-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: var(--radius);
    border: 1px solid #a5d6a7;
}

.leaderboard-my-rank-label {
    font-size: 12px;
    color: #555;
}

.leaderboard-my-rank-value {
    font-size: 24px;
    font-weight: bold;
    color: #2e7d32;
}

.leaderboard-my-rank-score {
    font-size: 16px;
    font-weight: bold;
    color: #f57f17;
}

.leaderboard-my-rank-hint {
    font-size: 11px;
    color: #666;
    width: 100%;
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.leaderboard-row.is-me {
    background: #fff8e1;
    border: 2px solid #ffd54f;
}

.leaderboard-rank {
    width: 28px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.leaderboard-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--orange);
    flex-shrink: 0;
}

.leaderboard-name {
    flex: 1;
    font-size: 14px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-size: 13px;
    font-weight: bold;
    color: #f57f17;
    flex-shrink: 0;
}

.empty-leaderboard {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

/* Streak banner & missions */
.streak-banner {
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fffde7, #fff9c4);
    border: 1px solid #fff176;
    overflow: hidden;
}

.streak-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.streak-banner-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.streak-banner-content strong {
    display: block;
    font-size: 14px;
    color: #f57f17;
}

.streak-banner-content p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #666;
}

.streak-banner-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #fff176;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
}

.missions-card {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #5fe1c9, #e8eaf6);
    border: 1px solid #80b9c1;
}

.missions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.missions-title {
    font-size: 14px;
    font-weight: bold;
}

.missions-reward {
    font-size: 12px;
    color: #65026b;
    font-weight: bold;
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mission-item {
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.7);
}

.mission-item.is-done {
    color: #2e7d32;
    text-decoration: line-through;
    opacity: 0.8;
}

.missions-done-msg {
    margin: 8px 0 0;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #2e7d32;
}

.quick-link--course {
    border: 2px solid #3fbdbf;
    background: linear-gradient(135deg, #fffde7, #4ee7bd);
}

.quick-link--vocabulary {
    border: 2px solid #8be95f;
    background: linear-gradient(135deg, #fffde7, #c3ff82);
}

.quick-link--flashcards {
    border: 2px solid gold;
    background: linear-gradient(135deg, #fffde7, #ffe082);
}

.quick-link--videos {
    border: 2px solid gold;
    background: linear-gradient(135deg, #fffde7, #ff7600);
}

.quick-link--shop {
    border: 2px solid gold;
    background: linear-gradient(135deg, #fffde7, #ffc300);
}

.profile-coin-shop-link {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #90caf9;
}

.push-optin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: var(--shadow);
}

.push-optin-text strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.push-optin-text p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Coin shop */
.coin-shop-hero {
    text-align: center;
    margin-bottom: 16px;
}

.coin-shop-hero h2 {
    margin: 0 0 4px;
    font-size: 22px;
}

.coin-shop-hero p {
    margin: 0 0 8px;
    color: #666;
    font-size: 13px;
}

.coin-shop-balance {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff8e1;
    border: 1px solid #ffd54f;
    font-size: 16px;
}

.coin-shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.coin-shop-item {
    padding: 14px 10px;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coin-shop-item-emoji {
    font-size: 40px;
    line-height: 1;
}

.coin-shop-item h3 {
    margin: 0;
    font-size: 16px;
}

.coin-shop-item p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    flex: 1;
}

.coin-shop-owned {
    font-size: 13px;
    color: #888;
}

.coin-shop-buy {
    font-size: 14px;
    padding: 10px;
    width: 100%;
}

.coin-shop-buy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game tools */
.game-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

.game-tool-btn {
    font-size: 12px;
    padding: 6px 10px;
}

.game-tool-shop {
    font-size: 14px;
    color: var(--orange);
    text-decoration: none;
    padding: 8px 10px;
    align-self: center;
}

.game-cell.eliminated {
    opacity: 0.2;
    pointer-events: none;
    filter: grayscale(1);
}

.fill-blank-choice.eliminated,
.choice-game-btn.eliminated {
    opacity: 0.2;
    pointer-events: none;
    filter: grayscale(1);
}

.game-cell-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
}

/* Friends & social */
.friends-hero {
    text-align: center;
    padding: 16px 12px 8px;
}

.friends-hero-icon {
    font-size: 40px;
    line-height: 1;
}

.friends-hero-title {
    margin: 8px 0 4px;
    font-size: 20px;
    color: var(--blue);
}

.friends-week-label {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.friends-login-prompt {
    text-align: center;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius);
    margin: 12px;
}

.friends-invite-card,
.friends-optin-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.friends-optin-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.friends-invite-text strong,
.friends-optin-text strong {
    display: block;
    font-size: 14px;
}

.friends-invite-text p,
.friends-optin-text p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #666;
}

.friends-invite-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.friends-messenger-tabs {
    display: flex;
    gap: 8px;
}

.friends-messenger-tab {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
}

.friends-messenger-tab.active {
    border-color: var(--primary, #4a90d9);
    background: #f0f7ff;
    font-weight: 600;
}

.friends-invite-input {
    flex: 1;
    font-size: 11px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    direction: ltr;
    text-align: left;
}

.friends-copy-btn {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
}

.friends-count-label {
    font-size: 11px;
    color: #888;
    margin: 0;
    text-align: center;
}

.friends-section {
    margin: 16px 12px;
}

.friends-section-title {
    font-size: 15px;
    margin: 0 0 8px;
    color: var(--blue);
}

.friends-section-hint {
    font-size: 11px;
    color: #888;
    margin: 0 0 10px;
}

.friends-empty {
    text-align: center;
    font-size: 13px;
    color: #888;
    padding: 12px;
}

.friends-streak-list,
.friends-list,
.friends-challenge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friends-streak-row,
.friends-row,
.friends-challenge-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.friends-streak-row.is-me,
.friends-challenge-row.leading {
    border: 2px solid var(--orange);
}

.friends-challenge-row.behind {
    opacity: 0.85;
}

.friends-streak-rank {
    font-weight: 700;
    font-size: 13px;
    min-width: 28px;
    text-align: center;
}

.friends-streak-avatar,
.friends-avatar,
.friends-challenge-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.friends-streak-name,
.friends-name,
.friends-challenge-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friends-streak-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--orange);
}

.friends-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.friends-streak {
    font-size: 12px;
    color: #888;
}

.friends-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.friends-challenge-btn {
    font-size: 11px;
    padding: 6px 8px;
}

.friends-remove-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.friends-challenge-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.friends-challenge-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    display: inline-block;
    width: fit-content;
}

.friends-challenge-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.friends-challenge-badge.waiting {
    background: #e8f4fd;
    color: #0c5460;
}

.friends-challenge-badge.active {
    background: #d4edda;
    color: #155724;
}

.friends-challenge-scores {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
}

.friends-accept-btn {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
}
