/* --- GLOBAL & VARS --- */
:root {
    --sidebar-bg: #1a1a2e;
    --main-bg: #f4f7fa;
    --card-bg: #ffffff;
    --accent-color: #00d2ff;
    --text-main: #2c3e50;
    --text-muted: #636e72;
    --sidebar-text: #a0a0b0;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Engine Colors */
    --nav-color: #00bcd4;   /* Cyan */
    --nav-bg: #e0f7fa;
    --launch-color: #ff9800; /* Orange */
    --launch-bg: #fff3e0;
    --seq-color: #9c27b0;    /* Purple */
    --seq-bg: #f3e5f5;
    --smash-color: #f44336;  /* Red */
    --smash-bg: #ffebee;
}

html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; }

body { 
    margin: 0; padding: 0; 
    background: var(--main-bg); 
    font-family: 'Segoe UI', 'Bubblegum Sans', sans-serif; 
    overflow: hidden; 
    height: 100vh;
}

/* --- HOME SCREEN --- */
#home-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.home-container {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.home-logo {
    margin-bottom: 20px;
}

.home-title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 48px;
    margin: 20px 0 10px 0;
    color: white;
}

.home-subtitle {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 50px;
}

.path-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.path-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 40px 50px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 200px;
    color: white;
}

.path-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.path-btn:active {
    transform: translateY(-2px);
}

.path-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.path-name {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: 'Bubblegum Sans', cursive;
}

.path-desc {
    font-size: 14px;
    opacity: 0.8;
}

/* --- LAYOUT STRUCTURE --- */
#dashboard-screen {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar removed - no longer needed */

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    padding-bottom: 80px; /* Space for fixed footer */
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--main-bg);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.content-area::-webkit-scrollbar { display: none; }

.content-area > section,
.content-area > div {
    padding-left: 30px;
    padding-right: 30px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #0d2137;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.header-logo {
    height: 48px;
    width: auto;
    min-width: 140px;
    max-width: 200px;
    object-fit: contain;
    object-position: left center;
    cursor: pointer;
}

