/* ==================================================
   COURSORA TYPING SPEED GAME STYLES
================================================== */

.typing-game-body {
    background: #f5f8ff;
    color: #292d50;
    min-height: 100vh;
}

.active-nav-link {
    color: #625bc6 !important;
    background: #f0ecff !important;
    border-color: rgba(98, 91, 198, 0.25) !important;
}

/* ==================================================
   MAIN GAME WRAPPER
================================================== */
.game-wrapper {
    padding-top: 96px;
    padding-bottom: 70px;
    max-width: 1140px;
    margin: 0 auto;
    padding-inline: 4%;
}

/* ==================================================
   GOOGLE ADSENSE SLOTS
================================================== */
.ad-container {
    max-width: 960px;
    margin: 16px auto;
    text-align: center;
}

.top-ad-container {
    margin-top: 88px;
    margin-bottom: 12px;
}

.bottom-ad-container {
    margin-top: 50px;
    margin-bottom: 30px;
}

.ad-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #9aa0bc;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.ad-slot {
    background: #ffffff;
    border: 1.5px dashed #d5d1f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto;
}

.ad-slot-leaderboard {
    min-height: 90px;
    width: 100%;
    max-width: 728px;
}

.ad-slot-sidebar {
    min-height: 250px;
    width: 100%;
    max-width: 300px;
}

.ad-placeholder-content,
.ad-placeholder-sidebar {
    padding: 16px;
    color: #8c90ad;
    font-size: 12px;
    font-weight: 700;
}

/* ==================================================
   GAME HEADER
================================================== */
.game-header {
    text-align: center;
    max-width: 800px;
    margin: 20px auto 30px;
}

.game-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 6px 16px;
    border: 1.5px solid rgba(98, 91, 198, 0.25);
    border-radius: 999px;
    background: #ffffff;
    color: #625bc6;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(98, 91, 198, 0.08);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: dotPulse 1.8s infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.game-title {
    font-size: clamp(32px, 4.5vw, 52px);
    font-weight: 900;
    color: #202447;
    line-height: 1.15;
    letter-spacing: -1.5px;
    margin: 0 0 12px 0;
}

.gradient-text {
    display: inline-block;
    background: linear-gradient(135deg, #625bc6 0%, #2563eb 50%, #0d9488 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-subtitle {
    font-size: clamp(15px, 1.6vw, 17px);
    color: #5d617a;
    line-height: 1.6;
    margin: 0 auto;
    max-width: 680px;
}

/* ==================================================
   CONTROLS TOOLBAR
================================================== */
.controls-toolbar {
    background: #ffffff;
    border: 1.5px solid #e7e3ff;
    border-radius: 20px;
    padding: 14px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 6px 20px rgba(98, 91, 198, 0.06);
    margin-bottom: 24px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 13px;
    font-weight: 800;
    color: #646884;
}

.pill-group {
    display: inline-flex;
    background: #f0ecff;
    padding: 3px;
    border-radius: 14px;
    gap: 4px;
}

.pill-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #625bc6;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn:hover {
    color: #4b41b0;
}

.pill-btn.active {
    background: #625bc6;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(98, 91, 198, 0.35);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #f0ecff;
    border: 1px solid #dcd7fc;
    color: #625bc6;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-action-btn:hover {
    background: #e2dcfa;
    transform: scale(1.05);
}

.action-restart-btn {
    padding: 8px 18px;
    border-radius: 12px;
    background: #ffffff;
    border: 1.5px solid #625bc6;
    color: #625bc6;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-restart-btn:hover {
    background: #625bc6;
    color: #ffffff;
}

/* ==================================================
   LIVE STATS STRIP
================================================== */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1.5px solid #e7e3ff;
    border-radius: 18px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(98, 91, 198, 0.05);
    transition: transform 0.2s ease;
}

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

.stat-icon {
    font-size: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #f5f3ff;
}

