:root {
    --bg: #05050f;
    --card-bg: rgba(14, 14, 30, 0.75);
    --text: #e8e8f0;
    --text-secondary: #a2a2c2;
    --accent-1: #6c5ce7;
    --accent-2: #00cec9;
    --accent-3: #fd79a8;
    --accent-4: #fdcb6e;
    --glow-1: rgba(108, 92, 231, 0.5);
    --glow-2: rgba(0, 206, 201, 0.5);
    --glow-3: rgba(253, 121, 168, 0.5);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 255, 255, 0.16);
    --radius-lg: 22px;
    --radius-md: 14px;
    --transition-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============ GLOBAL OVERRIDES FOR GYANEXIS INTEGRATION ============ */
html {
    background: #05050f !important;
    background-color: #05050f !important;
}

body#games-page:not(#home):not(#quiz-page),
body#play-page:not(#home):not(#quiz-page) {
    background: #05050f !important;
    background-color: #05050f !important;
    color: #e8e8f0 !important;
    font-family: 'Inter', 'Roboto', sans-serif !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body#games-page:not(#home):not(#quiz-page)::before,
body#games-page:not(#home):not(#quiz-page)::after,
body#play-page:not(#home):not(#quiz-page)::before,
body#play-page:not(#home):not(#quiz-page)::after {
    display: none !important;
    content: none !important;
    background: none !important;
}

/* Fix text and heading contrast for lobby and play pages */
body#games-page:not(#home):not(#quiz-page) :where(h1, h2, h3, h4, h5, h6, p, .subtitle, .coming-text, .btn-back-home, .filter-tag),
body#play-page:not(#home):not(#quiz-page) :where(h1, h2, h3, h4, h5, h6, p, .subtitle, .btn-close-modal, .stat-box, .control-help) {
    color: #e8e8f0 !important;
}

body#games-page:not(#home):not(#quiz-page) :where(main, .cards-grid) :where(h1, h2, .game-title),
body#play-page:not(#home):not(#quiz-page) :where(.play-container, .game-modal-inline) :where(h2, #modalGameTitle) {
    color: #ffffff !important;
}

/* Remove white box background and borders under GYANEXIS Arcade header */
body#games-page:not(#home):not(#quiz-page) .header,
body#play-page:not(#home):not(#quiz-page) .header {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

body#games-page:not(#home):not(#quiz-page) .header h1 {
    color: #ffffff !important;
    text-shadow: 0 0 20px rgba(0, 206, 201, 0.45) !important;
    background: none !important;
    -webkit-text-fill-color: #ffffff !important;
    background-clip: unset !important;
}

#games-page {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ GAMEPLAY PAGE STYLES ============ */
body#play-page:not(#home):not(#quiz-page) {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
}

.play-container {
    position: relative;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-modal-inline {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#play-page .game-modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    --game-stage-width: min(98vw, calc((100dvh - 130px) * 1.5), 1600px);
}

/* ============ ANIMATED BACKGROUND ============ */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

.bg-gradient-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 22s ease-in-out infinite;
}
.bg-gradient-orb.orb-1 {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, #6c5ce7 0%, transparent 70%);
    top: -10%;
    left: -8%;
}
.bg-gradient-orb.orb-2 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, #00cec9 0%, transparent 70%);
    bottom: -8%;
    right: -6%;
    animation-duration: 25s;
    animation-delay: -5s;
}
.bg-gradient-orb.orb-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #fd79a8 0%, transparent 70%);
    top: 40%;
    left: 55%;
    animation-duration: 27s;
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(60px, -40px) scale(1.1); }
    50% { transform: translate(-30px, 35px) scale(0.95); }
    75% { transform: translate(-45px, -25px) scale(1.05); }
}

/* ============ MAIN CONTAINER ============ */
.main-container {
    position: relative;
    z-index: 1;
    max-width: 1500px;
    margin: 0 auto;
    padding: 32px clamp(16px, 3vw, 42px) 80px;
}