.header-brand {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 36px;
    font-weight: bold;
    white-space: nowrap;
    display: inline-flex;
    align-items: baseline;
}
.header-brand .brand-refle { color: #fff; }
.header-brand .brand-x { color: #00d4ff; margin: 0 1px; }
.header-brand .brand-n { color: #fff; }
.header-brand .brand-n sup { font-size: 0.55em; vertical-align: super; line-height: 0; }

.header-center {
    display: flex;
    gap: 0;
    flex: 1;
    justify-content: center;
    align-items: center;
    background: transparent;
    padding: 4px 15px;
    max-width: 600px;
}

.header-tabs-container {
    display: flex;
    gap: 0;
    flex: 1;
}

.header-tab {
    background: transparent;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    color: rgba(255,255,255,0.9);
    flex: 1;
    text-align: center;
    position: relative;
    min-width: 0;
}

.header-tab:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.header-tab.active {
    background: rgba(0, 212, 255, 0.25);
    color: #00d4ff;
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3);
}

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

.btn-settings {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: white;
    transition: background 0.2s, transform 0.2s;
}
.btn-settings:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}
.btn-settings:active {
    transform: scale(0.98);
}

/* Team scores table: below header, above first round – full width, sticky so it doesn't scroll away */
.team-scores-table-wrap {
    display: none;
    position: sticky;
    top: 76px;
    z-index: 99;
    width: 100%;
    padding: 16px 0;
    margin-top: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border-bottom: 3px solid #0d2137;
    overflow-x: auto;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    box-sizing: border-box;
}
.team-scores-table-title {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0d2137;
}
/* Match round section edges: .content-area > div (30px) + .round-section (30px) = 60px. border-box so padding is inside width and right edge aligns. */
.content-area > .team-scores-table-wrap {
    padding-left: 60px;
    padding-right: 60px;
    box-sizing: border-box;
}
.team-scores-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 18px;
    color: var(--text-main);
    border: 2px solid #0d2137;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(13, 33, 55, 0.15);
}
.team-scores-table th,
.team-scores-table td {
    padding: 14px 18px;
    text-align: left;
    border: 1px solid #b8c5d6;
}
.team-scores-table th {
    font-size: 20px;
    font-weight: 700;
    color: #0d2137;
    background: linear-gradient(135deg, #0d2137 0%, #1a3a52 100%);
    color: #fff;
    border-color: #0d2137;
}
.team-scores-table th:first-child {
    background: linear-gradient(135deg, #1a4d6d 0%, #0d2137 100%);
}
.team-scores-table td {
    color: var(--text-main);
    background: #fff;
}
.team-scores-table .team-scores-round-cell {
    font-weight: 600;
    color: #0d2137;
    background: #e8eef5;
    border-right: 2px solid #0d2137;
}
.team-scores-table .team-scores-row-even td {
    background: #fff;
}
.team-scores-table .team-scores-row-odd td {
    background: #f4f7fb;
}
.team-scores-table .team-scores-row-odd .team-scores-round-cell {
    background: #dfe6ef;
}
.team-scores-table .team-scores-score-cell.team-scores-have-score {
    font-weight: 700;
    color: #0d2137;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
}
.team-scores-table .team-scores-row-odd .team-scores-score-cell.team-scores-have-score {
    background: linear-gradient(135deg, #b2ebf2 0%, #80deea 100%);
}
.team-scores-table .team-scores-total-row td {
    font-weight: bold;
    font-size: 20px;
    border-top: 3px solid #0d2137;
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #1a1a1a;
    border-bottom: none;
}
.team-scores-table .team-scores-total-row td:first-child {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #fff;
}

/* Search Section */
.search-section {
    padding: 15px 30px;
    background: white;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-wrapper.full-width {
    width: 100%;
}

.search-wrapper.full-width .search-inner {
    max-width: 100%;
    border: 2px solid #667eea;
    border-radius: 25px;
    background: white;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-wrapper.full-width .search-inner:focus-within {
    border-color: #764ba2;
    box-shadow: 0 2px 12px rgba(118, 75, 162, 0.3);
}

.search-wrapper.full-width .search-input {
    border: none;
    outline: none;
    background: transparent;
}

/* --- SIDEBAR COMPONENTS --- */
.dash-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 30px;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
}

.nav-section { flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav-section::-webkit-scrollbar { display: none; }
.nav-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; font-weight: bold; opacity: 0.6; }

.nav-btn {
    background: none; border: none; width: 100%; text-align: left;
    padding: 12px 15px; color: var(--sidebar-text);
    cursor: pointer; font-size: 16px; border-radius: 10px;
    transition: all 0.2s; display: flex; align-items: center; gap: 10px;
}
.nav-btn:hover { background-color: rgba(255,255,255,0.05); color: white; }
.nav-btn.active { background-color: var(--accent-color); color: #000; font-weight: bold; }

.create-btn {
    margin-top: 20px;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: white; border: none; padding: 15px;
    border-radius: 12px; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
    transition: transform 0.2s; width: 100%;
}
.create-btn:hover { transform: scale(1.02); }

/* --- HEADER --- */
.dash-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px; padding: 5px 0;
}
.editable-name { cursor: pointer; transition: all 0.2s; padding: 2px 5px; border-radius: 5px; display: inline-block; }
.editable-name:hover { background: rgba(255, 193, 7, 0.1); transform: scale(1.02); }

.profile-pill {
    background: rgba(255, 255, 255, 0.9); 
    padding: 8px 15px; 
    border-radius: 20px;
    display: flex; 
    align-items: center; 
    gap: 10px;
    font-weight: bold; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    color: #01579b;
    border: 1px solid rgba(0, 188, 212, 0.3);
    min-width: 200px;
    max-width: 400px;
    flex-wrap: wrap;
}

.profile-pill #user-display-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

#user-xp {
    color: #b71c1c;
}

.profile-pill-signout-btn {
    background: transparent;
    border: 1px solid rgba(0, 188, 212, 0.4);
    color: #01579b;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    transition: transform 0.2s, background 0.2s;
}

.profile-pill-signout-btn:hover {
    background: rgba(0, 188, 212, 0.1);
    transform: scale(1.03);
}

.user-avatar-clickable {
    font-size: 20px;
    cursor: pointer;
    margin-right: 5px;
    transition: transform 0.2s;
    display: inline-block;
}

.user-avatar-clickable:hover {
    transform: scale(1.2);
}

/* Avatar picker modal: larger modal and avatars, no scroll */
.avatar-picker-modal-content {
    max-width: 640px;
    width: 90vw;
}

.avatar-emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 28px;
    overflow: visible;
    max-height: none;
}

.avatar-emoji-btn {
    font-size: 56px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s;
    background: rgba(255,255,255,0.8);
    border: 2px solid transparent;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-emoji-btn:hover {
    background: rgba(0, 188, 212, 0.2);
    border-color: #00acc1;
    transform: scale(1.1);
}

#avatar-emoji-grid.avatar-emoji-grid::-webkit-scrollbar {
    display: none;
}

#avatar-emoji-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#avatar-emoji-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

#avatar-emoji-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* --- HERO SECTION --- */
.hero-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px; 
    padding: 35px 40px; 
    color: white;
    margin: 20px 30px 30px 30px; 
    position: relative; 
    overflow: visible;
    box-shadow: 0 10px 30px rgba(118, 75, 162, 0.4);
    display: flex;
    gap: 25px;
    align-items: stretch;
    z-index: 1;
    min-height: 220px;
}

.hero-content {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.hero-content h1 { 
    font-size: 32px; 
    margin: 0 0 12px 0; 
    line-height: 1.3;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero-content p { 
    font-size: 17px; 
    opacity: 1; 
    margin-bottom: 20px; 
    max-width: 100%;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.hero-btn { 
    background: white; 
    color: #764ba2; 
    border: none; 
    padding: 14px 35px; 
    border-radius: 25px; 
    font-weight: bold; 
    font-size: 16px;
    cursor: pointer; 
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    align-self: flex-start;
}

.hero-btn:hover { 
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.leaderboard-compact {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 18px;
    min-width: 300px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.leaderboard-compact .leaderboard-header {
    margin-bottom: 2x;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.leaderboard-compact .leaderboard-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.leaderboard-compact .leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

.leaderboard-compact .leaderboard-row {
    height:45px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.leaderboard-compact .leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-compact .leaderboard-rank-cell {
    width: 35px;
    text-align: center;
    font-weight: bold;
    font-size: 15px;
    padding: 0 6px;
    color: white;
}

.leaderboard-compact .leaderboard-medal-cell {
    width: 40px;
    text-align: center;
    font-size: 20px;
    padding: 0 6px;
}

.leaderboard-compact .leaderboard-name-cell {
    padding: 0 10px;
    max-width: 180px;
    overflow: hidden;
}

.leaderboard-compact .leaderboard-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.leaderboard-compact .leaderboard-avatar-emoji {
    font-size: 20px;
    margin-right: 8px;
    vertical-align: middle;
    display: inline-block;
}

.leaderboard-compact .leaderboard-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 140px;
    vertical-align: middle;
    color: white;
    font-weight: 500;
}

.leaderboard-compact .leaderboard-score-cell {
    text-align: right;
    font-weight: bold;
    font-size: 15px;
    color: #f1c40f;
    padding: 0 6px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.player-rank {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    min-width: 130px;
    max-width: 160px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-rank h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    opacity: 1;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.player-rank .rank-value {
    font-size: 36px;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    line-height: 1;
}

/* --- LEADERBOARD --- */
.leaderboard-sidebar {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.leaderboard-sidebar::-webkit-scrollbar { display: none; }

.leaderboard-header {
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.leaderboard-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

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

.leaderboard-item {
    display: grid;
    grid-template-columns: 30px 30px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
}

.leaderboard-rank {
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
}

.leaderboard-medal {
    font-size: 18px;
}

.leaderboard-name {
    color: white;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* --- ROUND SECTIONS (dashboard game list) – same style as Custom Quiz section --- */
.round-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 30px 0 20px 0;
    padding: 0 30px;
    position: relative;
    z-index: 0;
}
.round-section:first-child { margin-top: 20px; }
.round-title {
    font-size: 24px;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.round-section .worksheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --- LIBRARY HEADER & SEARCH --- */
.section-header { 
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 30px 0 20px 0;
    padding: 0 30px;
    position: relative;
    z-index: 0;
}
.header-title-group { display: none; }
.section-header h2 { 
    font-size: 24px; 
    color: white; 
    margin: 0; 
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.count-badge { display: none; }

.search-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}
.search-inner { position: relative; width: 100%; max-width: 100%; }
.search-input { 
    width: 100%; padding: 12px 20px 12px 45px; 
    border-radius: 30px; border: none; background: white; 
    box-shadow: var(--shadow-sm); font-size: 15px; outline: none; box-sizing: border-box;
}
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.5; pointer-events: none; }

.camera-wrapper { flex: 1; display: flex; justify-content: flex-end; min-width: 150px; }
.camera-select-input { padding: 10px; border-radius: 20px; border: 1px solid #ddd; background: white; max-width: 200px; outline: none; }

/* --- CARD GRID & STYLING --- */
.worksheet-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 25px; 
    margin-bottom: 40px;
    padding: 0 30px;
}

.worksheet-grid .create-card {
    grid-column: span 1;
}

/* Topic Section */
.topic-section {
    margin-bottom: 40px;
    padding: 0 30px;
}

.topic-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.topic-cards-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.topic-cards-container::-webkit-scrollbar {
    height: 8px;
}

.topic-cards-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.topic-cards-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.topic-cards-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.topic-cards-grid {
    display: flex;
    gap: 20px;
    min-width: max-content;
}

.topic-cards-grid .ws-card {
    min-width: 280px;
    flex-shrink: 0;
}

.show-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s;
}

.show-more-btn:hover {
    transform: scale(1.05);
}

/* Create Card */
.create-card {
    background: linear-gradient(135deg, #02dbfc 0%, #0192f9 100%);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    color: white;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    position: relative;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

.create-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.create-card-icon {
    font-size: 80px;
    margin-bottom: 12px;
}

.create-card h3 {
    font-size: 18px;
    margin: 0;
    font-weight: bold;
    line-height: 1.3;
}

.ws-card { 
    background: white; border-radius: 16px; 
    box-shadow: var(--shadow-sm); 
    display: flex; flex-direction: column;
    height: 100%; min-height: 200px;
    position: relative; overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
    border: 3px solid #e0e0e0;
    border-top: 6px solid #e0e0e0;
    cursor: pointer;
}
.ws-card:hover { 
    transform: translateY(-8px) scale(1.02); 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Difficulty border colors - thicker top border, increasing difficulty */
.ws-card.diff-0 { 
    border-color: #ffc107; /* Yellow - Beginner */
    border-top-color: #ffc107;
    border-top-width: 6px;
} 
.ws-card.diff-1 { 
    border-color: #4caf50; /* Green - Easy */
    border-top-color: #4caf50;
    border-top-width: 6px;
} 
.ws-card.diff-2 { 
    border-color: #f44336; /* Red - Moderate */
    border-top-color: #f44336;
    border-top-width: 6px;
} 
.ws-card.diff-3 { 
    border-color: #795548; /* Brown - Intermediate */
    border-top-color: #795548;
    border-top-width: 6px;
} 
.ws-card.diff-4 { 
    border-color: #212121; /* Black - Advanced */
    border-top-color: #212121;
    border-top-width: 6px;
} 
.ws-card.diff-5 { 
    border-color: #000000; /* Black - Expert */
    border-top-color: #000000;
    border-top-width: 6px;
}

.ws-card.locked { 
    opacity: 0.85; 
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}
.ws-card.locked:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--shadow-md);
}

/* Card Content Area */
.card-content {
    padding: 24px;
    flex: 1; 
    display: flex; flex-direction: column;
    justify-content: space-between;
}

.card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 12px;
}

.card-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}

.action-badge {
    font-size: 11px; font-weight: 800; text-transform: uppercase;
    padding: 5px 10px; border-radius: 15px; letter-spacing: 0.5px;
}

.ws-card h3 {
    font-size: 22px; font-weight: 700; color: var(--text-main);
    margin: 0; line-height: 1.3;
}

.ws-topic {
    font-size: 14px; font-weight: 600; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 12px; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 8px;
}

.ws-description {
    font-size: 15px; color: var(--text-muted);
    line-height: 1.6; margin: 12px 0 0 0;
    /* Text Truncation */
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.unlock-text {
    margin-top: 16px;
    font-size: 16px;
    font-weight: 700;
    color: #666;
    text-align: center;
    padding: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

/* Footer & Buttons */
.card-footer {
    padding: 12px 20px; border-top: 1px solid #f0f0f0;
    display: flex; flex-direction: column; gap: 8px;
    background: #fafafa;
}



.btn-group {
    display: flex; gap: 10px; width: 100%;
}

.play-btn {
    flex: 1; border: none; padding: 10px; border-radius: 8px;
    color: white; font-weight: 700; font-size: 12px; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.5px;
    transition: opacity 0.2s, transform 0.1s;
}
.play-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Button Variants */
.btn-practise { background: #00b894; } /* Teal/Green */
.btn-blitz { background: #d63031; } /* Red */
.btn-locked { 
    background: #95a5a6; 
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-locked:hover { 
    opacity: 0.7; 
    transform: none;
}

.delete-btn {
    background: #ff7675; color: white; border: none;
    width: 36px; height: 36px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: background 0.2s;
}
.delete-btn:hover { background: #d63031; }

.share-btn {
    background: #00b894; color: white; border: none;
    padding: 8px 16px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; transition: background 0.2s;
}
.share-btn:hover { background: #00a085; }
.share-btn:disabled,
.share-btn[disabled] {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Engine Specific Styles */
.ws-card.engine-navigator { border-top-color: var(--nav-color); }
.ws-card.engine-navigator .card-icon { background: var(--nav-bg); color: var(--nav-color); }
.ws-card.engine-navigator .action-badge { background: var(--nav-bg); color: var(--nav-color); }

.ws-card.engine-launcher { border-top-color: var(--launch-color); }
.ws-card.engine-launcher .card-icon { background: var(--launch-bg); color: var(--launch-color); }
.ws-card.engine-launcher .action-badge { background: var(--launch-bg); color: var(--launch-color); }

.ws-card.engine-sequencer { border-top-color: var(--seq-color); }
.ws-card.engine-sequencer .card-icon { background: var(--seq-bg); color: var(--seq-color); }
.ws-card.engine-sequencer .action-badge { background: var(--seq-bg); color: var(--seq-color); }

.ws-card.engine-smasher { border-top-color: var(--smash-color); }
.ws-card.engine-smasher .card-icon { background: var(--smash-bg); color: var(--smash-color); }
.ws-card.engine-smasher .action-badge { background: var(--smash-bg); color: var(--smash-color); }

/* --- SELECTION & UTILS --- */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 40px; color: #999; font-size: 18px; }
.hidden { display: none !important; }

/* --- GAME OVERLAY (Preserved) --- */
#game-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #222; z-index: 2000; }
#game-container video,
#game-container #input_video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
    display: block !important;
    visibility: visible !important;
    pointer-events: none;
}
#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; background: transparent; }
#header-wrapper { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; }
#header-bar { background: rgba(0,0,0,0.95); color: #fff; height: 12vh; display: flex; justify-content: space-between; align-items: center; padding: 0 2vw; border-bottom: 2px solid #555; }
.header-left { width: 25%; display: flex; justify-content: flex-start; align-items: center; gap: 10px; }
.header-center { width: 50%; text-align: center; }
.header-right { width: 25%; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.game-logo { height: 9vh; object-fit: contain; }
#exercise-name { font-size: 5vmin; color: #f1c40f; line-height: 1.1; text-transform: uppercase; }
#game-mode-display { font-size: 3vmin; color: #00d2ff; letter-spacing: 2px; }
#level-display { font-size: 2.5vmin; color: #aaa; }
#lives-display { font-size: 3vmin; margin: 2px 0; letter-spacing: 3px; }
#score-display { font-size: 4vmin; color: #2ecc71; font-weight: bold; }
#timer-container { width: 100%; height: 1.5vh; background: #333; position: relative; }
#timer-bar { height: 100%; width: 100%; background: #00ff00; transition: width 1s linear; }

/* Reserved top HUD: time + goal stay out of the play field */
:root {
    --game-hud-timer-h: 42px;
    --game-hud-goal-h: 54px;
    --game-hud-offset: 0px;
    --game-question-bar-h: 72px;
}
body.game-hud-visible {
    --game-hud-offset: var(--game-hud-timer-h);
}
body.game-hud-visible.game-goal-hud {
    --game-hud-offset: calc(var(--game-hud-timer-h) + var(--game-hud-goal-h));
}

#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, rgba(8, 10, 18, 0.88) 0%, rgba(8, 10, 18, 0.72) 70%, rgba(8, 10, 18, 0.0) 100%);
}

#game-timer-bar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    height: var(--game-hud-timer-h);
    min-height: var(--game-hud-timer-h);
    margin: 0 76px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

#game-timer-bar.hidden {
    display: none !important;
}

#game-timer-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: #2e9e4a;
    transition: width 0.15s linear, background 0.3s ease;
}

.game-timer-meta {
    position: relative;
    z-index: 2;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 14px;
    gap: 10px;
    color: #fff;
    text-shadow: 0 1px 3px #000, 0 0 8px #000;
    box-sizing: border-box;
}

.game-hud-caption {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    opacity: 0.85;
}

#game-timer-remaining {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* Score centered in the timer bar – large, high-contrast */
#game-score-center {
    position: fixed;
    top: 0;
    left: 76px;
    right: 76px;
    height: var(--game-hud-timer-h);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 16px;
    z-index: 1102;
    pointer-events: none;
    font-size: min(7vw, 28px);
    font-weight: bold;
    color: #ffffff;
    /* Strong dark outline so score reads on green/orange/red/dark fill */
    text-shadow:
        0 0 2px #000,
        0 0 4px #000,
        1px 1px 0 #000,
        -1px -1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        0 1px 0 #000,
        0 -1px 0 #000,
        1px 0 0 #000,
        -1px 0 0 #000;
}

/* Question bar just below timer (e.g. text quiz) */
#game-question-bar {
    position: fixed;
    top: var(--game-hud-offset, 42px);
    left: 0;
    right: 0;
    min-height: 48px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: min(5vw, 28px);
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    pointer-events: none;
    line-height: 1.3;
}
#game-question-bar.nav-question-bar {
    min-height: 72px;
    padding: 14px 28px;
    font-size: min(7.5vw, 48px);
    font-weight: 800;
    line-height: 1.2;
}
#game-question-bar.hidden {
    display: none !important;
}

#game-score-center.hidden {
    display: none !important;
}

#game-score-value {
    display: block;
}

/* Big score flash in center when score updates */
#game-score-flash {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    pointer-events: none;
    display: block;
    font-size: min(20vw, 28vh);
    font-weight: bold;
    color: #ffffff;
    text-shadow:
        0 0 4px #000,
        0 0 8px #000,
        2px 2px 0 #000,
        -2px -2px 0 #000,
        -2px 2px 0 #000,
        2px -2px 0 #000,
        0 2px 0 #000,
        0 -2px 0 #000,
        2px 0 0 #000,
        -2px 0 0 #000;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

#game-score-flash.flash-show {
    opacity: 1;
    animation: scoreFlashPop 0.5s ease-out;
}

#game-score-flash.hidden {
    display: none !important;
}

@keyframes scoreFlashPop {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#dojo-count {
    position: absolute;
    right: 2%;
    top: 50%;
    transform: translateY(-150%);
    font-size: 4vh;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* HUD Flash Animation */
@keyframes hudFlash {
    0% { transform: scale(1); text-shadow: 0 0 12px rgba(0,0,0,0.9), 0 0 20px rgba(255,255,255,0.4); }
    50% { transform: scale(1.15); text-shadow: 0 0 16px rgba(0,0,0,0.9), 0 0 28px rgba(255,255,255,0.8); }
    100% { transform: scale(1); text-shadow: 0 0 12px rgba(0,0,0,0.9), 0 0 20px rgba(255,255,255,0.4); }
}

/* Engine Specific Overlays */
#engine-layer { position: absolute; top: var(--game-hud-offset, 0px); left: 0; width: 100%; height: calc(100% - var(--game-hud-offset, 0px)); z-index: 20; pointer-events: none; display: block !important; background: transparent; }
.nav-question { margin-top: 0px; position:absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #e2e2e2; border: 6px solid #cc0000; color: #000; padding: 15px 40px; border-radius: 0 0 20px 20px; font-size: 10vmin; font-weight: bold; text-align: center; width: 90%; box-shadow: 0 10px 20px rgba(0,0,0,0.8); z-index: 50; }
body.game-hud-visible .nav-question { top: 8px; }

/* Broken heart animation */
@keyframes brokenHeart {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0.3;
    }
}

/* Flying heart animation */
@keyframes flyHeart {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--target-x), var(--target-y)) scale(1.5);
        opacity: 0;
    }
}
.nav-zone { position: absolute; top: 0; bottom: 3vh; width: 22vw; max-width: 280px; min-width: 120px; height: auto; padding: 16px 12px; border: 6px solid rgba(255,255,255,0.6); border-radius: 20px; display: flex; justify-content: center; align-items: center; text-align: center; background: rgba(20, 24, 36, 0.55); box-shadow: 0 10px 20px rgba(0,0,0,0.5); transition: transform 0.2s, background-color 0.2s, border-color 0.2s; font-size: 6vmin; font-weight: 800; color: #fff; word-break: break-word; }
body:has(#game-question-bar:not(.hidden)) .nav-zone { top: var(--game-question-bar-h, 72px); }
.nav-zone.hovered { transform: scale(1.05); border-color: rgba(255,255,255,0.95); }
.nav-zone.explode-correct, .nav-top.explode-correct, .nav-bottom.explode-correct { background: rgba(46, 204, 113, 0.9); border-color: #2ecc71; }
.nav-zone.explode-wrong, .nav-top.explode-wrong, .nav-bottom.explode-wrong { background: rgba(231, 76, 60, 0.9); border-color: #e74c3c; }
.nav-zone-green { background: rgba(46, 204, 113, 0.85); }
.nav-zone-red { background: rgba(231, 76, 60, 0.85); }
.nav-left { left: 0; border-radius: 0 20px 20px 0; }
.nav-right { right: 0; border-radius: 20px 0 0 20px; }

.nav-rocket {
    position: absolute;
    font-size: 8vh;
    z-index: 60;
    pointer-events: none;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px #000);
}

img.glyph-img {
    display: inline-block;
    width: 1em;
    height: 1em;
    object-fit: contain;
    vertical-align: middle;
    pointer-events: none;
}
.glyph-has-image {
    line-height: 1;
}
.ws-topic .glyph-img {
    width: 64px;
    height: 64px;
}
.goal-track-mascot .glyph-img,
.goal-track-flag .glyph-img {
    width: 36px;
    height: 36px;
}
.nav-zone .glyph-img,
.zone-content .glyph-img {
    width: 18vmin;
    height: 18vmin;
}
.collected-item .glyph-img {
    width: 8vmin;
    height: 8vmin;
}

.nav-stand-here {
    position: absolute;
    left: 50%;
    top: 52%;
    width: 28vmin;
    height: 28vmin;
    margin: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 8px solid #ff4757;
    background: rgba(255, 71, 87, 0.22);
    box-shadow: 0 0 40px rgba(255, 71, 87, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 55;
    pointer-events: none;
    animation: navStandHerePulse 1s ease-in-out infinite;
}
.nav-stand-here-label {
    color: #fff;
    font-weight: 800;
    font-size: clamp(16px, 3.2vmin, 28px);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-shadow: 0 2px 8px #000;
    padding: 0 10px;
    line-height: 1.15;
}
.nav-stand-here-fade {
    animation: navStandHereFade 0.35s ease-out forwards;
}
@keyframes navStandHerePulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.08); opacity: 0.85; }
}
@keyframes navStandHereFade {
    to { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
}

/* Vertical Layout Styles */
.nav-top, .nav-bottom, .nav-middle-gap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20vw;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 6px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    transition: transform 0.2s, border-color 0.2s;
}
.nav-top.nav-zone-green, .nav-bottom.nav-zone-red, .nav-top.nav-zone-red, .nav-bottom.nav-zone-green {
    background: transparent;
}
.nav-top.nav-zone-green, .nav-top.nav-zone-red { top: 0; border-radius: 0 0 20px 20px; min-height: 28vh; }
.nav-top.nav-zone-green { background: rgba(46, 204, 113, 0.85); }
.nav-top.nav-zone-red { background: rgba(231, 76, 60, 0.85); }
.nav-bottom.nav-zone-green, .nav-bottom.nav-zone-red { bottom: 0; border-radius: 20px 20px 0 0; min-height: 28vh; }
.nav-bottom.nav-zone-green { background: rgba(46, 204, 113, 0.85); }
.nav-bottom.nav-zone-red { background: rgba(231, 76, 60, 0.85); }
.nav-top.hovered, .nav-bottom.hovered { transform: translateX(-50%) scale(1.05); border-color: rgba(255,255,255,0.95); }

.nav-middle-gap {
    top: calc(12vh + 20px);
    transform: translateX(-50%);
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
body.game-hud-visible .nav-middle-gap {
    top: calc(10vh + 8px);
}

.nav-question-centered {
    background: #e2e2e2;
    border: 6px solid #cc0000;
    color: #000;
    padding: 15px 30px;
    border-radius: 20px;
    font-size: 9vmin;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    z-index: 50;
    position: relative;
    top: 0;
}

/* Navigator: image question — hide question bar, show image bigger */
.nav-question-is-image.nav-question-centered,
.nav-question-is-image.nav-question {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 10px;
    font-size: inherit;
    font-weight: inherit;
}
.nav-question-is-image .memory-image,
.nav-question-is-image .memory-item.memory-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Navigator: emoji question (Memory Relay) — no question box, emoji very large for distance viewing */
.nav-question-is-emoji.nav-question-centered,
.nav-question-is-emoji.nav-question {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 10px;
    font-size: inherit;
    font-weight: inherit;
}
.nav-question-is-emoji .memory-item.memory-emoji,
.nav-question-is-emoji .memory-emoji {
    font-size: 28vmin !important;
    line-height: 1;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 20vh;
}
/* Default size for memory images (e.g. study grid) */
.memory-item.memory-image img.memory-image-img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}
/* Memory study phase: 4×4 grid; sizes kept smaller so title and countdown stay visible */
#memory-study-grid .memory-item.memory-emoji {
    font-size: clamp(40px, 7vmin, 80px) !important;
    line-height: 1;
}
#memory-study-grid .memory-item.memory-image img.memory-image-img,
#memory-study-grid .memory-item.memory-image img {
    max-width: clamp(72px, 11vmin, 140px) !important;
    max-height: clamp(72px, 11vmin, 140px) !important;
    object-fit: contain;
}
#memory-study-grid .memory-item.memory-shape svg {
    width: clamp(48px, 9vmin, 100px);
    height: clamp(48px, 9vmin, 100px);
}
/* Navigator question image: always use large size (survives re-renders) */
#engine-layer .nav-question-is-image .memory-image img,
#engine-layer .nav-question-is-image .memory-item.memory-image img,
.nav-question-is-image .memory-image img,
.nav-question-is-image .memory-item.memory-image img {
    max-width: min(92vmin, 480px) !important;
    max-height: min(58vh, 380px) !important;
    width: auto;
    height: auto;
    object-fit: contain;
}

.zone-content {
    font-size: 7vmin;
    font-weight: bold;
    color: #fff;
    margin: 10px 0;
    text-align: center;
    word-break: break-word;
    line-height: 1.15;
}

.zone-label-helper {
    font-size: 3vmin;
    color: rgba(255,255,255,0.8);
    margin-top: 10px;
}
/* Smasher */
.smasher-number { position: absolute; width: 26vmin; height: 26vmin; background: radial-gradient(circle, #6c5ce7, #4834d4); border: 6px solid white; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 7vmin; font-weight: bold; text-shadow: 2px 2px 0 #000; box-shadow: 0 5px 20px rgba(0,0,0,0.7); z-index: 30; transition: transform 0.1s ease-out; transform: translate(-50%, -50%); padding: 2vmin; box-sizing: border-box; word-wrap: break-word; text-align: center; }
.smasher-hand-marker { position: absolute; width: 3vmin; height: 3vmin; border-radius: 50%; z-index: 35; transform: translate(-50%, -50%); pointer-events: none; opacity: 1; border: 2px solid white; box-shadow: 0 0 10px rgba(255,255,255,0.8); transition: none; }
.smasher-hand-marker.smasher-marker-green { background-color: #2ecc71; } 
.smasher-hand-marker.smasher-marker-red { background-color: #e74c3c; } 

/* Launcher */
.launcher-question { position: absolute; top: 14vh; left: 50%; transform: translateX(-50%); background: #000; border: 6px solid #ffd700; color: #fff; padding: 15px 40px; border-radius: 0 0 20px 20px; font-size: 7vmin; font-weight: bold; text-align: center; width: 80%; box-shadow: 0 10px 20px rgba(0,0,0,0.8); z-index: 50; }
.launcher-target { position: absolute; width: 18vh; height: 18vh; background: transparent; border: none; border-radius: 0; display: flex; justify-content: center; align-items: center; color: white; font-size: 18vh; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); box-shadow: none; z-index: 20; transition: transform 0.1s; }
.launcher-target.sequencer-target { background: radial-gradient(circle, #5b2ca0, #2c1450); border: 4px solid rgba(255,255,255,0.95); border-radius: 50%; box-shadow: 0 5px 15px rgba(0,0,0,0.55); }
/* BATCHER: larger emojis, no background circle */
.batcher-target { position: absolute; background: transparent; border: none; border-radius: 0; display: flex; justify-content: center; align-items: center; font-size: 14vmin; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); box-shadow: none; z-index: 20; transition: transform 0.1s; }

.touch-pointer {
    position: absolute;
    z-index: 60;
    pointer-events: none;
    line-height: 1;
    filter: drop-shadow(0 0 10px #000);
    transition: none;
}
.touch-pointer .glyph-img {
    width: 1em;
    height: 1em;
}
.catcher-basket .glyph-img {
    width: 1em;
    height: 1em;
}

.picknplace-hand {
    position: absolute;
    font-size: 9vh;
    z-index: 70;
    pointer-events: none;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px #000);
    transition: none;
}
.picknplace-hand-grab {
    font-size: 11vh;
    filter: drop-shadow(0 0 14px rgba(94, 239, 255, 0.85));
}
.picknplace-hand-carry {
    font-size: 11vh;
    filter: drop-shadow(0 0 14px rgba(46, 204, 113, 0.9));
}
.picknplace-item {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 25;
    pointer-events: none;
    line-height: 1;
    text-shadow: 2px 4px 8px rgba(0,0,0,0.7);
}
.picknplace-source {
    z-index: 40;
    filter: drop-shadow(0 0 12px rgba(94, 239, 255, 0.7));
    transition: left 0.28s ease-out, top 0.28s ease-out;
}
.picknplace-source.picknplace-carried {
    z-index: 65;
    filter: drop-shadow(0 0 16px rgba(46, 204, 113, 0.95));
    transform: translate(-50%, -50%) scale(0.85);
    transition: none;
}
.picknplace-target {
    z-index: 20;
    padding: 10px;
    border: 6px dashed rgba(46, 204, 113, 0.85);
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.12);
    box-shadow: 0 0 24px rgba(46, 204, 113, 0.35);
}
.picknplace-obstacle {
    z-index: 30;
    filter: drop-shadow(0 0 12px rgba(231, 76, 60, 0.85));
}
.picknplace-obstacle-moving {
    transition: none;
}
.spatialmemory-static {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 35;
    pointer-events: none;
    font-size: 12vh;
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.85));
}
.spatialmemory-hint {
    position: absolute;
    left: 50%;
    top: 3%;
    transform: translateX(-50%);
    color: #fff;
    font-size: min(3.6vw, 2.8vh);
    font-weight: bold;
    text-align: center;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 2px 8px #000;
    white-space: nowrap;
}
.spatialmemory-study-timer {
    position: absolute;
    left: 50%;
    top: 7.2%;
    transform: translateX(-50%);
    color: #00d2ff;
    font-size: min(5vw, 4.4vh);
    font-weight: bold;
    text-align: center;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 0 16px rgba(0, 210, 255, 0.7);
}
.spatialmemory-circle {
    position: absolute;
    width: 12vh;
    height: 12vh;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.88);
    border-radius: 50%;
    background: rgba(255, 250, 235, 0.42);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.28), inset 0 0 16px rgba(255, 255, 255, 0.22);
    z-index: 18;
    pointer-events: none;
    box-sizing: border-box;
}
.spatialmemory-circle.filled {
    border-color: rgba(46, 204, 113, 0.9);
    background: rgba(210, 255, 225, 0.45);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.28), inset 0 0 14px rgba(255, 255, 255, 0.2);
}
.spatialmemory-circle.locked {
    border-color: rgba(255, 220, 120, 0.95);
    background: rgba(255, 242, 190, 0.48);
    box-shadow: 0 0 20px rgba(255, 220, 120, 0.32), inset 0 0 14px rgba(255, 255, 255, 0.2);
}
.spatialmemory-item {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 40;
    pointer-events: none;
    line-height: 1;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.7);
    transition: none;
}
.spatialmemory-item-study,
.spatialmemory-item-placed {
    z-index: 25;
    font-size: 7vh;
}
.spatialmemory-item-locked {
    z-index: 24;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
}
.spatialmemory-item-staging {
    z-index: 45;
    filter: drop-shadow(0 0 12px rgba(94, 239, 255, 0.75));
}
.spatialmemory-item-carried {
    z-index: 65;
    filter: drop-shadow(0 0 16px rgba(46, 204, 113, 0.95));
    transform: translate(-50%, -50%) scale(0.9);
    transition: none;
}
.spatialmemory-item-flyback {
    z-index: 62;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 16px rgba(231, 76, 60, 0.95));
    transition: left 0.62s cubic-bezier(0.2, 0.8, 0.25, 1), top 0.62s cubic-bezier(0.15, 0.9, 0.3, 1.05);
}
.spatialmemory-hand {
    z-index: 70;
}
.launcher-cannon { position: absolute; bottom: 5vh; transform: translateX(-50%); font-size: 12vh; text-shadow: 0 0 20px #00d2ff; z-index: 20; transition: left 0.05s linear; }
.launcher-ball { position: absolute; width: 5vh; height: 5vh; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 15px #fff; z-index: 15; }
#ordering-rack { position: absolute; bottom: 15vh; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; align-items: center; justify-content: center; z-index: 30; min-height: 10vh; }
.collected-item { width: 12vmin; height: 12vmin; background: radial-gradient(circle, #2ecc71, #27ae60); border: 3px solid #fff; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 5vmin; font-weight: bold; text-shadow: 2px 2px 0 #000; box-shadow: 0 5px 15px rgba(0,0,0,0.5); animation: slideUp 0.5s ease-out; }
/* Common */
#center-circle { position: absolute; bottom: 25%; left: 50%; transform: translateX(-50%); width: 22vmin; height: 22vmin; border: 8px solid #ff4757; border-radius: 50%; background: rgba(255, 71, 87, 0.2); display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 0 50px #ff4757; animation: pulse 1s infinite; }
.stick-figure { width: 50%; height: 50%; margin-bottom: 5px; stroke: white; stroke-width: 2; fill: none; }
.center-text { font-size: 3vmin; color: #fff; font-weight: bold; text-shadow: 2px 2px 0 #000; }
@keyframes pulse { 0% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.1); opacity: 0.8; } 100% { transform: translateX(-50%) scale(1); } }
#finu-img { width: 100%; height: 100%; object-fit: contain; }
#player-marker { position: absolute; font-size: 14vmin; transform: translate(-50%, -50%); z-index: 90; filter: drop-shadow(0 0 10px #000); }
/* Full-screen opaque red overlay when proximity check says step back; only timer bar (z-index 1000) stays visible */
#warning-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 0, 0, 0.8);
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}
#warning-overlay.visible { display: flex; }
#warning-overlay.hidden { display: none !important; }
#warning-msg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: transparent; color: white; padding: 24px 48px; font-size: 12vmin; font-weight: bold; text-align: center; display: none; text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 2px 4px rgba(0,0,0,0.9); }
#warning-overlay.visible #warning-msg { display: block; animation: flashWarn 0.5s infinite alternate; }
#warning-msg.visible { display: block; animation: flashWarn 0.5s infinite alternate; }
@keyframes flashWarn { from { opacity: 1; } to { opacity: 0.5; } }
#loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #00d2ff; font-size: 6vh; font-weight: bold; }
/* Study instruction – full screen, big font, before Memory Relay / Blueprint study phase */
#study-instruction-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex; justify-content: center; align-items: center;
    z-index: 2600;
    padding: 24px;
    box-sizing: border-box;
    pointer-events: auto;
}
#study-instruction-overlay.hidden { display: none !important; }
.study-instruction-content {
    text-align: center;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}
.study-instruction-text {
    margin: 0;
    color: #fff;
    font-size: min(6vw, 42px);
    font-weight: bold;
    line-height: 1.4;
    max-width: 800px;
}
.study-instruction-ok {
    padding: 16px 48px;
    font-size: min(5vw, 24px);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}
.study-instruction-ok:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
}
.study-instruction-ok:active { transform: scale(0.98); }
/* Description intro – full-screen card art with overlay copy */
#description-intro-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #1a1420;
    display: flex; justify-content: center; align-items: stretch;
    z-index: 2500;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}