.stat-timer .stat-icon { background: #e0f2fe; color: #0284c7; }
.stat-wpm .stat-icon { background: #f3e8ff; color: #9333ea; }
.stat-acc .stat-icon { background: #ecfdf5; color: #059669; }
.stat-correct .stat-icon { background: #f0fdf4; color: #16a34a; font-weight: 900; }
.stat-errors .stat-icon { background: #fef2f2; color: #dc2626; font-weight: 900; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-name {
    font-size: 11px;
    font-weight: 800;
    color: #8c90ad;
    letter-spacing: 1px;
}

.stat-val {
    font-size: 22px;
    font-weight: 900;
    color: #202447;
}

.stat-timer .stat-val.warning {
    color: #dc2626;
    animation: timerPulse 0.8s infinite alternate;
}

@keyframes timerPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

/* ==================================================
   TYPING ARENA & WORDS DISPLAY
================================================== */
.typing-arena {
    position: relative;
    background: #ffffff;
    border: 2px solid #e2ddff;
    border-radius: 28px;
    padding: 30px;
    box-shadow: 0 15px 45px rgba(98, 91, 198, 0.1);
    margin-bottom: 40px;
    overflow: hidden;
}

/* OVERLAY BEFORE START */
.arena-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.arena-overlay[hidden] {
    display: none;
    pointer-events: none;
}

.overlay-card {
    text-align: center;
    max-width: 440px;
}

.overlay-icon {
    font-size: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 6px 12px rgba(98, 91, 198, 0.2));
}

.overlay-card h2 {
    font-size: 24px;
    font-weight: 900;
    color: #202447;
    margin: 0 0 8px;
}

.overlay-card p {
    color: #646884;
    font-size: 14px;
    margin: 0 0 20px;
}

.big-start-button {
    padding: 14px 38px;
    border-radius: 30px;
    background: linear-gradient(135deg, #625bc6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(98, 91, 198, 0.4);
    transition: all 0.25s ease;
}

.big-start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(98, 91, 198, 0.55);
}

.shortcut-hint {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    color: #8c90ad;
}

.shortcut-hint kbd {
    background: #f0ecff;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #dcd7fc;
    font-family: inherit;
    font-weight: 700;
    color: #625bc6;
}

/* WORDS DISPLAY CONTAINER */
.words-container {
    height: 140px;
    overflow: hidden;
    position: relative;
    user-select: none;
    outline: none;
    cursor: text;
}

.words-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 14px;
    transition: transform 0.25s ease;
    line-height: 1.5;
}

.word {
    font-family: "Consolas", "Courier New", "SF Pro Mono", monospace;
    font-size: clamp(22px, 3.2vw, 30px);
    color: #8589a8;
    padding: 2px 4px;
    border-radius: 8px;
    transition: background 0.15s ease;
    display: inline-flex;
    letter-spacing: 1px;
}

.word.word-active {
    background: #f0ecff;
    color: #3b3f5c;
}

.word.word-correct {
    color: #16a34a;
}

.word.word-wrong {
    color: #dc2626;
    text-decoration: underline wavy #dc2626;
}

.char {
    position: relative;
    transition: color 0.1s ease;
}

.char.char-correct {
    color: #16a34a;
}

.char.char-wrong {
    color: #dc2626;
    background: #fee2e2;
    border-radius: 2px;
}

.char.char-extra {
    color: #b91c1c;
    background: #fecaca;
    opacity: 0.9;
}

/* Active blinking cursor on current character */
.char.char-cursor::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 2.5px;
    background: #625bc6;
    border-radius: 2px;
    animation: cursorBlink 0.9s infinite;
}

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

/* INPUT BAR */
.input-bar-wrap {
    position: relative;
    margin-top: 24px;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    font-size: 20px;
    color: #8c90ad;
    pointer-events: none;
}

.typing-input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border-radius: 20px;
    border: 2px solid #e0dcf8;
    background: #faf9ff;
    font-size: 18px;
    color: #202447;
    font-family: inherit;
    font-weight: 700;
    outline: none;
    transition: all 0.25s ease;
}

.typing-input:focus {
    border-color: #625bc6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(98, 91, 198, 0.16);
}

