/* ==========================================================================
   Mackenzie English — Practice Games & Definle Stylesheet
   ========================================================================== */

:root {
    --color-correct: #2e7d32;
    --color-correct-glow: rgba(46, 125, 50, 0.4);
    --color-present: #d97706;
    --color-present-glow: rgba(217, 119, 6, 0.4);
    --color-absent: #4b5563;
    --color-tile-border: #d1d5db;
    --color-tile-active-border: #1b263b;
    --color-tile-bg: #ffffff;
    --color-game-bg: #f8fafc;
    --color-key-bg: #e2e8f0;
    --color-key-text: #1e293b;
    --radius-tile: 8px;
    --radius-card: 14px;
    --radius-btn: 8px;
}

/* Practice Games Hub Page */
.games-hub-hero {
    background: linear-gradient(135deg, #1B263B 0%, #0F172A 60%, #1E293B 100%);
    color: #ffffff;
    padding: 4.5rem 1.5rem 3.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.games-hub-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: rgba(212, 175, 55, 0.18);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 999px;
    color: var(--color-gold);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.games-hub-hero h1 {
    color: #ffffff;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.games-hub-hero p {
    font-size: 1.15rem;
    max-width: 780px;
    margin: 0 auto 1.75rem;
    color: #e2e8f0;
    line-height: 1.6;
}

/* Introduction Section: Why Games for English */
.games-pedagogy-section {
    padding: 4.5rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.section-header-center {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
}

.section-header-center .sub-tag {
    color: var(--color-gold);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 0.5rem;
}

.section-header-center h2 {
    font-size: 2.2rem;
    color: var(--color-navy);
    margin-bottom: 1rem;
}

.section-header-center p {
    font-size: 1.05rem;
    color: #4b5563;
    line-height: 1.7;
}

.pedagogy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.pedagogy-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-card);
    padding: 2rem 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.pedagogy-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(27, 38, 59, 0.08);
    border-color: rgba(212, 175, 55, 0.5);
}

.pedagogy-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.15);
    color: #b48608;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
}

.pedagogy-card h3 {
    font-size: 1.25rem;
    color: var(--color-navy);
    margin-bottom: 0.75rem;
}

.pedagogy-card p {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.6;
}

/* Games Catalog Section */
.games-catalog-section {
    padding: 4.5rem 1.5rem;
    background: #f8fafc;
}

.games-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Featured Game Card - Definle */
.game-card-featured {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #ffffff 0%, #fdfbf7 100%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 900px) {
    .game-card-featured {
        grid-template-columns: 1fr;
    }
}

.game-card-featured:hover {
    box-shadow: 0 16px 36px rgba(212, 175, 55, 0.2);
    transform: translateY(-3px);
}