#description-intro-overlay.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}
.description-intro-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    line-height: 0;
    border-radius: 0;
    overflow: hidden;
    background: #1a1420;
    display: none;
}
.description-intro-cover.has-art {
    display: block;
}
.description-intro-cover .glyph-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center;
}
.description-intro-content {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 4vh 6vw 6vh;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.12) 28%, rgba(0, 0, 0, 0.18) 48%, rgba(0, 0, 0, 0.78) 100%);
    pointer-events: none;
}
.description-intro-copy {
    width: 100%;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.description-intro-title {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 6vw, 56px);
    font-weight: 800;
    line-height: 1.15;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}
.description-intro-story {
    margin: 0;
    color: #ffe7b0;
    font-size: clamp(18px, 3.4vw, 28px);
    line-height: 1.35;
    font-weight: 800;
    max-width: 860px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
}
.description-intro-text {
    margin: 0;
    color: #fff;
    font-size: clamp(16px, 2.8vw, 24px);
    line-height: 1.4;
    font-weight: 700;
    max-width: 820px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
}
.description-intro-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    margin: 0;
    width: 1.2em;
    height: 1.2em;
    line-height: 1.2em;
    font-size: clamp(56px, 12vw, 110px);
    font-weight: bold;
    color: #00d2ff;
    text-align: center;
    text-shadow: 0 0 30px rgba(0, 210, 255, 0.8), 0 2px 12px rgba(0, 0, 0, 0.7);
    animation: countdownPulse 1s ease-in-out;
    pointer-events: none;
}
@keyframes countdownPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#message-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; display: flex; justify-content: center; align-items: center; z-index: 2000; color: white; font-size: 8vmin; font-weight: bold; text-align: center; white-space: pre-wrap; padding: 20px; box-sizing: border-box; pointer-events: none; overflow: hidden; }
#message-text { max-width: 50%; width: 50%; min-width: 300px; display: flex; justify-content: center; align-items: center; background: rgba(40, 40, 140, 0.85); backdrop-filter: blur(10px); border-radius: 100px; border: 15px solid rgba(255, 255, 255, 0.65); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); padding: 40px 30px; box-sizing: border-box; pointer-events: auto; overflow: visible; }