/* ============ ARCADE TOP BAR ============ */
.arcade-top-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}
.btn-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s var(--transition-smooth);
}
.btn-back-home:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-glow);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.15);
    transform: translateX(-3px);
}

/* ============ HEADER ============ */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.9s var(--transition-smooth) forwards;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
.header .logo-icon {
    display: inline-flex;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: 18px;
    margin-bottom: 12px;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.4);
    animation: logoPulse 3s ease-in-out infinite;
    font-size: 30px;
    align-items: center;
    justify-content: center;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(108, 92, 231, 0.4); }
    50% { box-shadow: 0 8px 55px rgba(0, 206, 201, 0.65); }
}
.header h1 {
    font-size: 3rem;
    font-weight: 850;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 0%, #c4c4e0 40%, #a0d2db 70%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 4px 0;
}
.header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    font-weight: 400;
}

/* ============ FILTER TAGS ============ */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 45px;
    animation: fadeInUp 0.8s var(--transition-smooth) 0.2s forwards;
    opacity: 0;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.35s var(--transition-smooth);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    user-select: none;
}
.filter-tag:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-glow);
    color: #fff;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
}
.filter-tag.active {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 24px var(--glow-1);
}

/* ============ CARDS GRID ============ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: clamp(20px, 2.4vw, 36px);
    perspective: 2000px;
    position: relative;
    z-index: 2;
}

/* ============ 3D CARD ============ */
.card-wrapper {
    perspective: 900px;
    animation: cardAppear 0.7s var(--transition-smooth) forwards;
    opacity: 0;
    transform: translateY(30px);
}
@keyframes cardAppear {
    to { opacity: 1; transform: translateY(0); }
}
.card-wrapper:nth-child(1) { animation-delay: 0.05s; }
.card-wrapper:nth-child(2) { animation-delay: 0.1s; }
.card-wrapper:nth-child(3) { animation-delay: 0.15s; }
.card-wrapper:nth-child(4) { animation-delay: 0.2s; }
.card-wrapper:nth-child(5) { animation-delay: 0.25s; }

.card-3d {
    position: relative;
    width: 100%;
    min-height: 430px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
    transition: box-shadow 0.5s var(--transition-smooth), border-color 0.5s var(--transition-smooth);
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateY(0deg);
    will-change: transform;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.card-3d:hover {
    border-color: var(--border-glow);
    box-shadow: 0 20px 60px rgba(108, 92, 231, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
.card-3d .card-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    border-radius: var(--radius-lg);
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
}
.card-3d:hover .card-shine { opacity: 1; }

.card-image-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    min-height: 190px;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateZ(20px);
}
.card-image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.7s var(--transition-smooth);
}
.card-3d:hover .card-image-area img { transform: scale(1.1); }
.card-image-area .game-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    z-index: 2;
    transform: translateZ(25px);
    background: rgba(0, 206, 201, 0.75);
}
.card-body {
    padding: 20px 20px 14px;
    transform: translateZ(15px);
    position: relative;
    z-index: 1;
}
.card-body .game-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 5px;
    color: #fff;
    transition: color 0.4s;
}
.card-3d:hover .game-title {
    background: linear-gradient(135deg, #fff, #c4d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.card-body .game-genre {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.game-genre .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.card-body .game-desc {
    font-size: 0.82rem;
    color: #9393a8;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
    transform: translateZ(18px);
}
.card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-footer .btn-play,
.card-footer .btn-how {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.35s var(--transition-smooth);
    color: #fff;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    box-shadow: 0 4px 16px rgba(108,92,231,0.35);
    position: relative;
    overflow: hidden;
}
.card-footer .btn-play {
    border: none;
}
.card-footer .btn-how {
    color: #d8d8ee;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
.card-footer .btn-how:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
}
.btn-play::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.35s;
}
.btn-play:hover::after { opacity: 1; }
.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(108,92,231,0.5);
}