.game-card-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.badge-flagship {
    background: var(--color-navy);
    color: var(--color-gold);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-tag {
    background: #e2e8f0;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
}

.badge-cefr {
    background: rgba(46, 125, 50, 0.15);
    color: #1b5e20;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
}

.game-card-title {
    font-size: 2rem;
    color: var(--color-navy);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-card-tagline {
    font-size: 1.05rem;
    color: #64748b;
    font-style: italic;
    margin-bottom: 1.25rem;
}

.game-card-desc {
    font-size: 1rem;
    color: #334155;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.game-skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
}

.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.game-card-preview {
    background: linear-gradient(135deg, #1B263B 0%, #111827 100%);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    position: relative;
}

/* Interactive Definle Mini Preview in Hub */
.definle-mini-demo {
    width: 100%;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(8px);
}

.mini-clue-box {
    background: rgba(212, 175, 55, 0.15);
    border-left: 3px solid var(--color-gold);
    padding: 0.6rem 0.85rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #f8fafc;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.mini-grid-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 6px;
}

.mini-tile {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 6px;
    text-transform: uppercase;
    color: #ffffff;
}

.mini-tile.correct {
    background: var(--color-correct);
}

.mini-tile.present {
    background: var(--color-present);
}

.mini-tile.absent {
    background: var(--color-absent);
}

.mini-tile.empty {
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
}

/* Standard Teaser Cards */
.game-card-teaser {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-card);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-card-teaser::after {
    content: "Coming Soon";
    position: absolute;
    top: 18px;
    right: -30px;
    background: #cbd5e1;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 35px;
    transform: rotate(45deg);
    letter-spacing: 0.05em;
}

.game-card-teaser:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
}

.teaser-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #f1f5f9;
    color: var(--color-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.game-card-teaser h3 {
    font-size: 1.35rem;
    color: var(--color-navy);
    margin-bottom: 0.5rem;
}

.game-card-teaser p {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   DEFINLE GAME PLAY INTERFACE
   ========================================================================== */

.definle-app-wrapper {
    min-height: 100vh;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
}

.definle-top-bar {
    background: var(--color-navy);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.definle-brand-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-gold);
}

.definle-brand-title a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.definle-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.icon-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--color-gold);
    color: var(--color-gold);
}

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

/* Main Game Play Container */
.definle-game-container {
    flex: 1;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Control Pills & Modes */
.definle-controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mode-toggle-group {
    display: inline-flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
}

.mode-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: #475569;
    transition: background 0.2s, color 0.2s;
}

.mode-btn.active {
    background: var(--color-navy);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.filter-select {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--color-navy);
    font-weight: 500;
    cursor: pointer;
}

/* Clue & Definition Box */
.definle-clue-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 4px solid var(--color-gold);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.clue-meta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.clue-badge-pos {
    background: rgba(27, 38, 59, 0.08);
    color: var(--color-navy);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.clue-badge-level {
    background: rgba(46, 125, 50, 0.12);
    color: #1b5e20;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.clue-badge-length {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.clue-definition-text {
    font-size: 1.05rem;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.clue-example-wrap {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-style: italic;
    border-left: 2px solid #cbd5e1;
    display: none;
}

.clue-toggle-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* Board Grid */
.definle-board-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    margin: 0.5rem 0 1rem;
}

.definle-board-grid {
    display: grid;
    gap: 8px;
    padding: 4px;
}

.definle-row {
    display: grid;
    gap: 8px;
}

.definle-tile {
    width: 54px;
    height: 54px;
    border: 2px solid var(--color-tile-border);
    border-radius: var(--radius-tile);
    background: var(--color-tile-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    user-select: none;
    perspective: 1000px;
    transition: transform 0.1s ease, border-color 0.15s ease;
}

@media (max-width: 480px) {
    .definle-tile {
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
    }
}

.definle-tile.pop {
    animation: popIn 0.12s ease-in-out;
    border-color: var(--color-tile-active-border);
}

.definle-tile.flip {
    animation: flipTile 0.5s ease forwards;
}

.definle-tile.correct {
    background-color: var(--color-correct) !important;
    border-color: var(--color-correct) !important;
    color: #ffffff !important;
}

.definle-tile.present {
    background-color: var(--color-present) !important;
    border-color: var(--color-present) !important;
    color: #ffffff !important;
}

.definle-tile.absent {
    background-color: var(--color-absent) !important;
    border-color: var(--color-absent) !important;
    color: #ffffff !important;
}

.shake-row {
    animation: shakeRow 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.bounce-row .definle-tile {
    animation: bounceTile 0.6s ease;
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.9); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes flipTile {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

@keyframes shakeRow {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes bounceTile {
    0%, 20% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    50% { transform: translateY(0); }
    60% { transform: translateY(-10px); }
    80%, 100% { transform: translateY(0); }
}

/* Virtual Onscreen Keyboard */
.definle-keyboard {
    width: 100%;
    margin-top: auto;
    user-select: none;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 6px;
    touch-action: manipulation;
}

.key-btn {
    background: var(--color-key-bg);
    color: var(--color-key-text);
    border: none;
    border-radius: 6px;
    height: 52px;
    flex: 1;
    min-width: 32px;
    max-width: 48px;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.15s, transform 0.05s, color 0.15s;
}

.key-btn.wide-key {
    flex: 1.5;
    max-width: 68px;
    font-size: 0.85rem;
}

.key-btn:active {
    transform: scale(0.94);
    opacity: 0.85;
}

.key-btn.correct {
    background: var(--color-correct);
    color: #ffffff;
}

.key-btn.present {
    background: var(--color-present);
    color: #ffffff;
}

.key-btn.absent {
    background: #334155;
    color: #ffffff;
    opacity: 0.7;
}

/* Toast Message */
.game-toast {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.game-toast.visible {
    opacity: 1;
}

/* Modals */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.game-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.game-modal-card {
    background: #ffffff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.3s ease-out;
}

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

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--color-navy);
    margin-bottom: 1rem;
    text-align: center;
}

/* Stats Modal Details */
.stats-grid-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    text-align: center;
    margin: 1.5rem 0;
}

.stat-item .stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-navy);
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.guess-dist-chart {
    margin: 1.5rem 0;
}

.dist-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.dist-bar {
    background: #94a3b8;
    color: #ffffff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    min-width: 20px;
    text-align: right;
    font-size: 0.8rem;
    transition: width 0.5s ease;
}

.dist-bar.highlight {
    background: var(--color-correct);
}

/* Victory Word Reveal Box */
.reveal-solution-box {
    background: #f8fafc;
    border: 2px dashed rgba(212, 175, 55, 0.6);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    margin: 1.25rem 0;
}

.reveal-word {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-navy);
    letter-spacing: 0.1em;
    margin-bottom: 0.35rem;
}

.reveal-pos-pill {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    color: #854d0e;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.reveal-def {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.reveal-sentence {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
}

.modal-actions-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions-row .btn {
    flex: 1;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 3000;
}