/* Final score modal – shown at game end until dismissed */
#final-score-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex; justify-content: center; align-items: center;
    z-index: 5000;
    pointer-events: auto;
}
body.final-score-open .btn-glass-back,
body.final-score-open .btn-fullscreen-toggle,
body.final-score-open #game-hud,
body.final-score-open #game-question-bar,
body.final-score-open #game-score-center,
body.final-score-open #game-score-flash,
body.final-score-open #goal-hit-indicator,
body.final-score-open #engine-layer,
body.final-score-open #ordering-rack,
body.final-score-open #center-circle,
body.final-score-open #player-marker,
body.final-score-open #message-overlay,
body.final-score-open #warning-overlay {
    display: none !important;
    pointer-events: none !important;
}
.final-score-outcome {
    font-size: clamp(14px, 2.4vw, 22px);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.3;
    margin: 0 auto 8px;
    max-width: 18em;
    text-transform: none;
    color: #fff;
    background: #243049;
    border: 2px solid #f0c36a;
    border-radius: 12px;
    padding: 6px 12px;
    text-shadow: none;
}
.final-score-outcome.hidden { display: none !important; }
.final-score-outcome.is-win {
    color: #fffdf2;
    background: rgba(8, 36, 18, 0.92);
    border-color: #b8ff6a;
}
.final-score-outcome.is-lose {
    color: #fff8e8;
    background: rgba(42, 18, 6, 0.92);
    border-color: #ffd36a;
    font-size: clamp(18px, 4vw, 32px);
}
.final-score-modal-win #final-score-value,
.final-score-modal-lose #final-score-value,
.final-score-team,
#final-score-value,
.final-score-time-bonus {
    display: none !important;
}