.card-3d.accent-purple:hover { box-shadow: 0 20px 60px rgba(108,92,231,0.35), 0 0 0 1px rgba(108,92,231,0.25) inset; }
.card-3d.accent-teal:hover   { box-shadow: 0 20px 60px rgba(0,206,201,0.35), 0 0 0 1px rgba(0,206,201,0.25) inset; }
.card-3d.accent-pink:hover  { box-shadow: 0 20px 60px rgba(253,121,168,0.35), 0 0 0 1px rgba(253,121,168,0.25) inset; }
.card-3d.accent-gold:hover  { box-shadow: 0 20px 60px rgba(253,203,110,0.35), 0 0 0 1px rgba(253,203,110,0.25) inset; }

/* ============ COMING SOON ============ */
.coming-soon-section {
    margin-top: 60px;
    text-align: center;
    animation: fadeInUp 0.8s var(--transition-smooth) 0.3s forwards;
    opacity: 0;
}
.loading-bar {
    width: 240px;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    margin: 0 auto 16px;
    overflow: hidden;
    box-shadow: 0 0 12px rgba(108,92,231,0.25);
}
.loading-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent-1), var(--accent-3));
    border-radius: 20px;
    animation: loadPulse 2.2s ease-in-out infinite;
    background-size: 200% 100%;
}
.coming-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    animation: textGlow 2.5s ease-in-out infinite alternate;
    margin-top: 10px;
}

@keyframes loadPulse {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes textGlow {
    0% {
        color: #a2a2c2;
        text-shadow: 0 0 5px rgba(108, 92, 231, 0.2);
    }
    100% {
        color: #ffffff;
        text-shadow: 0 0 12px var(--accent-2), 0 0 20px var(--accent-1);
    }
}

/* ============ FULLSCREEN INTERACTIVE MODAL OVERLAY ============ */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #020206;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.game-modal.show {
    opacity: 1;
    pointer-events: all;
}

.game-modal-content {
    background: #04040a;
    width: 100%;
    height: 100%;
    padding: clamp(14px, 2.2vw, 32px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 1.5vh, 18px);
    position: relative;
    max-width: 100%;
}