.mobile-tap-hint {
    display: none;
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    background: #f0ecff;
    border: 1px dashed #625bc6;
    color: #625bc6;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

/* ==================================================
   RESULT MODAL (GAME OVER)
================================================== */
.result-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 36, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.result-modal-backdrop[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.result-modal-card {
    background: #ffffff;
    border-radius: 28px;
    max-width: 520px;
    width: 100%;
    padding: 35px 30px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    border: 2px solid #e7e3ff;
    animation: modalPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-badge-icon {
    font-size: 54px;
    margin-bottom: 8px;
}

.result-modal-card h2 {
    font-size: 26px;
    font-weight: 900;
    color: #202447;
    margin: 0 0 6px;
}

.result-modal-card p {
    color: #646884;
    font-size: 14px;
    margin: 0 0 24px;
}

.result-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.result-stat-box {
    background: #faf9ff;
    border: 1.5px solid #ece7ff;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-stat-box.highlight-box {
    background: #f0ecff;
    border-color: #625bc6;
}

.res-label {
    font-size: 11px;
    font-weight: 800;
    color: #8c90ad;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.res-val {
    font-size: 26px;
    font-weight: 900;
    color: #202447;
}

.highlight-box .res-val {
    color: #625bc6;
    font-size: 32px;
}

.text-caps {
    text-transform: capitalize;
}

.text-errors {
    color: #dc2626;
}

.res-sub {
    font-size: 12px;
    color: #8c90ad;
    margin-top: 2px;
}

/* SAVE SCORE FORM */
.save-score-form {
    margin-bottom: 20px;
    text-align: left;
    background: #faf9ff;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #e7e3ff;
}

.save-score-form label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #454968;
    margin-bottom: 8px;
}

.save-input-group {
    display: flex;
    gap: 8px;
}

.save-input-group input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid #dcd7fc;
    font-size: 14px;
    font-weight: 700;
    color: #202447;
    outline: none;
}

.save-input-group input:focus {
    border-color: #625bc6;
}

.btn-save-score {
    padding: 10px 18px;
    border-radius: 12px;
    background: #10b981;
    color: #ffffff;
    border: none;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-save-score:hover {
    background: #059669;
}

.save-msg {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #10b981;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-play-again {
    flex: 1;
    padding: 12px 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, #625bc6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-play-again:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(98, 91, 198, 0.4);
}

.btn-close-modal {
    padding: 12px 20px;
    border-radius: 20px;
    background: #f0ecff;
    color: #625bc6;
    border: none;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.btn-close-modal:hover {
    background: #e2dcfa;
}

/* ==================================================
   LEADERBOARD SECTION
================================================== */
.leaderboard-section {
    margin-top: 30px;
}

.leaderboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.leaderboard-card {
    background: #ffffff;
    border: 1.5px solid #e7e3ff;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 8px 25px rgba(98, 91, 198, 0.06);
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.section-tag {
    font-size: 11px;
    font-weight: 800;
    color: #625bc6;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: 4px;
}

.leaderboard-header h2 {
    font-size: 22px;
    font-weight: 900;
    color: #202447;
    margin: 0;
}

.btn-clear-lb {
    padding: 6px 12px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid #ffccd0;
    color: #dc2626;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-lb:hover {
    background: #fee2e2;
}

.lb-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    background: #f4efff;
    padding: 4px;
    border-radius: 14px;
    flex-wrap: wrap;
}

.lb-tab {
    flex: 1;
    min-width: 70px;
    padding: 7px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #625bc6;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lb-tab.active {
    background: #ffffff;
    color: #625bc6;
    box-shadow: 0 2px 8px rgba(98, 91, 198, 0.18);
}

.table-wrap {
    overflow-x: auto;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.lb-table th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #8c90ad;
    text-transform: uppercase;
    border-bottom: 2px solid #f0ecff;
}

.lb-table td {
    padding: 12px 14px;
    font-size: 14px;
    color: #202447;
    border-bottom: 1px solid #f5f3ff;
}

.lb-table tr:hover td {
    background: #faf9ff;
}

.rank-badge {
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.diff-tag {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: capitalize;
}

.diff-easy { background: #dcfce7; color: #15803d; }
.diff-medium { background: #e0f2fe; color: #0369a1; }
.diff-hard { background: #fef2f2; color: #b91c1c; }

.empty-lb-msg {
    text-align: center;
    padding: 30px;
    color: #8c90ad;
    font-style: italic;
    font-size: 14px;
}

/* SIDEBAR & ADS */
.ad-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.typing-tip-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid #fde68a;
    border-radius: 20px;
    padding: 20px;
}

.tip-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.typing-tip-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 900;
    color: #92400e;
}

.typing-tip-card p {
    margin: 0;
    font-size: 13px;
    color: #b45309;
    line-height: 1.55;
}

/* ==================================================
   BENEFITS SECTION
================================================== */
.benefits-section {
    margin-top: 60px;
}

.benefits-title {
    text-align: center;
    font-size: 26px;
    font-weight: 900;
    color: #202447;
    margin-bottom: 30px;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.benefit-box {
    background: #ffffff;
    border: 1.5px solid #e7e3ff;
    border-radius: 20px;
    padding: 26px 22px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(98, 91, 198, 0.05);
}

.b-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
}

.benefit-box h3 {
    font-size: 17px;
    font-weight: 900;
    color: #202447;
    margin: 0 0 8px;
}

.benefit-box p {
    font-size: 13px;
    color: #646884;
    line-height: 1.6;
    margin: 0;
}

/* ==================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
================================================== */
@media (max-width: 850px) {
    .leaderboard-layout {
        grid-template-columns: 1fr;
    }

    .ad-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ad-slot-sidebar,
    .typing-tip-card {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 600px) {
    .controls-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        justify-content: space-between;
    }

    .toolbar-actions {
        justify-content: flex-end;
    }

    .typing-arena {
        padding: 20px 16px;
    }

    .words-container {
        height: 110px;
    }

    .word {
        font-size: 20px;
    }

    .mobile-tap-hint {
        display: block;
    }

    .result-stats-grid {
        grid-template-columns: 1fr;
    }
}