#goal-track {
    position: relative;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    height: var(--game-hud-goal-h);
    margin: 0 76px;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
}
#goal-track.hidden { display: none !important; }
.goal-track-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 88px;
    flex-shrink: 0;
    line-height: 1.1;
}
.goal-track-flag {
    font-size: 26px;
    line-height: 1;
    margin: 0 0 0 4px;
    filter: drop-shadow(0 2px 6px #000);
    flex-shrink: 0;
}
.goal-track-rail-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    height: 100%;
}
.goal-track-rail {
    position: relative;
    flex: 1;
    height: 14px;
    width: auto;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.45);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}
.goal-track-mascot {
    position: absolute;
    left: 0;
    bottom: 50%;
    transform: translate(-50%, 50%);
    font-size: 32px;
    line-height: 1;
    transition: left 0.35s ease;
    filter: drop-shadow(0 3px 8px #000);
    z-index: 2;
}
.goal-track-label {
    display: block;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 6px #000;
    white-space: nowrap;
    margin-top: 2px;
}
.goal-track-label.hidden { display: none !important; }
.combi-step {
    margin-top: 2px;
    color: #ffe082;
    font-weight: 800;
    font-size: 12px;
    text-shadow: 0 2px 6px #000;
    white-space: nowrap;
}
.combi-step.hidden { display: none !important; }
#goal-hit-indicator {
    position: fixed;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    z-index: 1400;
    pointer-events: none;
    font-size: 14vh;
    font-weight: 800;
    text-shadow: 0 0 28px currentColor;
}
#goal-hit-indicator.hidden { display: none !important; }
#goal-hit-indicator.is-good { color: #2ecc71; animation: goalHitPop 0.45s ease-out; }
#goal-hit-indicator.is-bad { color: #e74c3c; animation: goalHitPop 0.45s ease-out; }
@keyframes goalHitPop {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    35% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.final-score-content {
    position: relative;
    background: #1b2436;
    border: 3px solid #f0c36a;
    border-radius: 20px;
    padding: 0 0 10px;
    text-align: center;
    width: min(92vw, 560px);
    height: auto;
    min-width: 0;
    min-height: 0;
    max-width: min(92vw, 560px);
    max-height: calc(100% - 24px);
    overflow: hidden;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    box-sizing: border-box;
    color: #fff;
    margin: auto;
}
.final-score-content.is-practice-end {
    width: min(90vw, 90vh, 420px);
    height: min(90vw, 90vh, 420px);
    max-width: min(90vw, 90vh, 420px);
    max-height: min(90vw, 90vh, 420px);
    aspect-ratio: 1 / 1;
    padding: 0 0 8px;
}
.final-score-content.is-practice-end .final-score-banner {
    display: none;
}
.final-score-content.is-practice-end .final-score-overlay {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    justify-content: flex-start;
    gap: 6px;
    padding: 36px 12px 8px;
    background: #1b2436;
}
.final-score-content.is-practice-end .final-score-outcome {
    margin: 0 auto 4px;
    padding: 6px 10px;
    font-size: 13px;
    max-width: none;
}
.final-score-content.is-practice-end .final-score-share {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    gap: 6px;
}
.final-score-content.is-practice-end .final-score-share-card,
.final-score-content.is-practice-end .vn-share-card {
    display: block !important;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    object-fit: contain;
}
.final-score-banner {
    display: block;
    width: 100%;
    height: clamp(110px, 26vw, 260px);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    background: #fff1d6;
    border-radius: 17px 17px 0 0;
    position: relative;
    z-index: 2;
}
.final-score-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 6;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #142033;
    color: #fff;
    font-size: 22px;
    line-height: 32px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.final-score-close:hover {
    background: #2a3a55;
}
.final-score-cover {
    position: absolute;
    top: clamp(110px, 26vw, 260px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    display: none;
    overflow: hidden;
    background: #1a1420;
    pointer-events: none;
}
.final-score-content.has-card-art {
    padding: 0 0 10px;
    background: #1b2436;
}
.final-score-content.has-card-art.is-join {
    padding: 0 0 10px;
    background: #1b2436;
}
.final-score-content.has-card-art .final-score-cover {
    display: block;
}
.final-score-content.is-join .final-score-cover {
    display: none !important;
}
.final-score-cover .glyph-img,
.final-score-cover.glyph-has-image {
    display: block;
    width: 100%;
    height: 100%;
}
.final-score-cover .glyph-img {
    object-fit: cover;
    object-position: center;
}
.final-score-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 12px 4px;
    box-sizing: border-box;
    overflow: hidden;
    flex: 0 0 auto;
}
.final-score-content:not(.has-card-art) .final-score-overlay {
    justify-content: flex-start;
    padding: 8px 12px 4px;
    height: auto;
    overflow: hidden;
    background: #1b2436;
}
.final-score-content.has-card-art .final-score-overlay {
    background: linear-gradient(180deg, rgba(8, 4, 12, 0.35) 0%, rgba(8, 4, 12, 0.55) 38%, rgba(8, 4, 12, 0.92) 100%);
}
.final-score-content.is-join .final-score-overlay {
    background: #1b2436;
    overflow: hidden;
    padding: 8px 12px 4px;
    gap: 4px;
    height: auto;
    flex: 0 0 auto;
}
.final-score-content.is-join .btn-final-score-play,
.final-score-content.is-join .btn-final-score-dismiss {
    padding: 8px 16px;
    font-size: 14px;
}
@media (max-height: 480px) {
    .final-score-banner { height: clamp(72px, 28vh, 140px); }
    .final-score-cover { top: clamp(72px, 28vh, 140px); }
    .contest-join-qr img,
    .contest-join-qr canvas {
        width: 96px !important;
        height: 96px !important;
    }
    .contest-join-pay { flex: 0 0 112px; }
    .contest-signup-panel h2 { font-size: 0.95rem; }
}
.final-score-content.is-join .final-score-outcome {
    margin: 0 auto 4px;
    padding: 4px 10px;
    font-size: 14px;
    background: #243049;
    border: 1px solid #f0c36a;
    text-shadow: none;
}
.final-score-content.has-card-art .final-score-share-card {
    display: none !important;
}
.final-score-team {
    color: #fff;
    font-size: min(12vw, 56px);
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}
#final-score-value {
    font-size: min(22vw, 120px);
    font-weight: bold;
    color: #2ecc71;
    text-shadow: 0 0 24px rgba(46, 204, 113, 0.6);
    margin-bottom: 28px;
    line-height: 1.1;
}
.final-score-time-bonus {
    font-size: min(6vw, 32px);
    color: #f1c40f;
    margin-bottom: 20px;
}
.final-score-time-bonus.hidden {
    display: none !important;
}
.btn-final-score-dismiss {
    padding: 10px 22px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}