.btn-close-modal {
    position: absolute;
    top: clamp(10px, 2vw, 24px);
    right: clamp(10px, 2.5vw, 32px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 300;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    line-height: 1;
}
.btn-close-modal:hover {
    color: #fff;
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
    transform: scale(1.05) rotate(90deg);
}

.game-header {
    width: 100%;
    max-width: var(--game-stage-width, 980px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.game-header h2 {
    font-size: clamp(1.35rem, 2.4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-stats {
    display: flex;
    gap: 12px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.glow-val {
    color: var(--accent-2);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 206, 201, 0.6);
}

.game-canvas-container {
    position: relative;
    width: 100%;
    max-width: var(--game-stage-width, 980px);
    aspect-ratio: 3 / 2;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.07);
    background: #010103;
    box-shadow: 0 10px 45px rgba(0,0,0,0.8), inset 0 0 40px rgba(0,0,0,0.9);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none; /* Prevents default browser swipe/scroll behaviors during touch play */
}

/* Modal screens overlay */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 4, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    text-align: center;
    padding: clamp(16px, 3vw, 28px);
    overflow-y: auto;
}

.overlay-interior h3 {
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    font-weight: 950;
    letter-spacing: 0.08em;
    color: #fff;
    text-shadow: 0 0 20px rgba(108, 92, 231, 0.7);
    margin: 0 0 12px;
    text-transform: uppercase;
}

.overlay-interior p {
    font-size: clamp(0.86rem, 1.45vw, 1rem);
    color: var(--text-secondary);
    margin-bottom: clamp(18px, 3vh, 30px);
    max-width: 560px;
    line-height: 1.6;
    margin-left: auto;
    margin-right: auto;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 34px;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 50px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    transition: all 0.3s var(--transition-smooth);
    text-transform: uppercase;
}
.btn-action:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(108, 92, 231, 0.55);
}

.game-footer-controls {
    width: 100%;
    max-width: var(--game-stage-width, 980px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.control-help {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-sound {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s;
}
.btn-sound:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.orientation-callout {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto 16px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(0, 206, 201, 0.24);
    background: rgba(0, 206, 201, 0.08);
    color: #dff;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.45;
}

/* ============ HOW TO PLAY MODAL ============ */
.howto-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 3, 8, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.howto-modal.show {
    opacity: 1;
    pointer-events: all;
}

.howto-dialog {
    width: min(720px, 100%);
    max-height: min(760px, 92dvh);
    overflow-y: auto;
    position: relative;
    padding: clamp(22px, 3vw, 34px);
    border-radius: 20px;
    background: rgba(10, 10, 24, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 42px rgba(0, 206, 201, 0.12);
}

.btn-close-howto {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: #d8d8ee;
    cursor: pointer;
    transition: all 0.25s var(--transition-smooth);
}

.btn-close-howto:hover {
    color: #fff;
    background: rgba(253, 121, 168, 0.16);
    border-color: rgba(253, 121, 168, 0.4);
}

.howto-dialog h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 46px 12px 0;
    color: #fff;
    font-size: clamp(1.45rem, 3vw, 2.1rem);
    font-weight: 900;
}

.howto-dialog h2 i {
    color: var(--accent-2);
}

.howto-summary {
    margin: 0 0 22px;
    color: #b8b8d0;
    line-height: 1.65;
}

.howto-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.howto-panel {
    padding: 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.howto-panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 850;
}

.howto-panel ul {
    margin: 0;
    padding-left: 18px;
    color: #c7c7dc;
    line-height: 1.55;
    font-size: 0.92rem;
}

.howto-panel li + li {
    margin-top: 8px;
}

/* ============ EXIT CONFIRMATION MODAL OVERLAY ============ */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 3, 8, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.confirm-modal.show {
    opacity: 1;
    pointer-events: all;
}

.confirm-modal-content {
    background: rgba(18, 10, 30, 0.95);
    border: 2px solid #fd79a8;
    box-shadow: 0 0 50px rgba(253, 121, 168, 0.3), inset 0 0 20px rgba(253, 121, 168, 0.1);
    border-radius: 24px;
    padding: 35px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.confirm-modal.show .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-content h3 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fd79a8;
    text-shadow: 0 0 15px rgba(253, 121, 168, 0.5);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.confirm-modal-content p {
    font-size: 0.92rem;
    color: #b8b8d0;
    line-height: 1.55;
    margin-bottom: 28px;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-confirm {
    padding: 11px 24px;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 750;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.btn-confirm.btn-yes {
    background: #e17055;
    color: #fff;
    box-shadow: 0 4px 15px rgba(225, 112, 85, 0.35);
}
.btn-confirm.btn-yes:hover {
    background: #ff7675;
    box-shadow: 0 6px 22px rgba(225, 112, 85, 0.55);
    transform: translateY(-2px);
}

.btn-confirm.btn-no {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-confirm.btn-no:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
    transform: translateY(-2px);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header h1 { font-size: 2.2rem; }
    .main-container { padding-top: 30px; }
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }
    .card-3d {
        height: auto;
        min-height: 0;
    }
    .card-image-area {
        min-height: 170px;
    }
    .card-footer {
        align-items: flex-start;
        flex-direction: column;
    }
    .card-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .card-body .game-title { font-size: 1.1rem; }
    .game-modal-content { padding: 20px; }
    .overlay-interior h3 { font-size: 1.8rem; }
    .btn-close-modal { top: 20px; right: 20px; width: 40px; height: 40px; font-size: 1.4rem; }
    .howto-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; gap: 16px; }
    .card-3d { height: auto; }
    .header h1 { font-size: 1.8rem; }
    .game-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .game-footer-controls { flex-direction: column; gap: 15px; align-items: flex-start; }
    .card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .card-footer .btn-play,
    .card-footer .btn-how {
        width: 100%;
        padding-inline: 12px;
        white-space: nowrap;
    }
    #play-page .game-header {
        flex-direction: row;
        align-items: center;
    }
    #play-page .game-footer-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    #play-page .game-stats {
        flex-wrap: wrap;
    }
}

@media (pointer: coarse) and (orientation: portrait) {
    #play-page .game-modal-content {
        --game-stage-width: min(96vw, 720px);
        justify-content: flex-start;
        padding-top: clamp(54px, 8dvh, 86px);
    }

    .orientation-callout {
        display: flex;
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    #play-page .game-modal-content {
        --game-stage-width: min(78vw, calc((100dvh - 24px) * 1.5));
        align-items: flex-start;
        justify-content: center;
        padding: 8px 58px 8px 10px;
    }

    #play-page .game-canvas-container {
        width: var(--game-stage-width);
        max-width: none;
    }

    #play-page .game-header,
    #play-page .game-footer-controls {
        position: absolute;
        left: calc(var(--game-stage-width) + 24px);
        width: calc(100vw - var(--game-stage-width) - 92px);
        max-width: none;
    }

    #play-page .game-header {
        top: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    #play-page .game-header h2 {
        font-size: 1.1rem;
        margin: 0;
    }

    #play-page .game-stats {
        flex-direction: column;
        gap: 8px;
    }

    #play-page .stat-box {
        padding: 7px 11px;
        font-size: 0.76rem;
    }

    #play-page .game-footer-controls {
        bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #play-page .control-help {
        font-size: 0.76rem;
        line-height: 1.35;
    }

    #play-page .btn-sound {
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    #play-page .btn-close-modal {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   REDESIGNED MODERN NEON GAMEPLAY UI STYLES
   ========================================================================== */

/* 1. PORTRAIT WARNING OVERLAY FOR MOBILE */
.portrait-warning-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #0a0a20 0%, #030308 100%);
    z-index: 9999999;
    display: none; /* Shown via media query */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 30px;
}

.phone-rotate-icon {
    font-size: 4.5rem;
    background: linear-gradient(135deg, #00cec9 0%, #6c5ce7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    filter: drop-shadow(0 0 15px rgba(0, 206, 201, 0.4));
    animation: rotatePhone 2s infinite ease-in-out;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    40%, 60% { transform: rotate(90deg); }
}

.portrait-warning-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffffff !important;
    text-shadow: 0 0 15px rgba(0, 206, 201, 0.5);
    margin-bottom: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portrait-warning-desc {
    font-size: 0.95rem;
    color: #a2a2c2 !important;
    max-width: 320px;
    line-height: 1.6;
}

@media (pointer: coarse) and (orientation: portrait) {
    .portrait-warning-overlay {
        display: flex !important;
    }
}

/* 2. GAME LAYOUT STABILIZATION */
#play-page .game-modal-content {
    background: radial-gradient(circle at center, #05050f 0%, #010103 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    gap: 16px;
    width: 100%;
    height: 100%;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

/* 3. NEW TOP HEADER BAR */
.game-header-bar {
    width: 100%;
    max-width: var(--game-stage-width, 980px);
    height: 60px;
    padding: 0 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    
    /* Neon Gradient Border */
    border: 1.5px solid transparent;
    background: linear-gradient(#05050f, #05050f) padding-box, linear-gradient(90deg, #6c5ce7 0%, #00cec9 100%) border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(108, 92, 231, 0.15);
}

.game-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-back-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a2a2c2 !important;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    margin-right: 4px;
}

.header-back-btn:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12);
    border-color: #6c5ce7;
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.4);
    transform: scale(1.05);
}