.btn-final-score-dismiss:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
}
.btn-final-score-dismiss:active {
    transform: scale(0.98);
}
.btn-final-score-play {
    padding: 10px 22px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #c45c12, #e24b3b);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(196, 92, 18, 0.4);
}
.btn-final-score-play:hover { filter: brightness(1.06); }
.btn-final-score-contest {
    padding: 10px 22px;
    font-size: 16px;
    font-weight: bold;
    color: #1b2436;
    background: linear-gradient(135deg, #f0c36a, #c45c12);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(196, 92, 18, 0.4);
}
.btn-final-score-contest:hover { filter: brightness(1.06); }
.btn-final-score-contest.hidden { display: none !important; }
.final-score-content.is-join .btn-final-score-contest {
    padding: 8px 16px;
    font-size: 14px;
}
.final-score-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
    flex-shrink: 0;
}
.final-score-share {
    margin: 6px auto 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.final-score-share-card {
    width: min(42vw, 160px);
    height: auto;
    max-height: 180px;
    object-fit: contain;
    border-radius: 10px;
    background: #fffaf0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.final-score-share-card.hidden { display: none; }
.final-score-share-label {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fffdf6;
    text-shadow: 0 1px 0 #000, 0 2px 8px rgba(0, 0, 0, 0.9);
}
.final-score-share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.final-score-share-buttons .share-btn,
.vn-share-buttons .share-btn {
    border: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.final-score-share-buttons .share-btn svg,
.vn-share-buttons .share-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    display: block;
}
.vn-share-buttons .share-btn-copy,
.final-score-share-buttons .share-btn-copy { background: #3d4d6b; }
.vn-share-buttons .share-btn-facebook,
.final-score-share-buttons .share-btn-facebook { background: #1877f2; }
.vn-share-buttons .share-btn-instagram,
.final-score-share-buttons .share-btn-instagram { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.vn-share-buttons .share-btn-whatsapp,
.final-score-share-buttons .share-btn-whatsapp { background: #25d366; }
.vn-share-buttons .share-btn:hover,
.final-score-share-buttons .share-btn:hover { filter: brightness(1.08); }
.vn-share-buttons .share-btn-copy:hover,
.final-score-share-buttons .share-btn-copy:hover { background: #3d4d6b; }
.vn-share-buttons .share-btn-facebook:hover,
.final-score-share-buttons .share-btn-facebook:hover { background: #1877f2; }
.vn-share-buttons .share-btn-instagram:hover,
.final-score-share-buttons .share-btn-instagram:hover { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.vn-share-buttons .share-btn-whatsapp:hover,
.final-score-share-buttons .share-btn-whatsapp:hover { background: #25d366; }
.vn-share-buttons .share-btn:active,
.final-score-share-buttons .share-btn:active { transform: scale(0.96); }
.vn-share-buttons .share-btn.is-copied,
.final-score-share-buttons .share-btn.is-copied { background: #2ecc71; }

.share-hint-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(16px);
    background: #142033;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.35;
    z-index: 30000;
    opacity: 0;
    pointer-events: none;
    max-width: min(92vw, 420px);
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: opacity 0.2s, transform 0.2s;
}
.share-hint-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.contest-signup-panel {
    margin: 0;
    text-align: left;
    color: #fff;
    background: #243049;
    border: 1px solid #3d4d6b;
    border-radius: 12px;
    padding: 8px 10px 8px;
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
}
.contest-signup-panel h2 {
    margin: 0 0 2px;
    font-size: 1.05rem;
    color: #ffe08a;
    text-align: center;
    text-shadow: none;
}
.contest-signup-panel > p {
    margin: 0 0 8px;
    font-size: 0.85rem;
    text-align: center;
    color: #f2f4f8;
}
.contest-join-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
}
.contest-join-fields {
    flex: 1 1 auto;
    min-width: 0;
}
.contest-signup-panel input[type="text"],
.contest-signup-panel input[type="email"],
.contest-signup-panel input[type="password"],
.contest-signup-panel input[type="tel"] {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 5px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid #c9d3e4;
    background: #fff;
    color: #142033;
    font-size: 14px;
}
.contest-signup-panel input::placeholder {
    color: #5d6b82;
}
.contest-signup-panel input.invalid {
    border-color: #d64545;
}
.contest-join-pay {
    margin: 0;
    padding: 0;
    border: none;
    text-align: center;
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
}
.contest-join-amount {
    margin: 0;
    font-weight: 800;
    font-size: 1.15rem;
    color: #7dcea0;
}
.contest-join-qr {
    display: flex;
    justify-content: center;
    margin: 0;
    background: #fff;
    padding: 6px;
    width: fit-content;
    border-radius: 8px;
}
.contest-join-qr img,
.contest-join-qr canvas {
    display: block;
    width: 120px !important;
    height: 120px !important;
}
.contest-upi-link {
    display: inline-block;
    margin: 0;
    color: #ffe08a;
    font-weight: 800;
    font-size: 13px;
}
.signup-agree {
    display: block;
    text-align: left;
    font-size: 12px;
    line-height: 1.3;
    margin: 4px 0 6px;
    color: #f2f4f8;
}
.signup-agree input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
    vertical-align: middle;
}
.signup-agree a { color: #ffe08a; }
.contest-signup-panel button[type="submit"] {
    width: 100%;
    margin-top: 0;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #c45c12;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
}
.contest-auth-switch {
    margin: 4px 0 0;
    text-align: center;
    font-size: 13px;
    color: #d7deea;
}
.contest-auth-error {
    margin: 4px 0 0;
    font-size: 13px;
    text-align: center;
}
.contest-auth-error.is-error { color: #ffb4a8; }
.contest-auth-error:not(.is-error) { color: #7dcea0; }
.contest-forgot-row {
    text-align: right;
    margin: -2px 0 6px;
}
.contest-forgot-row button,
.contest-auth-switch button {
    background: none;
    border: none;
    color: #ffe08a;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 13px;
}
.contest-entered-msg {
    margin: 0 0 8px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
    text-shadow: none;
}
.contest-entered-msg .signup-whatsapp,
.contest-signup-panel .signup-whatsapp {
    display: inline-block;
    margin-top: 8px;
    background: #25d366;
    color: #fff !important;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    padding: 12px 16px;
    border-radius: 12px;
}
.contest-signup-panel .signup-whatsapp:hover { background: #1ebe5d; }
.contest-signup-panel .partner-code-box.hidden,
#final-score-modal .partner-code-box {
    display: none !important;
}
.partner-code-or {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #d7deea;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.partner-code-box form {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: center;
}
.partner-code-box input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid #c9d3e4;
    background: #fff;
    color: #142033;
    font-size: 14px;
}
.partner-code-box button[type="submit"] {
    width: auto;
    margin-top: 0;
    padding: 7px 12px;
    font-size: 13px;
}
.partner-code-msg {
    flex: 1 1 100%;
    margin: 4px 0 0;
    font-size: 13px;
    text-align: center;
}
.partner-code-msg.is-error { color: #ffb4a8; }
.partner-code-msg:not(.is-error) { color: #7dcea0; }
/* Mobile Responsive Styles */
@media (max-width: 768px) {
    #message-text { width: 80%; max-width: 80%; min-width: 280px; }
    
    /* Top Header */
    .top-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-logo {
        height: 40px;
        min-width: 100px;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        max-width: 100%;
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .header-brand {
        font-size: 28px;
    }
    .header-brand .brand-n sup { font-size: 0.55em; }
    
    .header-tabs-container {
        width: 100%;
    }
    
    .header-tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .profile-pill {
        flex-wrap: wrap;
        min-width: 150px;
        max-width: 100%;
    }
    
    .profile-pill #user-display-name {
        max-width: 120px;
    }
    
    #gopro-btn {
        margin-left: 0 !important;
        margin-top: 5px;
        width: 100%;
    }
    
    .profile-pill {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    #signup-btn, #gopro-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    /* Search Section */
    .search-section {
        padding: 15px;
    }
    
    /* Hero Banner */
    .hero-banner {
        flex-direction: column;
        padding: 20px;
        margin: 15px;
        gap: 15px;
        min-height: auto;
    }
    
    .hero-content {
        width: 100%;
    }
    
    .hero-content h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .hero-content p {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .hero-btn {
        padding: 12px 25px;
        font-size: 14px;
        width: 100%;
    }
    
    .player-rank {
        width: 100%;
        min-width: auto;
        max-width: 100%;
        padding: 15px;
    }
    
    .player-rank .rank-value {
        font-size: 28px;
    }
    
    .leaderboard-compact {
        width: 100%;
        min-width: auto;
        max-width: 100%;
        padding: 15px;
    }
    
    .leaderboard-compact .leaderboard-name-cell {
        max-width: 120px;
    }
    
    .leaderboard-compact .leaderboard-name {
        max-width: 100px;
        font-size: 13px;
    }
    
    /* Sections */
    .section-header {
        padding: 0 15px;
        margin: 20px 0 15px 0;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    /* Worksheet Grid */
    .worksheet-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
        padding: 0 15px;
        margin-bottom: 30px;
    }
    
    .ws-card {
        min-height: 180px;
    }
    
    .ws-card h3 {
        font-size: 18px;
    }
    
    .ws-description {
        font-size: 13px;
    }
    
    /* Topic Section */
    .topic-section {
        padding: 0 15px;
        margin-bottom: 30px;
    }
    
    .topic-header {
        font-size: 18px;
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    
    .topic-cards-container {
        gap: 15px;
    }
    
    .topic-cards-grid .ws-card {
        min-width: 200px;
    }
    
    /* Create Card */
    .create-card {
        min-height: 180px;
        padding: 20px;
    }
    
    .create-card-icon {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .create-card h3 {
        font-size: 16px;
    }
    
    /* Content Area */
    .content-area > section,
    .content-area > div {
        padding-left: 0;
        padding-right: 0;
    }
    .content-area > .team-scores-table-wrap {
        padding-left: 30px;
        padding-right: 30px;
    }

    /* Home Screen */
    #home-screen .home-container {
        padding: 24px 20px;
        max-width: 100%;
    }
    #home-screen .home-title {
        font-size: 32px;
    }
    #home-screen .home-subtitle {
        font-size: 16px;
        margin-bottom: 30px;
    }
    #home-screen .path-buttons {
        flex-direction: column;
        gap: 20px;
    }
    #home-screen .path-btn {
        min-width: 0;
        width: 100%;
        max-width: 280px;
        padding: 28px 24px;
    }
    #home-screen .path-icon {
        font-size: 48px;
    }
    #home-screen .path-name {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 10px;
    }
    
    .header-logo {
        height: 36px;
        min-width: 90px;
    }
    
    .header-brand {
        font-size: 24px;
    }
    .header-brand .brand-n sup { font-size: 0.55em; }
    
    .header-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .header-center {
        max-width: 100%;
    }
    
    .profile-pill {
        min-width: 120px;
    }
    
    .profile-pill #user-display-name {
        max-width: 100px;
    }
    
    .hero-banner {
        padding: 15px;
        margin: 10px;
    }
    
    .hero-content h1 {
        font-size: 20px;
    }
    
    .hero-content p {
        font-size: 13px;
    }
    
    .worksheet-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .topic-cards-grid .ws-card {
        min-width: 180px;
    }
    
    .leaderboard-compact .leaderboard-rank-cell,
    .leaderboard-compact .leaderboard-score-cell {
        font-size: 13px;
    }
    
    .leaderboard-compact .leaderboard-name {
        font-size: 12px;
    }

    /* Home Screen (small phones) */
    #home-screen .home-container {
        padding: 16px 12px;
    }
    #home-screen .home-logo .game-logo {
        height: 60px !important;
    }
    #home-screen .home-title {
        font-size: 26px;
    }
    #home-screen .path-btn {
        padding: 22px 20px;
    }
    #home-screen .path-icon {
        font-size: 40px;
    }
    #home-screen .path-name {
        font-size: 20px;
    }
}
#exit-btn { position: fixed; bottom: 14vh; right: 2vw; z-index: 200; background: #ff4757; color: white; border: 3px solid white; padding: 10px 25px; border-radius: 50px; font-weight: bold; font-size: 20px; pointer-events: auto; }

/* DASHBOARD FOOTER & CREATOR */
.dash-footer { 
    text-align: center; 
    padding: 30px 20px; 
    color: var(--text-muted); 
    font-size: 12px; 
    opacity: 0.7; 
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--main-bg);
    z-index: 100;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 10000; }