.game-title-icon {
    font-size: 1.2rem;
    background: linear-gradient(135deg, #00cec9 0%, #6c5ce7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 5px rgba(0, 206, 201, 0.5));
}

.game-title-text {
    font-size: 1.15rem;
    font-weight: 850;
    color: #ffffff !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.header-divider {
    color: #2c2c4d;
    font-weight: 300;
    font-size: 1.1rem;
}

.header-stat {
    font-size: 0.85rem;
    font-weight: 750;
    color: #a2a2c2 !important;
    letter-spacing: 0.03em;
}

.header-stat-val {
    color: #00cec9 !important;
    font-weight: 900;
    margin-left: 3px;
    text-shadow: 0 0 10px rgba(0, 206, 201, 0.6);
}

.game-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a2a2c2 !important;
    font-weight: 750;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-sound {
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sound:not(.sound-muted) {
    color: #00cec9 !important;
    border-color: rgba(0, 206, 201, 0.35);
    background: rgba(0, 206, 201, 0.05);
    box-shadow: 0 0 12px rgba(0, 206, 201, 0.15);
}

.btn-sound.sound-muted {
    color: #fd79a8 !important;
    border-color: rgba(253, 121, 168, 0.25);
    background: rgba(253, 121, 168, 0.03);
}

.header-btn:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-pause {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: all 0.25s ease;
}

.btn-pause:hover {
    border-color: #00cec9 !important;
    background: rgba(0, 206, 201, 0.08) !important;
    box-shadow: 0 0 15px rgba(0, 206, 201, 0.45) !important;
    color: #ffffff !important;
}

.btn-pause i,
.btn-pause svg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
}

/* 4. REDESIGNED START GAME SESSION SCREEN */
#gameStartScreen.overlay-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(8, 8, 20, 0.96) 0%, rgba(3, 3, 8, 0.99) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    overflow-y: auto;
}

#gameStartScreen.overlay-screen::before,
#gameStartScreen.overlay-screen::after {
    content: '';
    flex-grow: 1;
    min-height: 10px;
}

.start-session-container {
    margin: 0;
    width: 100%;
    max-width: 440px;
    padding: clamp(16px, 4vw, 28px);
    border-radius: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    
    /* Neon Borders Gradient */
    border: 2px solid transparent;
    background: linear-gradient(rgba(12, 12, 28, 0.95), rgba(12, 12, 28, 0.95)) padding-box, linear-gradient(135deg, #00cec9 0%, #6c5ce7 100%) border-box;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(108, 92, 231, 0.25);
}

.mobile-landscape-tip {
    display: none; /* Hidden on desktop by default */
    background: rgba(0, 206, 201, 0.08);
    border: 1px solid rgba(0, 206, 201, 0.22);
    border-radius: 12px;
    padding: 10px 14px;
    color: #ddffff !important;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.45;
    margin-bottom: 24px;
    align-items: center;
    gap: 12px;
    text-align: left;
    max-width: 100%;
}

@media (pointer: coarse) {
    .mobile-landscape-tip {
        display: flex !important; /* Show only on mobile / touch screen layouts */
    }
}

.mobile-landscape-tip i {
    font-size: 1.2rem;
    color: #00cec9;
    flex-shrink: 0;
}

.start-game-title {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 40%, #c4bffd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 12px rgba(108, 92, 231, 0.5));
    margin-bottom: 12px;
}

.start-divider {
    display: flex;
    align-items: center;
    width: 72%;
    gap: 10px;
    margin: 12px 0 20px;
}

.divider-line {
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(108, 92, 231, 0) 0%, rgba(108, 92, 231, 0.6) 50%, rgba(0, 206, 201, 0.6) 75%, rgba(0, 206, 201, 0) 100%);
}