.modal.hidden { display: none !important; }
.modal-content { background: white; padding: 30px; border-radius: 15px; width: 95%; max-width: 1200px; max-height: 95vh; overflow-y: auto; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3); scrollbar-width: none; -ms-overflow-style: none; }
.modal-content::-webkit-scrollbar { display: none; }
.modal-content h2 { margin-top: 0; margin-bottom: 25px; color: var(--text-main); font-size: 28px; }

/* Settings modal */
.settings-modal-content,
.team-select-modal-content {
    max-width: 480px;
    text-align: left;
}
.team-select-modal-content {
    text-align: center;
}
.team-select-modal-content .settings-hint {
    text-align: center;
}
.team-select-modal-content .settings-camera-select {
    margin: 0 auto 10px;
}
.settings-modal-content h2 {
    text-align: center;
}
.settings-section {
    margin-bottom: 24px;
}
.settings-section h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: var(--text-main);
}
.settings-hint {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.settings-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}
.settings-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.settings-camera-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}
.settings-teams-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.settings-team-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}
.settings-team-input:focus {
    outline: none;
    border-color: var(--accent-color);
}
.btn-clear-storage {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.btn-clear-storage:hover {
    background: #c0392b;
}

.settings-modal-actions {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
}


.guest-warning {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2) 0%, rgba(255, 87, 34, 0.2) 100%);
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    color: #ffeb3b;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.btn-gold-pulse {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #1a1a2e;
    border: 2px solid #ffc107;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: goldPulse 2s ease-in-out infinite;
    text-shadow: none;
}