.divider-diamond {
    width: 8px;
    height: 8px;
    background: #00cec9;
    transform: rotate(45deg);
    box-shadow: 0 0 10px #00cec9;
}

.start-game-desc {
    font-size: 0.92rem;
    color: #a2a2c2 !important;
    line-height: 1.6;
    margin-bottom: 28px;
    max-width: 380px;
}

.btn-start-session {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 44px;
    font-size: 1rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 50px;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(90deg, #6c5ce7 0%, #00cec9 100%);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4), 0 0 15px rgba(0, 206, 201, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-transform: uppercase;
}

.btn-start-session:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.55), 0 0 25px rgba(0, 206, 201, 0.4);
}

.start-session-footer {
    width: 100%;
    max-width: 980px;
    padding: 0 40px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
    flex-shrink: 0;
}

.footer-left-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a2a2c2 !important;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.footer-left-controls i {
    color: #00cec9;
    font-size: 1rem;
}

.footer-sound-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a2a2c2 !important;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 750;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-sound-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    border-color: #00cec9;
    box-shadow: 0 0 12px rgba(0, 206, 201, 0.25);
}

/* 5. REDESIGNED PAUSE MODAL OVERLAY */
.pause-modal-content {
    background: rgba(14, 8, 24, 0.98) !important;
    border: 2px solid #fd79a8 !important;
    box-shadow: 0 0 60px rgba(253, 121, 168, 0.25), inset 0 0 20px rgba(253, 121, 168, 0.05) !important;
    max-width: 420px !important;
    padding: clamp(24px, 6vw, 36px) !important;
    border-radius: 24px !important;
}

.pause-title {
    font-size: 1.6rem !important;
    font-weight: 900 !important;
    color: #fd79a8 !important;
    text-shadow: 0 0 15px rgba(253, 121, 168, 0.4) !important;
    margin-bottom: 10px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pause-desc {
    font-size: 0.9rem !important;
    color: #a2a2c2 !important;
    line-height: 1.55 !important;
    margin-bottom: 26px !important;
}

.pause-buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.btn-pause-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 24px;
    font-size: 0.92rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.btn-keep-playing {
    background: linear-gradient(90deg, #00cec9 0%, #0984e3 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 206, 201, 0.35);
}

.btn-keep-playing:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 206, 201, 0.55);
}

/* Removed see-result button styles */

.btn-quit-game {
    background: rgba(225, 112, 85, 0.12);
    border: 1px solid rgba(225, 112, 85, 0.35);
    color: #ff7675 !important;
}

.btn-quit-game:hover {
    background: #e17055;
    color: #ffffff !important;
    border-color: #e17055;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(225, 112, 85, 0.45);
}

/* 6. REDESIGNED GAME OVER LAYOUT */
#gameOverScreen.overlay-screen {
    background: rgba(4, 4, 10, 0.92) !important;
}

.game-over-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.game-over-title {
    font-size: clamp(2.2rem, 6.5vw, 3.8rem);
    font-weight: 950;
    font-style: italic;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #a29bfe 10%, #6c5ce7 50%, #00cec9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px rgba(108, 92, 231, 0.6));
    margin-bottom: 8px;
    line-height: 1.1;
}

.game-over-score {
    font-size: clamp(1rem, 3vw, 1.35rem) !important;
    font-weight: 750 !important;
    color: #a2a2c2 !important;
    letter-spacing: 0.05em;
    margin-bottom: 28px !important;
}

.btn-play-again {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 36px;
    font-size: 0.92rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-transform: uppercase;
    color: #ffffff !important;
    
    /* Transparent interior, gradient neon border */
    border: 2.5px solid transparent;
    background: linear-gradient(#05050f, #05050f) padding-box, linear-gradient(90deg, #6c5ce7 0%, #00cec9 100%) border-box;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    border-radius: 50px;
}

.btn-play-again:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 20px rgba(0, 206, 201, 0.4), 0 0 10px rgba(108, 92, 231, 0.25);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.15)) padding-box, linear-gradient(90deg, #6c5ce7 0%, #00cec9 100%) border-box;
}