@keyframes goldPulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(255, 193, 7, 0.5), 0 0 20px rgba(255, 193, 7, 0.3); 
    }
    50% { 
        box-shadow: 0 6px 25px rgba(255, 193, 7, 0.7), 0 0 30px rgba(255, 193, 7, 0.5); 
    }
}

.btn-gold-pulse:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 193, 7, 0.7), 0 0 30px rgba(255, 193, 7, 0.5);
    background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
}

.btn-link-danger {
    background: transparent;
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.btn-link-danger:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.type-select { width: 100%; padding: 10px; margin-bottom: 15px; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; }
.common-q-container { background: #e3f2fd; padding: 10px; margin-bottom: 10px; border-radius: 5px; border: 1px solid #90caf9; display: none; }
.common-q-container.visible { display: block; }
#sheet-grid { border: 2px solid #ddd; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; background: #eee; gap: 2px; border-radius: 8px; scrollbar-width: none; -ms-overflow-style: none; }
#sheet-grid::-webkit-scrollbar { display: none; }
.sheet-row { display: grid; grid-template-columns: 50px 2fr 1.2fr 1.2fr 1.2fr; background: white; gap: 2px; }
.sheet-row.unlock-row { background: #f8f9fa; }
.sheet-row.unlock-row .sheet-cell { border: none; }
.sheet-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); font-weight: bold; color: white; position: sticky; top: 0; z-index: 10; border-radius: 6px 6px 0 0; }
.sheet-cell { padding: 12px 8px; display: flex; align-items: center; justify-content: center; }
.sheet-cell input { width: 100%; height: 40px; border: 2px solid #e0e0e0; padding: 8px 12px; box-sizing: border-box; font-family: inherit; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.sheet-cell input:focus { background: #f8f9ff; outline: none; border-color: #00d2ff; }
.sheet-cell input::placeholder { color: #bbb; }
.row-num { background: #f9f9f9; color: #888; font-size: 12px; }
.save-btn { background: #2ecc71; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; margin: 0 5px; }
.cancel-btn { background: #95a5a6; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; margin: 0 5px; }
.add-q-btn { background: #3498db; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; margin: 0 5px; }

/* ANSWER FEEDBACK ANIMATION */
@keyframes feedbackPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
}



/* GYM OVERLAY */
.gym-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.3); /* Transparent overlay like game mode */
    color: white;
    z-index: 50;
    animation: fadeIn 0.5s;
    backdrop-filter: blur(2px); /* Slight blur for readability */
}

.gym-title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 5vh;
    color: #f1c40f; /* Gold */
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.gym-instr {
    font-size: 8vh;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 30px;
}

.gym-count {
    font-size: 6vh;
    font-weight: 900;
    color: #2ecc71; /* Green */
    font-family: monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); /* Add shadow for visibility */
}

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

.revival-exercise-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Top Left Back Button - above timer/score so always visible */
.btn-glass-back {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3); /* Dark see-through */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Blurs the camera behind it */
    z-index: 1005;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-glass-back:active {
    transform: scale(0.9);
    background: rgba(255, 0, 0, 0.5); /* Red tint on press */
}

/* Top right fullscreen toggle (game-container) - above timer/score */
.btn-fullscreen-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1005;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    cursor: pointer;
    transition: transform 0.2s;
    pointer-events: auto;
}

.btn-fullscreen-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-fullscreen-toggle:active {
    transform: scale(0.9);
}

/* Static legal / contact pages */
.static-body {
    background: #fff6e8;
    color: #3d2a18;
    margin: 0;
    min-height: 100vh;
}
.body-overflow-auto { overflow: auto; }
.static-header,
.top-header.static-header {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0c0b10;
    padding: 12px 16px;
    text-align: center;
    flex-wrap: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.static-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.static-banner,
.static-logo {
    display: block;
    width: auto;
    max-width: min(920px, 100%);
    height: auto;
    max-height: 180px;
    object-fit: contain;
    object-position: center;
    margin: 0 auto;
}
.static-logo {
    max-height: 64px;
}
@media (max-width: 768px) {
    .top-header.static-header {
        padding: 10px 12px;
        justify-content: center;
        flex-wrap: nowrap;
    }
    .static-banner { max-height: 120px; }
    .static-logo { max-height: 52px; }
}
.doc-back-arrow {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(42, 24, 64, 0.75);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.4rem;
}
.static-container {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}
.static-container--narrow { max-width: 760px; }
.static-card {
    background: #fff;
    border: 2px solid #f0b14a;
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: 0 10px 28px rgba(42, 24, 64, 0.08);
}
.static-doc h1 { color: #2a1840; margin: 0 0 8px; font-size: 1.8rem; }
.static-doc h2 { color: #2a1840; font-size: 1.15rem; margin: 1.4em 0 0.5em; }
.static-doc #refunds { scroll-margin-top: 88px; }
.static-doc p, .static-doc li { line-height: 1.6; }
.static-doc ol { padding-left: 1.2em; }
.static-doc ul { padding-left: 1.2em; margin: 0.4em 0 1em; }
.static-doc-head { text-align: center; margin-bottom: 28px; }
.doc-date { color: #6b5340; font-size: 0.95rem; margin: 0; }
.static-lead { color: #4b5563; font-size: 1.05rem; }
.static-link { color: #c45c12; }
.static-footer {
    text-align: center;
    color: #7a6454;
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 40px;
}
.static-footer a { color: #7a6454; }
.static-contact-box {
    background: #fffaf0;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid rgba(196, 92, 18, 0.32);
}
.static-contact-email { font-size: 1.15rem; margin: 16px 0; }
.static-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 12px 22px;
    border-radius: 8px;
    background: #c45c12;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.static-btn:hover { background: #a84d0f; }