/* 7. RESPONSIVE OPTIMIZATIONS */
@media (max-width: 768px) {
    .start-session-footer {
        padding: 0 24px;
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    #play-page .game-modal-content {
        padding: 12px;
        gap: 12px;
    }
    
    .game-header-bar {
        height: 52px;
        padding: 0 12px;
    }
    
    .game-title-text {
        font-size: 0.95rem;
    }
    
    .header-divider {
        margin: 0 6px;
        font-size: 0.9rem;
    }
    
    .header-stat {
        font-size: 0.75rem;
    }
    
    .btn-sound {
        padding: 6px 12px;
        font-size: 0.72rem;
    }
    
    .btn-pause {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 0.85rem;
    }
    
    .start-session-container {
        padding: 20px;
    }
    
    .start-session-footer {
        flex-direction: column;
        gap: 12px;
        position: static;
        margin-top: 16px;
        padding: 0;
    }
    
    .footer-left-controls {
        font-size: 0.78rem;
    }
}

/* 8. MOBILE LANDSCAPE MAX CANVAS DYNAMIC OPTIMIZATIONS */
@media (max-height: 560px) and (orientation: landscape) {
    #play-page .game-modal-content {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px !important;
        gap: 6px !important;
    }
    
    #play-page .game-header-bar {
        height: 38px !important;
        padding: 0 12px !important;
        border-radius: 10px !important;
        margin-bottom: 2px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    }
    
    #play-page .header-back-btn {
        width: 26px !important;
        height: 26px !important;
        margin-right: 2px !important;
    }
    
    #play-page .game-title-text {
        font-size: 0.82rem !important;
    }
    
    #play-page .header-divider {
        margin: 0 8px !important;
        font-size: 0.8rem !important;
    }
    
    #play-page .header-stat {
        font-size: 0.72rem !important;
    }
    
    #play-page .header-btn {
        padding: 4px 10px !important;
        font-size: 0.7rem !important;
    }
    
    #play-page .btn-sound {
        padding: 4px 10px !important;
        gap: 5px !important;
    }
    
    #play-page .btn-pause {
        width: 28px !important;
        height: 28px !important;
        border-radius: 6px !important;
    }
    
    #play-page .game-canvas-container {
        /* Maximize canvas height dynamically based on viewport height, preserving 3:2 aspect ratio */
        width: min(92vw, calc((100dvh - 56px) * 1.5)) !important;
        height: min(calc(92vw / 1.5), calc(100dvh - 56px)) !important;
        max-width: none !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.6) !important;
    }
    
    #play-page #gameStartScreen.overlay-screen {
        padding: 12px !important;
    }
    
    #play-page .start-session-container {
        max-width: 440px !important;
        padding: 14px 24px !important;
        border-radius: 16px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    }
    
    #play-page .mobile-landscape-tip {
        display: none !important; /* Already rotated! */
    }
    
    #play-page .start-game-title {
        font-size: 1.6rem !important;
        margin-bottom: 4px !important;
    }
    
    #play-page .start-divider {
        margin: 4px 0 10px !important;
    }
    
    #play-page .start-game-desc {
        font-size: 0.8rem !important;
        margin-bottom: 12px !important;
        line-height: 1.4 !important;
    }
    
    #play-page .btn-start-session {
        padding: 8px 28px !important;
        font-size: 0.85rem !important;
    }
    
    #play-page .start-session-footer {
        position: static !important;
        margin-top: 8px !important;
        justify-content: center !important;
        gap: 24px !important;
    }
    
    #play-page .footer-left-controls {
        font-size: 0.72rem !important;
    }
    
    #play-page .footer-sound-btn {
        padding: 4px 12px !important;
        font-size: 0.72rem !important;
    }
}
